summaryrefslogtreecommitdiff
path: root/test/openssl/test_pkey_rsa.rb
diff options
context:
space:
mode:
authoremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-14 03:14:33 +0000
committeremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-14 03:14:33 +0000
commit4ccb387f3bc436a08fc6d72c4931994f5de95110 (patch)
tree7074bbbd75a559109b2fe685fb02dfeff8a17c24 /test/openssl/test_pkey_rsa.rb
parent4bf8c87101217056257508d76e7787ded0d76849 (diff)
Sat May 14 12:00:54 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* test/openssl/test_pkey_dsa.rb: Add basic tests and tests that ensure new public key PEM encoding behavior and ensure backward compatibility. [Ruby 1.9 - Bug #4422] [ruby-core:35328] * test/openssl/test_pkey_rsa.rb: Remove line with 'puts'. previous revision: 31561 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_pkey_rsa.rb')
-rw-r--r--test/openssl/test_pkey_rsa.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb
index 9c9b1dd1a6..39b65e889b 100644
--- a/test/openssl/test_pkey_rsa.rb
+++ b/test/openssl/test_pkey_rsa.rb
@@ -65,9 +65,9 @@ class OpenSSL::TestPKeyRSA < Test::Unit::TestCase
def test_read_RSA_PUBKEY
modulus = 10664264882656732240315063514678024569492171560814833397008094754351396057398262071307709191731289492697968568138092052265293364132872019762410446076526351
exponent = 65537
- algo_id = OpenSSL::ASN1::ObjectId.new('rsaEncryption')
+ algo = OpenSSL::ASN1::ObjectId.new('rsaEncryption')
null_params = OpenSSL::ASN1::Null.new(nil)
- algo_id = OpenSSL::ASN1::Sequence.new ([algo_id, null_params])
+ algo_id = OpenSSL::ASN1::Sequence.new ([algo, null_params])
pub_key = OpenSSL::ASN1::Sequence.new([OpenSSL::ASN1::Integer.new(modulus), OpenSSL::ASN1::Integer.new(exponent)])
seq = OpenSSL::ASN1::Sequence.new([algo_id, OpenSSL::ASN1::BitString.new(pub_key.to_der)])
key = OpenSSL::PKey::RSA.new(seq.to_der)
@@ -128,8 +128,7 @@ AwEAAQ==
def test_export_format_is_RSA_PUBKEY_pem
key = OpenSSL::PKey::RSA.new(512)
pem = key.public_key.to_pem
- pem.gsub!(/^-*(\w|\s)+-*$/, "") # eliminate --------BEGIN...-------
- puts pem
+ pem.gsub!(/^-+(\w|\s)+-+$/, "") # eliminate --------BEGIN...-------
asn1 = OpenSSL::ASN1.decode(Base64.decode64(pem))
check_PUBKEY(asn1, key)
end