My goal is to create Elliptical curve key pairs from it using spongy castle library and then armor it.
X9ECParameters curve = ECNamedCurveTable.getByName("secp256k1");
ECDomainParameters domainParams = new ECDomainParameters(curve.getCurve(),curve.getG(), curve.getN(), curve.getN(), curve.getSeed());
SecureRandom secureRandom = new SecureRandom();
ECKeyGenerationParameters keyParams = new ECKeyGenerationParameters(domainParams, secureRandom);
ECKeyPairGenerator generator = new ECKeyPairGenerator();
generator.init(keyParams);
AsymmetricCipherKeyPair kp= generator.generateKeyPair();
char[] passPhrase = "hello".toCharArray();
PGPKeyPair ecKeyPair = new BcPGPKeyPair(PGPPublicKey.ECDH, kp, new Date());
PGPKeyRingGenerator keyRingGen = new PGPKeyRingGenerator
(PGPSignature.DEFAULT_CERTIFICATION,
ecKeyPair,
"umaimaahmed1@gmail.com", null, null,
null, new BcPGPContentSignerBuilder(PGPPublicKey.EC,
HashAlgorithmTags.SHA256),
new BcPBESecretKeyEncryptorBuilder(PGPEncryptedData.AES_256).build(passPhrase));
After this the parsed armored key ring generation is executed.
It works fine for RSA but for ECC implementation I get an exception of illegal object in getInstance: org.spongycastle.asn1.x9.X962Parameters
when it hits the linePGPKeyPair ecKeyPair = new BcPGPKeyPair(PGPPublicKey.ECDH, kp, new Date());
I cant find anything on the internet to generate PGP Key Rings from ECC key pairs.