I am trying to use Python to work with peer public key generated from Java (uses BouncyCastle
.)
Here is the snippet from the Java Code. It uses ECDH
and Curve25519
.
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(
Constants.ALGORITHM,
Constants.PROVIDER
);
X9ECParameters ecParams = CustomNamedCurves.getByName(Constants.CURVE);
ECParameterSpec ecSpec = new ECParameterSpec(
ecParams.getCurve(),
ecParams.getG(),
ecParams.getN(),
ecParams.getH(),
ecParams.getSeed()
);
keyPairGenerator.initialize(ecSpec, new SecureRandom());
keyPairGenerator.generateKeyPair();
Additionally, I would like to create the public key in the same format as in Java (uncompressed). Python's cryptography module only supports X25519 (which has x coordinate only.)
Is there any library in python that can help achieve this ?