test/dsig_test.rb in ezcrypto-0.7 vs test/dsig_test.rb in ezcrypto-0.7.2

- old
+ new

@@ -86,10 +86,11 @@ assert cert.serial assert cert.not_after assert cert.not_before assert cert.valid? + assert_equal cert.subject[:emailAddress],"pelleb@gmail.com" assert_equal cert.subject[:C],"DK" assert_equal cert.subject[:ST],"Denmark" assert_equal cert.subject[:L],"Copenhagen" assert_equal cert.subject[:OU],"testing" @@ -192,34 +193,36 @@ cert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/testsigner.cert" assert !trust.verify(cert) trust.add cert assert trust.verify(cert) - valicert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/valicert_class2_root.crt" - assert !trust.verify(valicert) - starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_issuing.crt" + sf_root=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf-class2-root.crt" + assert !trust.verify(sf_root) + starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_intermediate.crt" assert !trust.verify(starfield) - wideword=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/wideword.net.cert" - assert !trust.verify(wideword) + agree2=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/agree2.com.cert" + assert !trust.verify(agree2) - trust.add valicert - assert trust.verify(valicert) + trust.add sf_root + assert trust.verify(sf_root) assert trust.verify(starfield) - assert !trust.verify(wideword) + assert !trust.verify(agree2) trust.add starfield - assert trust.verify(wideword) + assert trust.verify(agree2) end def test_disk_store trust=EzCrypto::TrustStore.new File.dirname(__FILE__) + "/store" - valicert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/valicert_class2_root.crt" - assert trust.verify(valicert) - starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_issuing.crt" + sf_root=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf-class2-root.crt" + trust.add(sf_root) + assert trust.verify(sf_root) + starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_intermediate.crt" assert trust.verify(starfield) - wideword=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/wideword.net.cert" - assert trust.verify(wideword) + trust.add(starfield) + agree2=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/agree2.com.cert" + assert trust.verify(agree2) cert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/testsigner.cert" assert !trust.verify(cert) trust.add cert assert trust.verify(cert) @@ -234,43 +237,44 @@ end end def test_load_trusted_truststore trust=EzCrypto::TrustStore.default_trusted - valicert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/valicert_class2_root.crt" - assert trust.verify(valicert) - starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_issuing.crt" + sf_root=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf-class2-root.crt" + assert trust.verify(sf_root) + starfield=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/sf_intermediate.crt" assert trust.verify(starfield) - wideword=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/wideword.net.cert" - assert trust.verify(wideword) + agree2=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/agree2.com.cert" + assert trust.verify(agree2) cert=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/testsigner.cert" assert !trust.verify(cert) trust.add cert assert trust.verify(cert) end - - def test_public_key_load_from_pkyp - verifier=EzCrypto::Verifier.from_pkyp "e93e18114cbefaaa89fda908b09df63d3662879a" - wideword=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/wideword.net.cert" - assert_equal wideword.cert.to_s,verifier.cert.to_s - assert verifier - end - def test_register_public_key_at_pkyp - pub=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/wideword.net.cert" - assert_equal pub.digest,pub.register_with_pkyp - end - - def test_create_register_and_fetch_public_key - signer=EzCrypto::Signer.generate - assert_equal signer.verifier.digest,signer.verifier.register_with_pkyp - verifier=EzCrypto::Verifier.from_pkyp signer.verifier.digest - sig=signer.sign "hello" - assert sig - assert verifier.verify( sig,"hello") - end - +# Disabling these until pkyp is back up +# def test_public_key_load_from_pkyp +# verifier=EzCrypto::Verifier.from_pkyp "e93e18114cbefaaa89fda908b09df63d3662879a" +# agree2=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/agree2.com.cert" +# assert_equal agree2.cert.to_s,verifier.cert.to_s +# assert verifier +# end +# +# def test_register_public_key_at_pkyp +# pub=EzCrypto::Verifier.from_file File.dirname(__FILE__) + "/agree2.com.cert" +# assert_equal pub.digest,pub.register_with_pkyp +# end +# +# def test_create_register_and_fetch_public_key +# signer=EzCrypto::Signer.generate +# assert_equal signer.verifier.digest,signer.verifier.register_with_pkyp +# verifier=EzCrypto::Verifier.from_pkyp signer.verifier.digest +# sig=signer.sign "hello" +# assert sig +# assert verifier.verify( sig,"hello") +# end +# def assert_signer(signer) assert signer assert signer.public_key \ No newline at end of file