I am creating a key pair on the platform using Bouncy Castle .
SecureRandom random = new SecureRandom();
ECKeyPairGenerator pGen = new ECKeyPairGenerator();
ECKeyGenerationParameters genParam = new ECKeyGenerationParameters(params,random);
pGen.init(genParam);
AsymmetricCipherKeyPair pair = pGen.generateKeyPair();
It pairhas a type here AsymmetricCipherKeyPair. And I need to create an X509V1Certificate on the server using this pair. But the X509Certificate setPublicKey(PublicKey pubkey)only accepts type objects PublicKey. Therefore, I need to get PublicKeyfrom AsymmetricCipherKeyPairon the server. But I get ECPublicKeyParametersthat which is not accepted in the method setPublicKey.
So my requirement here is to get PublicKeyfrom AsymmetricCipherKeyPair.
source
share