Skip to content

Commit

Permalink
Add v2 test vectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Apr 11, 2022
1 parent 8dc1b93 commit 0f3bf00
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/ed25519_from_pkcs8_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Public = 19bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1

# v2. Example private key from RFC 8410 Section 10.3.
Input = 3072020101300506032b657004220420d4ee72dbf913584ad5b6d8f1f769f8ad3afe7c28cbf1d4fbe097a88f44755842a01f301d060a2a864886f70d01090914310f0c0d437572646c652043686169727381210019bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 19bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1

# v2. The v2 example from the RFC, without the attributes [0], but retaining
# the public key [1].
Input = 3051020101300506032b657004220420d4ee72dbf913584ad5b6d8f1f769f8ad3afe7c28cbf1d4fbe097a88f4475584281210019bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 19bf44096984cdfe8541bac167dc3b96c85086aa30b6b6cb0c5c38ad703166e1

# v2. The v2 example from the RFC, retaining the attributes [0], but without
Expand Down Expand Up @@ -66,8 +66,8 @@ Result-Maybe-Unchecked = InvalidEncoding

# v2. The private key ends with a zero byte.
Input = 3051020101300506032b657004220420a22efdb713f0e1600d2a5ce948e321ca3a18137c47f15091a12c7126c1749a008121001aeb8e3ee5ba5afd91113466d19f4ea77fa0feffbd8c5adcb499927f12535f77
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 1aeb8e3ee5ba5afd91113466d19f4ea77fa0feffbd8c5adcb499927f12535f77

# v2. The private key's last byte, zero, is omitted.
Expand All @@ -77,8 +77,8 @@ Result-Maybe-Unchecked = InvalidEncoding

# v2. The private key starts with a zero byte.
Input = 3051020101300506032b65700422042000b1a7c20b2b4ed9c78f3686db82f854734cdc95be51def304d98e0cd30bf49081210063457cd4dfdd0e98a53796265831d46ac6a5a685f2a54c9697a38b2c800d60ba
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 63457cd4dfdd0e98a53796265831d46ac6a5a685f2a54c9697a38b2c800d60ba

# v2. The private key's first byte, zero, is omitted.
Expand All @@ -88,8 +88,8 @@ Result-Maybe-Unchecked = InvalidEncoding

# v2. The public key's first byte is zero.
Input = 3051020101300506032b6570042204202dc67de5186d9193021c0b104d9c6ef24bee2bd395ccb5ed5a2db5f37a2fc1f081210000c17e4d8bbff27c1fb618c23fce988703c7efa3cd590aacac12d3f1e3c90c8c
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 00c17e4d8bbff27c1fb618c23fce988703c7efa3cd590aacac12d3f1e3c90c8c

# v2. The public key's first byte, zero, is omitted.
Expand All @@ -99,8 +99,8 @@ Result-Maybe-Unchecked = InvalidEncoding

# v2. The public key's last byte is zero.
Input = 3051020101300506032b657004220420b2579f555a2eabdabac8d46997b1c08fe8ce63858df124efc29c60dfbb86c3498121009d421270ce2fcc08672c41e427214876245c9b0f14ab671b8bb9d266a492e400
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = OK
Result-Maybe-Unchecked = OK
Public = 9d421270ce2fcc08672c41e427214876245c9b0f14ab671b8bb9d266a492e400

# v2. The public key's last byte, zero, is omitted (valid ASN.1 DER).
Expand All @@ -116,8 +116,8 @@ Result-Maybe-Unchecked = InvalidEncoding
# v2. The public key's high bit has been flipped. Ed25519 public keys don't
# have their high bit masked, so this is wrong.
Input = 3051020101300506032b6570042204202dc67de5186d9193021c0b104d9c6ef24bee2bd395ccb5ed5a2db5f37a2fc1f081210000c17e4d8bbff27c1fb618c23fce988703c7efa3cd590aacac12d3f1e3c90c0c
Result-Checked = InvalidEncoding
Result-Maybe-Unchecked = InvalidEncoding
Result-Checked = InconsistentComponents
Result-Maybe-Unchecked = InconsistentComponents

# v2. Valid except the public key field is missing.
Input = 302e020101300506032b657004220420a22efdb713f0e1600d2a5ce948e321ca3a18137c47f15091a12c7126c1749a00
Expand Down

0 comments on commit 0f3bf00

Please sign in to comment.