Skip to content

Commit

Permalink
Seems the reporting of keysize is not consistent across different Ope…
Browse files Browse the repository at this point in the history
…nSSL versions. Also the spec seems only specified the key length of public key, no mention of private key size
  • Loading branch information
Antrapol committed Nov 14, 2023
1 parent b92ee8b commit 0b3fe97
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions test/openssl/test_pkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,14 @@ def test_keysize_in_bits
end

# Test vector from RFC 8032 Section 7.1 TEST 2
priv_pem = <<~EOF
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIEzNCJso/5banbbDRuwRTg9bijGfNaumJNqM9u1PuKb7
-----END PRIVATE KEY-----
EOF
pub_pem = <<~EOF
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAPUAXw+hDiVqStwqnTRt+vJyYLM8uxJaMwM1V8Sr0Zgw=
-----END PUBLIC KEY-----
EOF
begin
priv = OpenSSL::PKey.read(priv_pem)

pub = OpenSSL::PKey.read(pub_pem)

assert_equal 256, priv.keysize_in_bits
assert_equal 256, pub.keysize_in_bits

rescue OpenSSL::PKey::PKeyError => e
Expand Down

0 comments on commit 0b3fe97

Please sign in to comment.