diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/ossl_rsa.rb | 6 | ||||
-rwxr-xr-x | test/ossl_x509.rb | 20 | ||||
-rwxr-xr-x | test/ossl_x509crl.rb | 2 | ||||
-rwxr-xr-x | test/ossl_x509req.rb | 2 | ||||
-rwxr-xr-x | test/ossl_x509store.rb | 8 | ||||
-rwxr-xr-x | test/pkcs7.rb | 2 | ||||
-rw-r--r-- | test/spki.rb | 2 |
7 files changed, 21 insertions, 21 deletions
diff --git a/test/ossl_rsa.rb b/test/ossl_rsa.rb index 1ab9cd1..266cece 100755 --- a/test/ossl_rsa.rb +++ b/test/ossl_rsa.rb @@ -11,9 +11,9 @@ p pub = RSA.new(File.open("./01pub.pem").read) p pub.private? puts exp = priv.export(DES.new(EDE3, CBC), "password") p priv2 = RSA.new(exp, "password") -p priv.to_str == priv2.to_str +p priv.to_text == priv2.to_text #puts priv.to_pem -#puts pub.to_str -#puts priv.to_str +#puts pub.to_text +#puts priv.to_text #puts pub.export diff --git a/test/ossl_x509.rb b/test/ossl_x509.rb index 1c65217..2feb780 100755 --- a/test/ossl_x509.rb +++ b/test/ossl_x509.rb @@ -11,7 +11,7 @@ p x509 = Certificate.new(File.open("./01cert.pem").read) #puts "Version = #{x509.version}" #p Name.new #p subject = x509.subject -#p subject.to_str +#p subject.to_s #p issuer = x509.issuer #p issuer.to_pem #p ary = issuer.to_a @@ -23,15 +23,15 @@ p x509 = Certificate.new(File.open("./01cert.pem").read) #p x509.not_after #p k = x509.public_key #p k.private? -#puts k.to_str +#puts k.to_text #p priv = RSA.new(File.open("./01key.pem").read, "pejs8nek") #p priv.private? #p x509.public_key = priv -#puts x509.public_key.to_str -#p x509.issuer.to_str +#puts x509.public_key.to_text +#p x509.issuer.to_s #p x509.sign(priv,MD5.new) -#p x509.issuer.to_str -#puts x509.to_str +#p x509.issuer.to_s +#puts x509.to_text #x509.extensions.each_with_index {|e, i| p e.to_a} #puts "----end----" @@ -41,7 +41,7 @@ name = [['C', 'CZ'],['O','Rokos'],['CN','pokusXXX']] #p n = Name.new(name) #p n.to_h #p n.to_a -#p n.to_str +#p n.to_s #exit p new.subject = Name.new(name) p new.issuer = Name.new(name) @@ -55,7 +55,7 @@ maker = ExtensionFactory.new(nil, new) #only subject p ext1 = maker.create_extension(["basicConstraints","CA:FALSE,pathlen:5"]) #p ext1.to_a #p ext1.to_h -#p ext1.to_str +#p ext1.to_s #exit p ext2 = maker.create_extension(["nsComment","OK, man!!!"]) ###p digest = Digest::SHA1.new(new.public_key.to_der) @@ -64,11 +64,11 @@ p ext3 = maker.create_extension(["subjectKeyIdentifier", "hash"]) new.extensions = [ext1, ext2, ext3] maker.issuer_certificate = new # we needed subjectKeyInfo inside, now we have it p ext4 = maker.create_extension(["authorityKeyIdentifier", "keyid:always,issuer:always"]) -#puts ext1.to_str +#puts ext1.to_s p new.add_extension(ext4) p new.sign(key, Digest::MD5.new) puts "===PEM===" -puts new.to_str +puts new.to_pem puts "===DER===" p new.to_der diff --git a/test/ossl_x509crl.rb b/test/ossl_x509crl.rb index e885447..01e8091 100755 --- a/test/ossl_x509crl.rb +++ b/test/ossl_x509crl.rb @@ -8,7 +8,7 @@ include PKey p ca = Certificate.new(File.open("./cacert.pem").read) p key = ca.public_key p crl = CRL.new(File.open("./01crl.pem").read) -p crl.issuer.to_str +p crl.issuer.to_s p crl.verify key p crl.verify RSA.new(1024) crl.revoked.each {|rev| p rev.time} diff --git a/test/ossl_x509req.rb b/test/ossl_x509req.rb index 95550d8..21701c5 100755 --- a/test/ossl_x509req.rb +++ b/test/ossl_x509req.rb @@ -9,7 +9,7 @@ p req = Request.new p req = Request.new(File.open("./01req.pem").read) p pkey = RSA.new(File.open("./02key.pem").read, "alfa") p k2 = Certificate.new(File.open("./02cert.pem").read).public_key -#puts req.to_str +#puts req.to_pem #p req.methods.sort p key = req.public_key p req.verify key diff --git a/test/ossl_x509store.rb b/test/ossl_x509store.rb index f76dd69..d70e85d 100755 --- a/test/ossl_x509store.rb +++ b/test/ossl_x509store.rb @@ -7,7 +7,7 @@ include X509 verify_cb = Proc.new {|ok, x509_store| puts "\t\t====begin Verify====" puts "\t\tOK = #{ok}" - puts "\t\tchecking #{x509_store.cert.subject.to_str}" + puts "\t\tchecking #{x509_store.cert.subject.to_s}" puts "\t\tstatus = #{x509_store.verify_status} - that is \"#{x509_store.verify_message}\"" puts "\t\t==== end Verify====" #raise "SOME ERROR!" # Cert will be rejected @@ -17,11 +17,11 @@ verify_cb = Proc.new {|ok, x509_store| } p ca = Certificate.new(File.open("./cacert.pem").read) -puts "CA = #{ca.subject.to_str}, serial = #{ca.serial}" +puts "CA = #{ca.subject.to_s}, serial = #{ca.serial}" cakey = ca.public_key p cert = Certificate.new(File.open("./01cert.pem").read) -puts "Cert = #{cert.subject.to_str}, serial = #{cert.serial}" +puts "Cert = #{cert.subject.to_s}, serial = #{cert.serial}" key = cert.public_key p crl = CRL.new(File.open("./01crl.pem").read) @@ -71,6 +71,6 @@ end puts "Trusted certs:" store.chain.each_with_index {|cert, i| - puts "> #{i} --- #{cert.subject.to_str}" + puts "> #{i} --- #{cert.subject.to_s}" } diff --git a/test/pkcs7.rb b/test/pkcs7.rb index b4f4b3b..8bd479b 100755 --- a/test/pkcs7.rb +++ b/test/pkcs7.rb @@ -32,7 +32,7 @@ p store.verify_callback = ver_cb p p7 = PKCS7.new(str) p p7.verify_data(store, data) {|signer| puts "GOT IT!" - p signer.name.to_str + p signer.name.to_s p signer.serial p signer.signed_time } diff --git a/test/spki.rb b/test/spki.rb index 0e5b7f1..f97a163 100644 --- a/test/spki.rb +++ b/test/spki.rb @@ -3,5 +3,5 @@ include OpenSSL puts txt = "MIICUDCCATgwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDUIhGCK7sr\r\nO+jHy7S1ZllFCEPzhlneTnjUnjZWuZEVu7c14NUhJzpNXg//6sCoiy5cQPaIYFIs\r\nded/PosTNfJVPX6El+bWk/2Elf5iVYcScRpf+RkUBR6T3WAMFPCajx3JFonhqhny\r\n5bSXU41h7/oLpnQkeeo76ujKoxjV6vl+y36jCeUAI+dzrWLznUswWVnWvdNt/z1h\r\npWILYtCKexLsz+aOqA6NdGTVDb8r+iDorU2KGL4BJjMXGr/LutYQjeVVXZTuaeN+\r\nxa75TVMcSEzvVQm8Dk1u3C3r3hm9I9zKnpta5NqiToR/fA85Qw5YhjEZMWT/Rj+7\r\nB5LBp5NcX35vAgMBAAEWEGNoYWxsZW5nZSBzdHJpbmcwDQYJKoZIhvcNAQEEBQAD\r\nggEBABdXwDZ9yDyyC5xw8rN/+/xAZSYa8xn4gsUEg4P/mM22WZaqh/NXroXUcU5F\r\nQBeGTYlT//wVlobLeES64Mk/FaCIXrZrLRAxb5QUYIupH2MifRU5XWriYcc6pp7S\r\nD1N+U6MOUFPMziqLf2AYqXBxuky1KhFeXuL6t9j1IadEY9UgTbUQ9Joyt50PoacM\r\ncc2i22GGdpowx7mrB0hnkmYmZ5CgQkrxNM2m4TCuuQwVIyaGgED5Xpa29QWaPhkM\r\njqjHBL4FOmPgYtaIFiFihQziYj5WYOtSEcIcEs/mHPx0lrY9V0fzp2yMGz+AQ3XF\r\nylBqpB33EBqXn/NGzHgWfdU1vEM=" txt.gsub!(/(\r|\n)/,"") -puts Netscape::SPKI.new(txt).to_str +puts Netscape::SPKI.new(txt).to_s |