Package org.cryptacular.asn
Class PKCS8PrivateKeyDecoder
java.lang.Object
org.cryptacular.asn.AbstractPrivateKeyDecoder<org.bouncycastle.crypto.params.AsymmetricKeyParameter>
org.cryptacular.asn.PKCS8PrivateKeyDecoder
- All Implemented Interfaces:
ASN1Decoder<org.bouncycastle.crypto.params.AsymmetricKeyParameter>
public class PKCS8PrivateKeyDecoder
extends AbstractPrivateKeyDecoder<org.bouncycastle.crypto.params.AsymmetricKeyParameter>
Decodes PEM or DER-encoded PKCS#8 private keys.
- Author:
- Middleware Services
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.bouncycastle.crypto.params.AsymmetricKeyParameter
decodeASN1
(byte[] encoded) Decodes the given raw ASN.1 encoded data into a private key of the type supported by this class.protected byte[]
decryptKey
(byte[] encrypted, char[] password) Decrypts an encrypted key in either PKCS#8 or OpenSSL "traditional" format.Methods inherited from class org.cryptacular.asn.AbstractPrivateKeyDecoder
decode, tryConvertPem
-
Constructor Details
-
PKCS8PrivateKeyDecoder
public PKCS8PrivateKeyDecoder()
-
-
Method Details
-
decryptKey
protected byte[] decryptKey(byte[] encrypted, char[] password) Description copied from class:AbstractPrivateKeyDecoder
Decrypts an encrypted key in either PKCS#8 or OpenSSL "traditional" format. Both PEM and DER encodings are supported.- Specified by:
decryptKey
in classAbstractPrivateKeyDecoder<org.bouncycastle.crypto.params.AsymmetricKeyParameter>
- Parameters:
encrypted
- Encoded encrypted key data.password
- Password to decrypt key.- Returns:
- Decrypted key.
-
decodeASN1
protected org.bouncycastle.crypto.params.AsymmetricKeyParameter decodeASN1(byte[] encoded) Description copied from class:AbstractPrivateKeyDecoder
Decodes the given raw ASN.1 encoded data into a private key of the type supported by this class.- Specified by:
decodeASN1
in classAbstractPrivateKeyDecoder<org.bouncycastle.crypto.params.AsymmetricKeyParameter>
- Parameters:
encoded
- Encoded ASN.1 data.- Returns:
- Private key object.
-