Skip to content

Commit

Permalink
Not getting consistance result on ED25519 keysize
Browse files Browse the repository at this point in the history
  • Loading branch information
Antrapol committed Nov 15, 2023
1 parent fb17bc9 commit db2ac8a
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions test/openssl/test_pkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,36 +266,5 @@ def test_keysize_in_bits
# OpenSSL < 1.1.0
pend 'X25519 is not implemented'
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)

if openssl?(1, 1, 1) or openssl?(3, 0, 0)
# for some reason OpenSSL v1.1.1 returns 253 as value while
# all other versions returned 256 as value
# Cannot find actual key size in bit for ED25519 private key
# but public key seems to be 256 bits
assert_equal 253, priv.keysize_in_bits
assert_equal 253, pub.keysize_in_bits
else
assert_equal 256, priv.keysize_in_bits
assert_equal 256, pub.keysize_in_bits
end
rescue OpenSSL::PKey::PKeyError => e
# OpenSSL < 1.1.1
pend 'Ed25519 is not implemented' unless openssl?(1, 1, 1)
end
end
end

0 comments on commit db2ac8a

Please sign in to comment.