Commit 7a13c48
Changed files (37)
bin
lib
xml
kit
templates
spec
bin/console
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
-require "bundler/setup"
-require "xml/kit"
+require 'bundler/setup'
+require 'xml/kit'
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "xml/kit"
# require "pry"
# Pry.start
-require "irb"
+require 'irb'
IRB.start(__FILE__)
lib/xml/kit/crypto/oaep_cipher.rb
@@ -4,8 +4,8 @@ module Xml
class OaepCipher
ALGORITHMS = {
'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' => true,
- }
- def initialize(algorithm, key)
+ }.freeze
+ def initialize(_algorithm, key)
@key = key
end
lib/xml/kit/crypto/rsa_cipher.rb
@@ -2,9 +2,9 @@ module Xml
module Kit
module Crypto
class RsaCipher
- ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
+ ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5".freeze
- def initialize(algorithm, key)
+ def initialize(_algorithm, key)
@key = key
end
lib/xml/kit/crypto/symmetric_cipher.rb
@@ -2,13 +2,13 @@ module Xml
module Kit
module Crypto
class SymmetricCipher
- DEFAULT_ALGORITHM="#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc"
+ DEFAULT_ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc".freeze
ALGORITHMS = {
- "#{::Xml::Kit::Namespaces::XMLENC}tripledes-cbc" => "DES-EDE3-CBC",
- "#{::Xml::Kit::Namespaces::XMLENC}aes128-cbc" => "AES-128-CBC",
- "#{::Xml::Kit::Namespaces::XMLENC}aes192-cbc" => "AES-192-CBC",
- "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc" => "AES-256-CBC",
- }
+ "#{::Xml::Kit::Namespaces::XMLENC}tripledes-cbc" => 'DES-EDE3-CBC',
+ "#{::Xml::Kit::Namespaces::XMLENC}aes128-cbc" => 'AES-128-CBC',
+ "#{::Xml::Kit::Namespaces::XMLENC}aes192-cbc" => 'AES-192-CBC',
+ "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc" => 'AES-256-CBC',
+ }.freeze
attr_reader :key
@@ -29,9 +29,9 @@ module Xml
def decrypt(cipher_text)
cipher.decrypt
- iv = cipher_text[0..cipher.iv_len-1]
+ iv = cipher_text[0..cipher.iv_len - 1]
data = cipher_text[cipher.iv_len..-1]
- #cipher.padding = 0
+ # cipher.padding = 0
cipher.key = @key
cipher.iv = iv
cipher.update(data) + cipher.final
lib/xml/kit/crypto/unknown_cipher.rb
@@ -2,10 +2,9 @@ module Xml
module Kit
module Crypto
class UnknownCipher
- def initialize(algorithm, key)
- end
+ def initialize(algorithm, key); end
- def self.matches?(algorithm)
+ def self.matches?(_algorithm)
true
end
lib/xml/kit/templates/signature.builder
@@ -1,4 +1,4 @@
-xml.Signature "xmlns" => ::Xml::Kit::Namespaces::XMLDSIG do
+xml.Signature 'xmlns' => ::Xml::Kit::Namespaces::XMLDSIG do
xml.SignedInfo do
xml.CanonicalizationMethod Algorithm: ::Xml::Kit::Namespaces::CANONICALIZATION
xml.SignatureMethod Algorithm: signature_method
@@ -8,10 +8,10 @@ xml.Signature "xmlns" => ::Xml::Kit::Namespaces::XMLDSIG do
xml.Transform Algorithm: ::Xml::Kit::Namespaces::CANONICALIZATION
end
xml.DigestMethod Algorithm: digest_method
- xml.DigestValue ""
+ xml.DigestValue ''
end
end
- xml.SignatureValue ""
+ xml.SignatureValue ''
xml.KeyInfo do
xml.X509Data do
xml.X509Certificate certificate.stripped
lib/xml/kit/certificate.rb
@@ -3,8 +3,8 @@ module Xml
# {include:file:spec/xml/certificate_spec.rb}
class Certificate
BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z)
- BEGIN_CERT=/-----BEGIN CERTIFICATE-----/
- END_CERT=/-----END CERTIFICATE-----/
+ BEGIN_CERT = /-----BEGIN CERTIFICATE-----/
+ END_CERT = /-----END CERTIFICATE-----/
# The use can be `:signing` or `:encryption`. Use `nil` for both.
attr_reader :use
@@ -59,7 +59,7 @@ module Xml
end
def ==(other)
- self.fingerprint == other.fingerprint
+ fingerprint == other.fingerprint
end
def eql?(other)
@@ -127,10 +127,10 @@ module Xml
end
def strip(value)
- value.
- gsub(BEGIN_CERT, '').
- gsub(END_CERT, '').
- gsub(/[\r\n]|\\r|\\n|\s/, "")
+ value
+ .gsub(BEGIN_CERT, '')
+ .gsub(END_CERT, '')
+ .gsub(/[\r\n]|\\r|\\n|\s/, '')
end
end
end
lib/xml/kit/crypto.rb
@@ -6,7 +6,7 @@ require 'xml/kit/crypto/unknown_cipher'
module Xml
module Kit
module Crypto
- CIPHERS = [ SymmetricCipher, RsaCipher, OaepCipher, UnknownCipher ]
+ CIPHERS = [SymmetricCipher, RsaCipher, OaepCipher, UnknownCipher].freeze
# @!visibility private
def self.cipher_for(algorithm, key)
lib/xml/kit/decryption.rb
@@ -13,7 +13,7 @@ module Xml
#
# @param data [Hash] the XML document converted to a [Hash] using Hash.from_xml.
def decrypt(data)
- ::Xml::Kit.deprecate("decrypt is deprecated. Use decrypt_xml or decrypt_hash instead.")
+ ::Xml::Kit.deprecate('decrypt is deprecated. Use decrypt_xml or decrypt_hash instead.')
decrypt_hash(data)
end
@@ -30,15 +30,15 @@ module Xml
def decrypt_hash(hash)
encrypted_data = hash['EncryptedData']
symmetric_key = symmetric_key_from(encrypted_data)
- cipher_text = Base64.decode64(encrypted_data["CipherData"]["CipherValue"])
- to_plaintext(cipher_text, symmetric_key, encrypted_data["EncryptionMethod"]['Algorithm'])
+ cipher_text = Base64.decode64(encrypted_data['CipherData']['CipherValue'])
+ to_plaintext(cipher_text, symmetric_key, encrypted_data['EncryptionMethod']['Algorithm'])
end
# Decrypts an EncryptedData Nokogiri::XML::Element.
#
# @param node [Nokogiri::XML::Element.] the XML node to decrypt.
def decrypt_node(node)
- return node unless !node.nil? && "EncryptedData" == node.name
+ return node unless !node.nil? && node.name == 'EncryptedData'
node.parent.replace(decrypt_xml(node.to_s))[0]
end
@@ -52,12 +52,12 @@ module Xml
private_keys.each do |private_key|
begin
attempts -= 1
- return to_plaintext(cipher_text, private_key, encrypted_key["EncryptionMethod"]['Algorithm'])
+ return to_plaintext(cipher_text, private_key, encrypted_key['EncryptionMethod']['Algorithm'])
rescue OpenSSL::PKey::RSAError
raise if attempts.zero?
end
end
- raise DecryptionError.new(private_keys)
+ raise DecryptionError, private_keys
end
def to_plaintext(cipher_text, symmetric_key, algorithm)
lib/xml/kit/decryption_error.rb
@@ -5,7 +5,7 @@ module Xml
def initialize(private_keys)
@private_keys = private_keys
- super("Cannot decrypt document with the provided private keys")
+ super('Cannot decrypt document with the provided private keys')
end
end
end
lib/xml/kit/document.rb
@@ -41,7 +41,7 @@ module Xml
def validate_signatures
invalid_signatures.flat_map(&:errors).uniq.each do |error|
- errors.add(error, "is invalid")
+ errors.add(error, 'is invalid')
end
end
@@ -73,7 +73,7 @@ module Xml
end
def x509_certificates
- find_all("//ds:KeyInfo/ds:X509Data/ds:X509Certificate").map do |item|
+ find_all('//ds:KeyInfo/ds:X509Data/ds:X509Certificate').map do |item|
Certificate.to_x509(item.text)
end
end
lib/xml/kit/encryption.rb
@@ -13,10 +13,10 @@ module Xml
asymmetric_algorithm: ::Xml::Kit::Crypto::RsaCipher::ALGORITHM
)
@symmetric_algorithm = symmetric_algorithm
- @symmetric_cipher_value = Base64.encode64(symmetric_cipher.encrypt(raw_xml)).gsub(/\n/, '')
+ @symmetric_cipher_value = Base64.encode64(symmetric_cipher.encrypt(raw_xml)).delete("\n")
@asymmetric_algorithm = asymmetric_algorithm
- @asymmetric_cipher_value = Base64.encode64(public_key.public_encrypt(symmetric_cipher.key)).gsub(/\n/, '')
+ @asymmetric_cipher_value = Base64.encode64(public_key.public_encrypt(symmetric_cipher.key)).delete("\n")
end
def to_xml(xml: ::Builder::XmlMarkup.new)
lib/xml/kit/fingerprint.rb
@@ -25,7 +25,7 @@ module Xml
end
def ==(other)
- self.to_s == other.to_s
+ to_s == other.to_s
end
def eql?(other)
@@ -43,7 +43,7 @@ module Xml
private
def pretty_fingerprint(fingerprint)
- fingerprint.upcase.scan(/../).join(":")
+ fingerprint.upcase.scan(/../).join(':')
end
end
end
lib/xml/kit/namespaces.rb
@@ -1,18 +1,18 @@
module Xml
module Kit
module Namespaces
- CANONICALIZATION = "http://www.w3.org/2001/10/xml-exc-c14n#"
- ENVELOPED_SIG = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
- RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
- RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
- RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"
- RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
- SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1"
- SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
- SHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384"
- SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
- XMLDSIG = "http://www.w3.org/2000/09/xmldsig#"
- XMLENC = "http://www.w3.org/2001/04/xmlenc#"
+ CANONICALIZATION = 'http://www.w3.org/2001/10/xml-exc-c14n#'.freeze
+ ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'.freeze
+ RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'.freeze
+ RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'.freeze
+ RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'.freeze
+ RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'.freeze
+ SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'.freeze
+ SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'.freeze
+ SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384'.freeze
+ SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'.freeze
+ XMLDSIG = 'http://www.w3.org/2000/09/xmldsig#'.freeze
+ XMLENC = 'http://www.w3.org/2001/04/xmlenc#'.freeze
end
end
end
lib/xml/kit/self_signed_certificate.rb
@@ -1,12 +1,12 @@
module Xml
module Kit
class SelfSignedCertificate
- SUBJECT="/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit"
+ SUBJECT = '/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'.freeze
def create(algorithm: 'AES-256-CBC', passphrase: nil, key_pair: OpenSSL::PKey::RSA.new(2048))
certificate = certificate_for(key_pair.public_key)
certificate.sign(key_pair, OpenSSL::Digest::SHA256.new)
- [ certificate.to_pem, export(key_pair, algorithm, passphrase) ]
+ [certificate.to_pem, export(key_pair, algorithm, passphrase)]
end
private
lib/xml/kit/signature.rb
@@ -2,18 +2,18 @@ module Xml
module Kit
class Signature
SIGNATURE_METHODS = {
- SHA1: "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
- SHA224: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224",
- SHA256: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
- SHA384: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",
- SHA512: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512",
+ SHA1: 'http://www.w3.org/2000/09/xmldsig#rsa-sha1',
+ SHA224: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha224',
+ SHA256: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
+ SHA384: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384',
+ SHA512: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512',
}.freeze
DIGEST_METHODS = {
- SHA1: "http://www.w3.org/2000/09/xmldsig#SHA1",
- SHA224: "http://www.w3.org/2001/04/xmldsig-more#sha224",
- SHA256: "http://www.w3.org/2001/04/xmlenc#sha256",
- SHA384: "http://www.w3.org/2001/04/xmldsig-more#sha384",
- SHA512: "http://www.w3.org/2001/04/xmlenc#sha512",
+ SHA1: 'http://www.w3.org/2000/09/xmldsig#SHA1',
+ SHA224: 'http://www.w3.org/2001/04/xmldsig-more#sha224',
+ SHA256: 'http://www.w3.org/2001/04/xmlenc#sha256',
+ SHA384: 'http://www.w3.org/2001/04/xmldsig-more#sha384',
+ SHA512: 'http://www.w3.org/2001/04/xmlenc#sha512',
}.freeze
attr_reader :certificate
lib/xml/kit/signatures.rb
@@ -41,7 +41,7 @@ module Xml
signatures = new(
key_pair: key_pair,
signature_method: signature_method,
- digest_method: digest_method,
+ digest_method: digest_method
)
yield xml, XmlSignatureTemplate.new(xml, signatures)
signatures.complete(xml.target!)
lib/xml/kit/templatable.rb
@@ -62,7 +62,7 @@ module Xml
@signatures ||= ::Xml::Kit::Signatures.new(
key_pair: signing_key_pair,
digest_method: digest_method,
- signature_method: signature_method,
+ signature_method: signature_method
)
end
lib/xml/kit/template.rb
@@ -1,7 +1,7 @@
module Xml
module Kit
class Template
- TEMPLATES_DIR=Pathname.new(File.join(__dir__, "templates/" ))
+ TEMPLATES_DIR = Pathname.new(File.join(__dir__, 'templates/'))
attr_reader :target
@@ -24,7 +24,7 @@ module Xml
end
def template_name
- "#{target.class.name.split("::").last.underscore}.builder"
+ "#{target.class.name.split('::').last.underscore}.builder"
end
def template
lib/xml/kit/version.rb
@@ -1,5 +1,5 @@
module Xml
module Kit
- VERSION = "0.1.11"
+ VERSION = '0.1.11'.freeze
end
end
lib/xml/kit.rb
@@ -1,32 +1,32 @@
-require "active_model"
-require "active_support/core_ext/numeric/time"
-require "active_support/deprecation"
-require "base64"
-require "builder"
-require "logger"
-require "nokogiri"
-require "openssl"
-require "pathname"
-require "tilt"
-require "xmldsig"
+require 'active_model'
+require 'active_support/core_ext/numeric/time'
+require 'active_support/deprecation'
+require 'base64'
+require 'builder'
+require 'logger'
+require 'nokogiri'
+require 'openssl'
+require 'pathname'
+require 'tilt'
+require 'xmldsig'
-require "xml/kit/namespaces"
+require 'xml/kit/namespaces'
-require "xml/kit/certificate"
-require "xml/kit/crypto"
-require "xml/kit/decryption"
-require "xml/kit/decryption_error"
-require "xml/kit/document"
-require "xml/kit/encryption"
-require "xml/kit/fingerprint"
-require "xml/kit/id"
-require "xml/kit/key_pair"
-require "xml/kit/self_signed_certificate"
-require "xml/kit/signature"
-require "xml/kit/signatures"
-require "xml/kit/templatable"
-require "xml/kit/template"
-require "xml/kit/version"
+require 'xml/kit/certificate'
+require 'xml/kit/crypto'
+require 'xml/kit/decryption'
+require 'xml/kit/decryption_error'
+require 'xml/kit/document'
+require 'xml/kit/encryption'
+require 'xml/kit/fingerprint'
+require 'xml/kit/id'
+require 'xml/kit/key_pair'
+require 'xml/kit/self_signed_certificate'
+require 'xml/kit/signature'
+require 'xml/kit/signatures'
+require 'xml/kit/templatable'
+require 'xml/kit/template'
+require 'xml/kit/version'
module Xml
module Kit
@@ -35,9 +35,7 @@ module Xml
@logger ||= Logger.new(STDOUT)
end
- def logger=(logger)
- @logger = logger
- end
+ attr_writer :logger
def deprecate(message)
@deprecation ||= ActiveSupport::Deprecation.new('1.0.0', 'xml-kit')
spec/support/item.rb
@@ -13,7 +13,7 @@ class Item
end
def template_path
- current_path = File.expand_path(File.dirname(__FILE__))
- File.join(current_path, "../fixtures/item.builder")
+ current_path = __dir__
+ File.join(current_path, '../fixtures/item.builder')
end
end
spec/xml/crypto/oaep_cipher_spec.rb
@@ -2,18 +2,20 @@ RSpec.describe ::Xml::Kit::Crypto::OaepCipher do
let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
let(:private_key) { key_pair.private_key }
- describe "#encrypt" do
+ describe '#encrypt' do
+ subject { described_class.new('', private_key) }
+
let(:uuid) { SecureRandom.uuid }
- subject { described_class.new("", private_key) }
it 'encrypts the plain text' do
expect(subject.decrypt(subject.encrypt(uuid))).to eql(uuid)
end
end
- describe "#decrypt" do
+ describe '#decrypt' do
+ subject { described_class.new('', private_key) }
+
let(:uuid) { SecureRandom.uuid }
- subject { described_class.new("", private_key) }
it 'decrypts the cipher text' do
cipher_text = private_key.public_encrypt(uuid, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
spec/xml/crypto/rsa_cipher_spec.rb
@@ -2,18 +2,20 @@ RSpec.describe ::Xml::Kit::Crypto::RsaCipher do
let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
let(:private_key) { key_pair.private_key }
- describe "#encrypt" do
+ describe '#encrypt' do
+ subject { described_class.new('', private_key) }
+
let(:uuid) { SecureRandom.uuid }
- subject { described_class.new("", private_key) }
it 'encrypts the plain text' do
expect(subject.decrypt(subject.encrypt(uuid))).to eql(uuid)
end
end
- describe "#decrypt" do
+ describe '#decrypt' do
+ subject { described_class.new('', private_key) }
+
let(:uuid) { SecureRandom.uuid }
- subject { described_class.new("", private_key) }
it 'decrypts the cipher text' do
cipher_text = private_key.public_encrypt(uuid)
spec/xml/crypto/symmetric_cipher_spec.rb
@@ -1,18 +1,19 @@
RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
[
- "tripledes-cbc",
- "aes128-cbc",
- "aes192-cbc",
- "aes256-cbc",
+ 'tripledes-cbc',
+ 'aes128-cbc',
+ 'aes192-cbc',
+ 'aes256-cbc',
].each do |algorithm|
describe algorithm do
subject { described_class.new("#{::Xml::Kit::Namespaces::XMLENC}#{algorithm}", key) }
+
let(:key) { SecureRandom.hex(key_size[algorithm]) }
let(:key_size) do
hash = Hash.new(16)
hash['aes128-cbc'] = 8
hash['aes192-cbc'] = 12
- hash["tripledes-cbc"] = 12
+ hash['tripledes-cbc'] = 12
hash
end
let(:uuid) { SecureRandom.uuid }
spec/xml/certificate_spec.rb
@@ -1,42 +1,43 @@
RSpec.describe Xml::Kit::Certificate do
subject { described_class.new(certificate, use: :signing) }
+
let(:certificate) { generate_key_pair('password')[0] }
- describe "#fingerprint" do
+ describe '#fingerprint' do
it 'returns a fingerprint' do
expect(subject.fingerprint).to be_instance_of(Xml::Kit::Fingerprint)
end
end
- describe "#for?" do
+ describe '#for?' do
it 'returns true, when it is for signing' do
subject = described_class.new(certificate, use: :signing)
- expect(subject.for?(:signing)).to be_truthy
+ expect(subject).to be_for(:signing)
expect(subject).to be_signing
- expect(subject.for?(:encryption)).to be_falsey
- expect(subject).to_not be_encryption
+ expect(subject).not_to be_for(:encryption)
+ expect(subject).not_to be_encryption
end
it 'returns true, when it is for encryption' do
subject = described_class.new(certificate, use: :encryption)
- expect(subject.for?(:encryption)).to be_truthy
- expect(subject.for?(:signing)).to be_falsey
+ expect(subject).to be_for(:encryption)
+ expect(subject).not_to be_for(:signing)
expect(subject).to be_encryption
- expect(subject).to_not be_signing
+ expect(subject).not_to be_signing
end
it 'returns true when it is for both' do
subject = described_class.new(certificate)
- expect(subject.for?(:encryption)).to be_truthy
- expect(subject.for?(:signing)).to be_truthy
+ expect(subject).to be_for(:encryption)
+ expect(subject).to be_for(:signing)
expect(subject).to be_encryption
expect(subject).to be_signing
end
end
- describe "equality" do
+ describe 'equality' do
it 'is equal by reference equality' do
expect(subject).to eql(subject)
end
@@ -50,23 +51,23 @@ RSpec.describe Xml::Kit::Certificate do
end
end
- describe "#to_h" do
+ describe '#to_h' do
it 'returns a hash' do
- expect(subject.to_h).to eql({
+ expect(subject.to_h).to eql(
use: :signing,
- fingerprint: subject.fingerprint.to_s,
- })
+ fingerprint: subject.fingerprint.to_s
+ )
end
end
- describe "#stripped" do
+ describe '#stripped' do
it 'removes the BEGIN and END lines' do
- expected = certificate.to_s.gsub(/-----BEGIN CERTIFICATE-----/, '').gsub(/-----END CERTIFICATE-----/, '').gsub(/\n/, '')
+ expected = certificate.to_s.gsub(/-----BEGIN CERTIFICATE-----/, '').gsub(/-----END CERTIFICATE-----/, '').delete("\n")
expect(subject.stripped).to eql(expected)
end
end
- describe "#x509" do
+ describe '#x509' do
it 'returns an x509 certificate' do
expected = OpenSSL::X509::Certificate.new(certificate.to_s)
actual = subject.x509
@@ -75,7 +76,7 @@ RSpec.describe Xml::Kit::Certificate do
end
end
- describe "#expired?" do
+ describe '#expired?' do
let(:certificate) { OpenSSL::X509::Certificate.new }
it 'returns false, when the certificate has not expired yet' do
@@ -83,7 +84,7 @@ RSpec.describe Xml::Kit::Certificate do
certificate.not_after = 10.minutes.from_now
subject = described_class.new(certificate, use: :signing)
- expect(subject.expired?(Time.now)).to be_falsey
+ expect(subject).not_to be_expired(Time.now)
end
it 'returns true, when the current time is after the time of expiration' do
@@ -91,42 +92,44 @@ RSpec.describe Xml::Kit::Certificate do
certificate.not_after = 1.minute.ago
subject = described_class.new(certificate, use: :signing)
- expect(subject.expired?(Time.now)).to be_truthy
+ expect(subject).to be_expired(Time.now)
end
end
- describe "#active?" do
- let(:certificate) { OpenSSL::X509::Certificate.new }
+ describe '#active?' do
subject { described_class.new(certificate, use: :signing) }
- context "when the current time is within the active window" do
- before :each do
+ let(:certificate) { OpenSSL::X509::Certificate.new }
+
+ context 'when the current time is within the active window' do
+ before do
certificate.not_before = 1.minute.ago
certificate.not_after = 10.minutes.from_now
end
it 'is active' do
- expect(subject.active?(Time.now)).to be_truthy
+ expect(subject).to be_active(Time.now)
end
end
- context "when the current time is before the active window" do
- before :each do
+ context 'when the current time is before the active window' do
+ before do
certificate.not_before = 1.minute.from_now
certificate.not_after = 10.minutes.from_now
end
it 'is not active' do
- expect(subject.active?(Time.now)).to be_falsey
+ expect(subject).not_to be_active(Time.now)
end
end
end
- describe "#not_after, #not_before" do
+ describe '#not_after, #not_before' do
subject { described_class.new(certificate, use: :signing) }
+
let(:certificate) { OpenSSL::X509::Certificate.new }
- before :each do
+ before do
certificate.not_before = 1.minute.from_now
certificate.not_after = 10.minutes.from_now
end
@@ -140,7 +143,7 @@ RSpec.describe Xml::Kit::Certificate do
end
end
- describe "#to_xml" do
+ describe '#to_xml' do
it 'generates the correct xml' do
result = Hash.from_xml(subject.to_xml)
expect(result['KeyDescriptor']).to be_present
spec/xml/decryption_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe Xml::Kit::Decryption do
- describe "#decrypt_hash" do
+ describe '#decrypt_hash' do
let(:secret) { FFaker::Movie.title }
let(:password) { FFaker::Movie.title }
@@ -16,26 +16,26 @@ RSpec.describe Xml::Kit::Decryption do
encrypted = cipher.update(secret) + cipher.final
data = {
- "EncryptedData"=> {
- "xmlns:xenc"=>"http://www.w3.org/2001/04/xmlenc#",
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "Type"=>"http://www.w3.org/2001/04/xmlenc#Element",
- "EncryptionMethod"=> {
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+ 'EncryptedData' => {
+ 'xmlns:xenc' => 'http://www.w3.org/2001/04/xmlenc#',
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'Type' => 'http://www.w3.org/2001/04/xmlenc#Element',
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#aes128-cbc'
},
- "KeyInfo"=> {
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "EncryptedKey"=> {
- "EncryptionMethod"=>{
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+ 'KeyInfo' => {
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'EncryptedKey' => {
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#rsa-1_5'
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(public_key.public_encrypt(key))
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(public_key.public_encrypt(key))
}
}
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(iv + encrypted)
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(iv + encrypted)
}
}
}
@@ -56,26 +56,26 @@ RSpec.describe Xml::Kit::Decryption do
encrypted = cipher.update(secret) + cipher.final
data = {
- "EncryptedData"=> {
- "xmlns:xenc"=>"http://www.w3.org/2001/04/xmlenc#",
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "Type"=>"http://www.w3.org/2001/04/xmlenc#Element",
- "EncryptionMethod"=> {
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+ 'EncryptedData' => {
+ 'xmlns:xenc' => 'http://www.w3.org/2001/04/xmlenc#',
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'Type' => 'http://www.w3.org/2001/04/xmlenc#Element',
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#aes128-cbc'
},
- "KeyInfo"=> {
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "EncryptedKey"=> {
- "EncryptionMethod"=>{
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+ 'KeyInfo' => {
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'EncryptedKey' => {
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#rsa-1_5'
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(public_key.public_encrypt(key))
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(public_key.public_encrypt(key))
}
}
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(iv + encrypted)
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(iv + encrypted)
}
}
}
@@ -89,7 +89,7 @@ RSpec.describe Xml::Kit::Decryption do
end
it 'raise an error when it cannot decrypt the data' do
- certificate_pem, _ = generate_key_pair(password)
+ certificate_pem, = generate_key_pair(password)
public_key = OpenSSL::X509::Certificate.new(certificate_pem).public_key
cipher = OpenSSL::Cipher.new('AES-128-CBC')
@@ -99,26 +99,26 @@ RSpec.describe Xml::Kit::Decryption do
encrypted = cipher.update(secret) + cipher.final
data = {
- "EncryptedData"=> {
- "xmlns:xenc"=>"http://www.w3.org/2001/04/xmlenc#",
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "Type"=>"http://www.w3.org/2001/04/xmlenc#Element",
- "EncryptionMethod"=> {
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+ 'EncryptedData' => {
+ 'xmlns:xenc' => 'http://www.w3.org/2001/04/xmlenc#',
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'Type' => 'http://www.w3.org/2001/04/xmlenc#Element',
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#aes128-cbc'
},
- "KeyInfo"=> {
- "xmlns:dsig"=>"http://www.w3.org/2000/09/xmldsig#",
- "EncryptedKey"=> {
- "EncryptionMethod"=>{
- "Algorithm"=>"http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+ 'KeyInfo' => {
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
+ 'EncryptedKey' => {
+ 'EncryptionMethod' => {
+ 'Algorithm' => 'http://www.w3.org/2001/04/xmlenc#rsa-1_5'
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(public_key.public_encrypt(key))
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(public_key.public_encrypt(key))
}
}
},
- "CipherData"=>{
- "CipherValue"=> Base64.encode64(iv + encrypted)
+ 'CipherData' => {
+ 'CipherValue' => Base64.encode64(iv + encrypted)
}
}
}
@@ -132,19 +132,19 @@ RSpec.describe Xml::Kit::Decryption do
end
end
- describe "#decrypt_document" do
+ describe '#decrypt_document' do
let(:item) { Item.new }
let(:document) { Nokogiri::XML(item.to_xml) }
let(:subject) { described_class.new(private_keys: [item.encryption_key_pair.private_key]) }
- let(:encrypted_node) { document.at_xpath('/Item/Encrypted/xmlenc:EncryptedData', 'xmlenc' => "http://www.w3.org/2001/04/xmlenc#") }
+ let(:encrypted_node) { document.at_xpath('/Item/Encrypted/xmlenc:EncryptedData', 'xmlenc' => 'http://www.w3.org/2001/04/xmlenc#') }
it 'decrypts a nokogiri document' do
- expect(subject.decrypt_node(encrypted_node).name).to eql("EncryptMe")
+ expect(subject.decrypt_node(encrypted_node).name).to eql('EncryptMe')
end
it 'returns the node when it does not contain an EncryptedData' do
- document = Nokogiri::XML("<hello><world></world></hello>")
- node = document.at_xpath("//hello/world")
+ document = Nokogiri::XML('<hello><world></world></hello>')
+ node = document.at_xpath('//hello/world')
expect(subject.decrypt_node(node)).to eql(node)
end
spec/xml/document_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe Xml::Kit::Document do
- describe "#valid_signature?" do
+ describe '#valid_signature?' do
let(:login_url) { "https://#{FFaker::Internet.domain_name}/login" }
let(:logout_url) { "https://#{FFaker::Internet.domain_name}/logout" }
let(:signed_xml) { Item.new.to_xml }
@@ -9,16 +9,16 @@ RSpec.describe Xml::Kit::Document do
end
it 'returns false, when the SHA1 digest is not valid' do
- subject = described_class.new(signed_xml.gsub("Item", "uhoh"))
- expect(subject).to_not be_valid
+ subject = described_class.new(signed_xml.gsub('Item', 'uhoh'))
+ expect(subject).not_to be_valid
expect(subject.errors[:digest_value]).to be_present
end
- it 'it is invalid when digest is incorrect' do
+ it 'is invalid when digest is incorrect' do
old_digest = Hash.from_xml(signed_xml)['Item']['Signature']['SignedInfo']['Reference']['DigestValue']
subject = described_class.new(signed_xml.gsub(old_digest, 'sabotage'))
- expect(subject).to_not be_valid
+ expect(subject).not_to be_valid
expect(subject.errors[:digest_value]).to be_present
end
@@ -26,11 +26,11 @@ RSpec.describe Xml::Kit::Document do
old_signature = Hash.from_xml(signed_xml)['Item']['Signature']['SignatureValue']
signed_xml.gsub!(old_signature, 'sabotage')
subject = described_class.new(signed_xml)
- expect(subject).to_not be_valid
+ expect(subject).not_to be_valid
expect(subject.errors[:signature]).to be_present
end
- context "when the certificate is expired" do
+ context 'when the certificate is expired' do
let(:expired_certificate) do
certificate = OpenSSL::X509::Certificate.new
certificate.public_key = private_key.public_key
@@ -42,7 +42,7 @@ RSpec.describe Xml::Kit::Document do
let(:digest_algorithm) { OpenSSL::Digest::SHA256.new }
let(:item) { Item.new }
- before :each do
+ before do
expired_certificate.sign(private_key, digest_algorithm)
end
spec/xml/encryption_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe Xml::Kit::Encryption do
- describe "#to_xml" do
+ describe '#to_xml' do
[
"#{::Xml::Kit::Namespaces::XMLENC}tripledes-cbc",
"#{::Xml::Kit::Namespaces::XMLENC}aes128-cbc",
@@ -7,9 +7,10 @@ RSpec.describe Xml::Kit::Encryption do
"#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc",
].each do |symmetric_algorithm|
describe symmetric_algorithm do
- subject do
+ subject do
described_class.new(xml, public_key, symmetric_algorithm: symmetric_algorithm)
end
+
let(:key_pair) { Xml::Kit::KeyPair.generate(use: :encryption, algorithm: symmetric_algorithm) }
let(:decryptor) { Xml::Kit::Decryption.new(private_keys: [key_pair.private_key]) }
let(:public_key) { key_pair.public_key }
@@ -21,7 +22,7 @@ RSpec.describe Xml::Kit::Encryption do
xml.target!
end
- it "generates an encrypted xml" do
+ it 'generates an encrypted xml' do
expect(decryptor.decrypt_xml(subject.to_xml)).to eql(xml)
end
end
spec/xml/fingerprint_spec.rb
@@ -1,27 +1,27 @@
RSpec.describe Xml::Kit::Fingerprint do
- describe "#sha" do
+ describe '#sha' do
it 'returns the SHA256' do
- certificate, _ = generate_key_pair("password")
+ certificate, = generate_key_pair('password')
x509 = OpenSSL::X509::Certificate.new(certificate)
- sha256 = OpenSSL::Digest::SHA256.new.hexdigest(x509.to_der).upcase.scan(/../).join(":")
+ sha256 = OpenSSL::Digest::SHA256.new.hexdigest(x509.to_der).upcase.scan(/../).join(':')
expect(described_class.new(certificate).algorithm(OpenSSL::Digest::SHA256)).to eql(sha256)
end
it 'returns the SHA1' do
- certificate, _ = generate_key_pair("password")
+ certificate, = generate_key_pair('password')
x509 = OpenSSL::X509::Certificate.new(certificate)
- sha1 = OpenSSL::Digest::SHA1.new.hexdigest(x509.to_der).upcase.scan(/../).join(":")
+ sha1 = OpenSSL::Digest::SHA1.new.hexdigest(x509.to_der).upcase.scan(/../).join(':')
expect(described_class.new(certificate).algorithm(OpenSSL::Digest::SHA1)).to eql(sha1)
end
end
it 'produces correct hash keys' do
- certificate, _ = generate_key_pair("password")
- items = { }
- items[described_class.new(certificate)] = "HI"
- items[described_class.new(certificate)] = "BYE"
- expect(items.keys.count).to eql(1)
+ certificate, = generate_key_pair('password')
+ items = {}
+ items[described_class.new(certificate)] = 'HI'
+ items[described_class.new(certificate)] = 'BYE'
+ expect(items.keys.count).to be(1)
end
end
spec/xml/kit_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe Xml::Kit do
- it "has a version number" do
+ it 'has a version number' do
expect(Xml::Kit::VERSION).not_to be nil
end
end
spec/xml/signatures_spec.rb
@@ -3,30 +3,30 @@ RSpec.describe ::Xml::Kit::Signatures do
it 'generates a signature' do
options = {
- "xmlns:samlp" => "urn:oasis:names:tc:SAML:2.0:protocol",
- "xmlns:saml" => "urn:oasis:names:tc:SAML:2.0:assertion",
+ 'xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol',
+ 'xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion',
ID: reference_id,
}
key_pair = ::Xml::Kit::KeyPair.generate(use: :signing)
signed_xml = described_class.sign(key_pair: key_pair) do |xml, signature|
xml.tag!('samlp:AuthnRequest', options) do
signature.template(reference_id)
- xml.tag!('saml:Issuer', "MyEntityID")
+ xml.tag!('saml:Issuer', 'MyEntityID')
end
end
result = Hash.from_xml(signed_xml)
- signature = result["AuthnRequest"]["Signature"]
- expect(signature['xmlns']).to eql("http://www.w3.org/2000/09/xmldsig#")
+ signature = result['AuthnRequest']['Signature']
+ expect(signature['xmlns']).to eql('http://www.w3.org/2000/09/xmldsig#')
expect(signature['SignedInfo']['CanonicalizationMethod']['Algorithm']).to eql('http://www.w3.org/2001/10/xml-exc-c14n#')
- expect(signature['SignedInfo']['SignatureMethod']['Algorithm']).to eql("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
+ expect(signature['SignedInfo']['SignatureMethod']['Algorithm']).to eql('http://www.w3.org/2001/04/xmldsig-more#rsa-sha256')
expect(signature['SignedInfo']['Reference']['URI']).to eql("##{reference_id}")
expect(signature['SignedInfo']['Reference']['Transforms']['Transform']).to match_array([
- { "Algorithm" => "http://www.w3.org/2000/09/xmldsig#enveloped-signature" },
- { "Algorithm" => "http://www.w3.org/2001/10/xml-exc-c14n#" }
+ { 'Algorithm' => 'http://www.w3.org/2000/09/xmldsig#enveloped-signature' },
+ { 'Algorithm' => 'http://www.w3.org/2001/10/xml-exc-c14n#' }
])
- expect(signature['SignedInfo']['Reference']['DigestMethod']['Algorithm']).to eql("http://www.w3.org/2001/04/xmlenc#sha256")
+ expect(signature['SignedInfo']['Reference']['DigestMethod']['Algorithm']).to eql('http://www.w3.org/2001/04/xmlenc#sha256')
expected_certificate = key_pair.certificate.stripped
expect(signature['KeyInfo']['X509Data']['X509Certificate']).to eql(expected_certificate)
expect(signature['SignedInfo']['Reference']['DigestValue']).to be_present
@@ -38,11 +38,11 @@ RSpec.describe ::Xml::Kit::Signatures do
signed_xml = described_class.sign(key_pair: nil) do |xml, signature|
xml.AuthnRequest do
signature.template(reference_id)
- xml.Issuer "MyEntityID"
+ xml.Issuer 'MyEntityID'
end
end
result = Hash.from_xml(signed_xml)
expect(result['AuthnRequest']).to be_present
- expect(result["AuthnRequest"]["Signature"]).to be_nil
+ expect(result['AuthnRequest']['Signature']).to be_nil
end
end
spec/xml/templatable_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe ::Xml::Kit::Templatable do
end
subject { Item.new }
- describe "#encryption_for" do
+ describe '#encryption_for' do
it 'returns an encrypted xml' do
subject.encrypt = true
subject.encryption_certificate = ::Xml::Kit::KeyPair.generate(use: :encryption).certificate
@@ -13,7 +13,7 @@ RSpec.describe ::Xml::Kit::Templatable do
xml.HelloWorld Time.now.iso8601
end
- expect(result).to include("EncryptedData")
+ expect(result).to include('EncryptedData')
xml_hash = Hash.from_xml(result)
expect(xml_hash['EncryptedData']).to be_present
expect(xml_hash['EncryptedData']['EncryptionMethod']).to be_present
@@ -27,8 +27,8 @@ RSpec.describe ::Xml::Kit::Templatable do
xml.HelloWorld Time.now.iso8601
end
- expect(result).to include("HelloWorld")
- expect(result).to_not include("EncryptedData")
+ expect(result).to include('HelloWorld')
+ expect(result).not_to include('EncryptedData')
xml_hash = Hash.from_xml(result)
expect(xml_hash['HelloWorld']).to be_present
end
@@ -41,8 +41,8 @@ RSpec.describe ::Xml::Kit::Templatable do
xml.HelloWorld Time.now.iso8601
end
- expect(result).to include("HelloWorld")
- expect(result).to_not include("EncryptedData")
+ expect(result).to include('HelloWorld')
+ expect(result).not_to include('EncryptedData')
xml_hash = Hash.from_xml(result)
expect(xml_hash['HelloWorld']).to be_present
end
spec/spec_helper.rb
@@ -2,17 +2,17 @@ require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
-require "bundler/setup"
-require "xml/kit"
-require "ffaker"
-require "active_support/core_ext/hash/conversions"
+require 'bundler/setup'
+require 'xml/kit'
+require 'ffaker'
+require 'active_support/core_ext/hash/conversions'
Xml::Kit.logger.level = Logger::FATAL
Dir[File.join(Dir.pwd, 'spec/support/**/*.rb')].each { |f| require f }
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
- config.example_status_persistence_file_path = ".rspec_status"
+ config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Gemfile
@@ -1,6 +1,6 @@
-source "https://rubygems.org"
+source 'https://rubygems.org'
-git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
+git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in xml-kit.gemspec
gemspec
Rakefile
@@ -1,7 +1,7 @@
-require "bundler/audit/task"
-require "bundler/gem_tasks"
-require "rspec/core/rake_task"
-require "rubocop/rake_task"
+require 'bundler/audit/task'
+require 'bundler/gem_tasks'
+require 'rspec/core/rake_task'
+require 'rubocop/rake_task'
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)
xml-kit.gemspec
@@ -1,39 +1,39 @@
-# coding: utf-8
-lib = File.expand_path("../lib", __FILE__)
+
+lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require "xml/kit/version"
+require 'xml/kit/version'
Gem::Specification.new do |spec|
- spec.name = "xml-kit"
+ spec.name = 'xml-kit'
spec.version = Xml::Kit::VERSION
- spec.authors = ["mo khan"]
- spec.email = ["mo@mokhan.ca"]
+ spec.authors = ['mo khan']
+ spec.email = ['mo@mokhan.ca']
- spec.summary = %q{A simple toolkit for working with XML.}
- spec.description = %q{A simple toolkit for working with XML.}
- spec.homepage = "https://github.com/saml-kit/xml-kit"
- spec.license = "MIT"
+ spec.summary = 'A simple toolkit for working with XML.'
+ spec.description = 'A simple toolkit for working with XML.'
+ spec.homepage = 'https://github.com/saml-kit/xml-kit'
+ spec.license = 'MIT'
spec.required_ruby_version = '>= 2.2.0'
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
- spec.metadata["yard.run"] = "yri"
- spec.bindir = "exe"
+ spec.metadata['yard.run'] = 'yri'
+ spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
- spec.require_paths = ["lib"]
+ spec.require_paths = ['lib']
- spec.add_dependency "activemodel", ">= 4.2.0"
- spec.add_dependency "builder", "~> 3.2"
- spec.add_dependency "nokogiri", ">= 1.8.1"
- spec.add_dependency "tilt", ">= 1.4.1"
- spec.add_dependency "xmldsig", "~> 0.6"
- spec.add_development_dependency "bundler", "~> 1.16"
- spec.add_development_dependency "bundler-audit", "~> 0.6"
- spec.add_development_dependency "ffaker", "~> 2.7"
- spec.add_development_dependency "rake", "~> 10.0"
- spec.add_development_dependency "rspec", "~> 3.0"
- spec.add_development_dependency "rubocop", "~> 0.52"
- spec.add_development_dependency "rubocop-rspec", "~> 1.22"
- spec.add_development_dependency "simplecov", "~> 0.15.1"
+ spec.add_dependency 'activemodel', '>= 4.2.0'
+ spec.add_dependency 'builder', '~> 3.2'
+ spec.add_dependency 'nokogiri', '>= 1.8.1'
+ spec.add_dependency 'tilt', '>= 1.4.1'
+ spec.add_dependency 'xmldsig', '~> 0.6'
+ spec.add_development_dependency 'bundler', '~> 1.16'
+ spec.add_development_dependency 'bundler-audit', '~> 0.6'
+ spec.add_development_dependency 'ffaker', '~> 2.7'
+ spec.add_development_dependency 'rake', '~> 10.0'
+ spec.add_development_dependency 'rspec', '~> 3.0'
+ spec.add_development_dependency 'rubocop', '~> 0.52'
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
+ spec.add_development_dependency 'simplecov', '~> 0.15.1'
end