public class ECKeyDecoder extends Object
Constructor and Description |
---|
ECKeyDecoder()
Create an elliptic curve key decoder.
|
Modifier and Type | Method and Description |
---|---|
ECPrivateKey |
getPrivateKeyFromPEM(String key)
Decode the PEM encoded elliptic curve private key into an
ECPrivateKey . |
ECPrivateKey |
getPrivateKeyFromPKCS8(byte[] key)
Decode the PKCS8 encoded elliptic curve private key into an
ECPrivateKey . |
ECPublicKey |
getPublicKeyFromPEM(String key)
Decode the PEM encoded elliptic curve public key into an
ECPublicKey . |
ECPublicKey |
getPublicKeyFromX509(byte[] key)
Decode the X509 encoded elliptic curve public key into an
ECPublicKey . |
public ECKeyDecoder() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- thrown if EC keys are not supportedpublic ECPrivateKey getPrivateKeyFromPEM(String key) throws IOException, InvalidKeySpecException
ECPrivateKey
.key
- the PEM encoded elliptic curve private keyECPrivateKey
IOException
- thrown if there is an IO issue processing the encoded keyInvalidKeySpecException
- thrown is the key is not the expected format and specificationpublic ECPrivateKey getPrivateKeyFromPKCS8(byte[] key) throws InvalidKeySpecException
ECPrivateKey
.key
- the PKCS8 encoded elliptic curve private keyECPrivateKey
InvalidKeySpecException
- thrown is the key is not the expected format and specificationpublic ECPublicKey getPublicKeyFromPEM(String key) throws IOException, InvalidKeySpecException
ECPublicKey
.key
- the PEM encoded elliptic curve public keyECPublicKey
IOException
- thrown if there is an IO issue processing the encoded keyInvalidKeySpecException
- thrown is the key is not the expected format and specificationpublic ECPublicKey getPublicKeyFromX509(byte[] key) throws InvalidKeySpecException
ECPublicKey
.key
- the X509 encoded elliptic curve public keyECPublicKey
InvalidKeySpecException
- thrown is the key is not the expected format and specificationCopyright © 2021. All rights reserved.