Hi Team,
I get "java.security.spec.InvalidKeySpecException: key spec not recognised"
exception while running it in carbon component but the same code (library)
works fine as a self contained web application.
I am using "buncycastle" library to decode public key.
here is the code:
public PublicKey decodePublicKey(byte[] encodedPublicKey) throws
U2fException {
try {
X9ECParameters curve = SECNamedCurves.getByName("secp256r1");
ECPoint point;
try {
point = curve.getCurve().decodePoint(encodedPublicKey);
} catch (RuntimeException e) {
throw new U2fException("Could not parse user public key",
e);
}
return KeyFactory.getInstance("ECDSA").generatePublic(
new ECPublicKeySpec(point,
new ECParameterSpec(
curve.getCurve(),
curve.getG(),
curve.getN(),
curve.getH()
)
)
);
} catch (InvalidKeySpecException e) {
throw new U2fException(ERROR_DECODING_PUBLIC_KEY, e);
} catch (NoSuchAlgorithmException e) {
throw new U2fException(ERROR_DECODING_PUBLIC_KEY, e);
}
}
online resources suggests its because class loading issues[1
<http://www.bouncycastle.org/jira/browse/BJA-131>], also the provider
installation guide[2
<http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation>].
I tried installing JCE provider to jre, didn't help. web application is
working without installing the provider
need information regards JCE provider class loading and security policy
details in carbon.
1. http://www.bouncycastle.org/jira/browse/BJA-131
2. http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation
*E. Ananthaneshan*
Associate Software Engineer
WSO2, Inc: http://wso2.com
Mob: +94 712307125
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev