Sha256: 11ce5b7f4911283d0dc5f018667ca0fdfefd1decb1f44253fa71254fdd4bc0a2
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
require 'spec_helper' include R509::Cert::Extensions shared_examples_for "a correct R509 SubjectKeyIdentifier object" do before :all do extension_name = "subjectKeyIdentifier" klass = SubjectKeyIdentifier openssl_ext = OpenSSL::X509::Extension.new( extension_name, @extension_value ) @r509_ext = klass.new( openssl_ext ) end it "key should be correct" do @r509_ext.key.should == @key end end describe R509::Cert::Extensions::SubjectKeyIdentifier do include R509::Cert::Extensions context "SubjectKeyIdentifier" do before :all do @extension_value = "00:11:22:33:44:55:66:77:88:99:00:AA:BB:CC:DD:EE:FF:00:11:22" @key = @extension_value end context "creation" do before :all do @pk = R509::PrivateKey.new(:bit_strength => 768) end it "errors when not supplying a public key" do expect { R509::Cert::Extensions::SubjectKeyIdentifier.new({}) }.to raise_error(ArgumentError,"You must supply a hash with a :public_key") end it "errors when supplying a non-hash" do expect { R509::Cert::Extensions::SubjectKeyIdentifier.new("junk!!!") }.to raise_error(ArgumentError,"You must supply a hash with a :public_key") end it "creates successfully" do ski = R509::Cert::Extensions::SubjectKeyIdentifier.new(:public_key => @pk.public_key) ski.key.should_not be_nil end it "creates with default criticality" do ski = R509::Cert::Extensions::SubjectKeyIdentifier.new(:public_key => @pk.public_key) ski.critical?.should be_false end it "creates with non-default criticality" do ski = R509::Cert::Extensions::SubjectKeyIdentifier.new(:public_key => @pk.public_key, :critical => true) ski.critical?.should be_true end end it_should_behave_like "a correct R509 SubjectKeyIdentifier object" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
r509-0.10.0 | spec/cert/extensions/subject_key_identifier_spec.rb |