Skip to content

OpenPGP: Support for Curve25519, Ed25519, X448 and Ed448 #1142

Description

@vanitasvitae

Hey!

As far as I can tell, BC is missing support for some algorithms. Also, there are ambiguities regarding the used curve OIDs. Here are my observations, note that I'm not an expert, so my observations might be wrong:

BCs Curve Constants

I'm comparing the curve OIDs to those from crypto-refresh-05:

RFC 4880 Algo Name BC OID Constant Value
Curve25519 (ECDH) CryptlibObjectIdentifiers.curvey25519 1.3.6.1.4.1.3029.1.5.1
not used EdECObjectIdentifiers.id_X25519 1.3.101.110
X448 (ECDH) EdECObjectIdentifiers.id_X448 1.3.101.111
not used EdECObjectIdentifiers.id_Ed25519 1.3.101.112
Ed448 (EdDSA) EdECObjectIdentifiers.id_Ed448 1.3.101.113
Ed25519 (EdDSA) GNUObjectIdentifiers.Ed25519 1.3.6.1.4.1.11591.15.1

JcaPGPKeyConverter

Algorithm getPrivateKey() getPublicKey() getPrivateBCPGKey() getPublicBCPGKey()
Curve25519 (ECDH) 1 2 Probably? 3 ✔️
X448 (ECDH) Probably not? 3
Ed25519 (EdDSA) ✔️ 4 ✔️ 5 Maybe? 6 ✔️
Ed448 (EdDSA) Probably not? 6

BcPGPKeyConverter

Algorithm getPrivateKey() getPublicKey() getPrivateBCPGKey() getPublicBCPGKey()
Curve25519 (ECDH) 7 8 9 10
X448 (ECDH) ✔️
Ed25519 (EdDSA) 11 ✔️ 12 ✔️ ✔️
Ed448 (EdDSA) ✔️ ✔️ ✔️ ✔️

Footnotes

  1. Comments mention XDH, refer to EdECObjectIdentifiers.id_X25519, should use CryptlibObjectIdentifiers.curvey25519? (src)

  2. Refers to EdECObjectIdentifiers.id_X25519 in method call, should use CryptlibObjectIdentifiers.curvey25519? (src)

  3. Source is not clear, does not compare OIDs (src) 2

  4. Refers to EdECObjectIdentifiers.id_Ed25519, should use GNUObjectIdentifiers.Ed25519? (src)

  5. Refers to EdECObjectIdentifiers.id_Ed25519, should use CryptlibObjectIdentifiers.curvey25519? (src)

  6. Source is not clear, does not compare OIDs (src) 2

  7. Comments mention X25519, refers to EdECObjectIdentifiers.id_X25519, should use CryptlibObjectIdentifiers.curvey25519? (src)

  8. Refers to EdECObjectIdentifiers.id_X25519, should use CryptlibObjectIdentifiers.curvey25519? (src)

  9. Comment and code mention "X25519", not clear if it uses Ed25519

  10. pubkey instanceof X25519PublicKeyParameters, is this correct for Curve25519?

  11. Refers to EdECObjectIdentifiers.id_Ed25519, should use GNUObjectIdentifiers.Ed25519? (src)

  12. If statement is hard to read (src)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions