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) |
✔️ |
✔️ |
✔️ |
✔️ |
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:
CryptlibObjectIdentifiers.curvey25519EdECObjectIdentifiers.id_X25519EdECObjectIdentifiers.id_X448EdECObjectIdentifiers.id_Ed25519EdECObjectIdentifiers.id_Ed448GNUObjectIdentifiers.Ed25519JcaPGPKeyConverter
BcPGPKeyConverter
Footnotes
Comments mention XDH, refer to
EdECObjectIdentifiers.id_X25519, should useCryptlibObjectIdentifiers.curvey25519? (src) ↩Refers to
EdECObjectIdentifiers.id_X25519in method call, should useCryptlibObjectIdentifiers.curvey25519? (src) ↩Source is not clear, does not compare OIDs (src) ↩ ↩2
Refers to
EdECObjectIdentifiers.id_Ed25519, should useGNUObjectIdentifiers.Ed25519? (src) ↩Refers to
EdECObjectIdentifiers.id_Ed25519, should useCryptlibObjectIdentifiers.curvey25519? (src) ↩Source is not clear, does not compare OIDs (src) ↩ ↩2
Comments mention X25519, refers to
EdECObjectIdentifiers.id_X25519, should useCryptlibObjectIdentifiers.curvey25519? (src) ↩Refers to
EdECObjectIdentifiers.id_X25519, should useCryptlibObjectIdentifiers.curvey25519? (src) ↩Comment and code mention "X25519", not clear if it uses Ed25519 ↩
pubkey instanceof X25519PublicKeyParameters, is this correct forCurve25519? ↩Refers to
EdECObjectIdentifiers.id_Ed25519, should useGNUObjectIdentifiers.Ed25519? (src) ↩If statement is hard to read (src) ↩