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