Package org.bouncycastle.pkcs
Class PKCS8EncryptedPrivateKeyInfo
- java.lang.Object
-
- org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo
-
public class PKCS8EncryptedPrivateKeyInfo extends java.lang.ObjectHolding class for a PKCS#8 EncryptedPrivateKeyInfo structure (RFC 5958, originally RFC 5208).
-
-
Constructor Summary
Constructors Constructor Description PKCS8EncryptedPrivateKeyInfo(byte[] encryptedPrivateKeyInfo)Parse a BER/DER encoded EncryptedPrivateKeyInfo.PKCS8EncryptedPrivateKeyInfo(org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo)Wrap an existing parsedEncryptedPrivateKeyInfostructure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.asn1.pkcs.PrivateKeyInfodecryptPrivateKeyInfo(InputDecryptorProvider inputDecryptorProvider)Decrypt the wrapped private key.byte[]getEncoded()Return the default (DER) encoding of this EncryptedPrivateKeyInfo.byte[]getEncryptedData()Return the raw ciphertext bytes of the encrypted private key.org.bouncycastle.asn1.x509.AlgorithmIdentifiergetEncryptionAlgorithm()Return the algorithm identifier describing how the private key has been encrypted.org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfotoASN1Structure()Return the underlying ASN.1 structure for this holder.
-
-
-
Constructor Detail
-
PKCS8EncryptedPrivateKeyInfo
public PKCS8EncryptedPrivateKeyInfo(org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo)
Wrap an existing parsedEncryptedPrivateKeyInfostructure.- Parameters:
encryptedPrivateKeyInfo- the ASN.1 structure to wrap.
-
PKCS8EncryptedPrivateKeyInfo
public PKCS8EncryptedPrivateKeyInfo(byte[] encryptedPrivateKeyInfo) throws java.io.IOExceptionParse a BER/DER encoded EncryptedPrivateKeyInfo.- Parameters:
encryptedPrivateKeyInfo- the encoded bytes.- Throws:
java.io.IOException- if the data is not a valid EncryptedPrivateKeyInfo encoding.
-
-
Method Detail
-
getEncryptionAlgorithm
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getEncryptionAlgorithm()
Return the algorithm identifier describing how the private key has been encrypted.
-
getEncryptedData
public byte[] getEncryptedData()
Return the raw ciphertext bytes of the encrypted private key.
-
toASN1Structure
public org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfo toASN1Structure()
Return the underlying ASN.1 structure for this holder.
-
getEncoded
public byte[] getEncoded() throws java.io.IOExceptionReturn the default (DER) encoding of this EncryptedPrivateKeyInfo.- Returns:
- the encoded bytes.
- Throws:
java.io.IOException- if encoding fails.
-
decryptPrivateKeyInfo
public org.bouncycastle.asn1.pkcs.PrivateKeyInfo decryptPrivateKeyInfo(InputDecryptorProvider inputDecryptorProvider) throws PKCSException
Decrypt the wrapped private key.- Parameters:
inputDecryptorProvider- provider able to produce a decryptor matching the encryption algorithm carried by this object.- Returns:
- the recovered
PrivateKeyInfo. - Throws:
PKCSException- if a decryptor cannot be created or decryption / parsing fails.
-
-