Commit ed396e93 authored by Kenny Root's avatar Kenny Root
Browse files

OpenSSLKey: unsupported algorithm is an InvalidKeyException

When an invalid key is passed in we may throw NoSuchAlgorithmException
if it's a key we don't support, but we should convert this to the
correct exception for this API.

Bug: 21209493
Change-Id: I55123035295203f2676538ac89ba4eb91141b273
No related merge requests found
......@@ -221,7 +221,11 @@ public class OpenSSLKey {
throw new InvalidKeyException("Key encoding is null");
}
return new OpenSSLKey(NativeCrypto.d2i_PUBKEY(key.getEncoded()));
try {
return new OpenSSLKey(NativeCrypto.d2i_PUBKEY(key.getEncoded()));
} catch (Exception e) {
throw new InvalidKeyException(e);
}
}
public PublicKey getPublicKey() throws NoSuchAlgorithmException {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment