Commit 9c3b046

mo <mo.khan@gmail.com>
2018-01-08 16:03:39
fix usages of self signed certificate. tag: v0.3.3
1 parent 866a60e
exe/saml-kit-create-self-signed-certificate
@@ -3,7 +3,7 @@ require 'saml/kit'
 
 puts "Enter Passphrase:"
 passphrase = STDIN.read.strip
-certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new(passphrase).create
+certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: passphrase)
 
 puts "** BEGIN File Format **"
 print certificate
lib/saml/kit/configuration.rb
@@ -61,7 +61,7 @@ module Saml
       # @param use [Symbol] the type of key pair, `:signing` or `:encryption`
       # @param passphrase [String] the private key passphrase to use.
       def generate_key_pair_for(use:, passphrase: SecureRandom.uuid)
-        certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new(passphrase).create
+        certificate, private_key = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: passphrase)
         add_key_pair(certificate, private_key, passphrase: passphrase, use: use)
       end
 
spec/saml/response_spec.rb
@@ -318,7 +318,7 @@ RSpec.describe Saml::Kit::Response do
     let(:url) { FFaker::Internet.uri("https") }
     let(:certificate) do
       ::Xml::Kit::Certificate.new(
-        ::Xml::Kit::SelfSignedCertificate.new("password").create[0],
+        ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: "password")[0],
         use: :signing
       )
     end
@@ -439,7 +439,7 @@ XML
     end
 
     it 'parses the encrypted assertion' do
-      certificate_pem, private_key_pem = ::Xml::Kit::SelfSignedCertificate.new(password).create
+      certificate_pem, private_key_pem = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: password)
       public_key = OpenSSL::X509::Certificate.new(certificate_pem).public_key
       private_key = OpenSSL::PKey::RSA.new(private_key_pem, password)
 
spec/saml/service_provider_metadata_spec.rb
@@ -130,7 +130,7 @@ RSpec.describe Saml::Kit::ServiceProviderMetadata do
     end
 
     it 'returns false when the fingerprint does not match one of the signing certificates' do
-      certificate, _ = ::Xml::Kit::SelfSignedCertificate.new('password').create
+      certificate, _ = ::Xml::Kit::SelfSignedCertificate.new.create(passphrase: 'password')
       fingerprint = ::Xml::Kit::Fingerprint.new(certificate)
       expect(subject.matches?(fingerprint)).to be_falsey
     end
saml-kit.gemspec
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
 
   spec.add_dependency "activemodel", ">= 4.2.0"
   spec.add_dependency "nokogiri", "~> 1.8"
-  spec.add_dependency "xml-kit", ">= 0.1.1"
+  spec.add_dependency "xml-kit", "~> 0.1"
   spec.add_development_dependency "bundler", "~> 1.15"
   spec.add_development_dependency "ffaker", "~> 2.7"
   spec.add_development_dependency "rake", "~> 10.0"