@Role public interface PrivateKeyPasswordBasedEncryptor
Modifier and Type | Method and Description |
---|---|
PrivateKeyParameters |
decrypt(byte[] password,
byte[] encoded)
Decrypt a private key from an encoded byte array.
|
PrivateKeyParameters |
decrypt(byte[] password,
EncryptedPrivateKeyInfo privateKeyInfo)
Decrypt a private key from an
EncryptedPrivateKeyInfo . |
byte[] |
encrypt(byte[] password,
PrivateKeyParameters privateKey)
Encrypt a private key using a AES 256 password based cipher in a PKCS #8 format.
|
byte[] |
encrypt(PasswordBasedCipher cipher,
PrivateKeyParameters privateKey)
Encrypt a private key using a password based cipher in a PKCS #8 format.
|
byte[] |
encrypt(String algHint,
byte[] password,
byte[] encoded,
PrivateKeyParameters privateKey)
Encrypt a private key using a password based cipher in a PKCS #8 format.
|
byte[] |
encrypt(String algHint,
byte[] password,
KeyDerivationFunctionParameters kdfParameters,
PrivateKeyParameters privateKey)
Encrypt a private key in a PKCS #8 format using a random initialization vector.
|
byte[] |
encrypt(String algHint,
SymmetricCipherParameters password,
KeyDerivationFunctionParameters kdfParameters,
PrivateKeyParameters privateKey)
Encrypt a private key using a password based cipher in a PKCS #8 format.
|
byte[] |
encrypt(String algHint,
SymmetricCipherParameters password,
KeyDerivationFunction function,
PrivateKeyParameters privateKey)
Encrypt a private key using a password based cipher in a PKCS #8 format.
|
PrivateKeyParameters decrypt(byte[] password, byte[] encoded) throws GeneralSecurityException, IOException
password
- the password used to derive the encryption key.encoded
- the encrypted key in ASN.1 format according to PKCS #8.GeneralSecurityException
- if an error occurs during decryption.IOException
- if an error occurs during decoding.PrivateKeyParameters decrypt(byte[] password, EncryptedPrivateKeyInfo privateKeyInfo) throws GeneralSecurityException, IOException
EncryptedPrivateKeyInfo
.password
- the password used to derive the encryption key.privateKeyInfo
- the encrypted private key information.GeneralSecurityException
- if an error occurs during decryption.IOException
- if an error occurs during decoding.byte[] encrypt(String algHint, SymmetricCipherParameters password, KeyDerivationFunctionParameters kdfParameters, PrivateKeyParameters privateKey) throws GeneralSecurityException, IOException
algHint
- the hint of the PasswordBasedCipher to use.password
- cipher parameters, using a password converted to bytes for the key.kdfParameters
- the parameters of the derivation function.privateKey
- the private key parameters to encrypt.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.byte[] encrypt(String algHint, SymmetricCipherParameters password, KeyDerivationFunction function, PrivateKeyParameters privateKey) throws GeneralSecurityException, IOException
algHint
- the hint of the PasswordBasedCipher to use.password
- cipher parameters, using a password converted to bytes for the key.function
- the key derivation function to use for deriving key from password.privateKey
- cipher parameters, using a password converted to bytes for the key.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.byte[] encrypt(String algHint, byte[] password, byte[] encoded, PrivateKeyParameters privateKey) throws GeneralSecurityException, IOException
algHint
- the hint of the PasswordBasedCipher to use.password
- the password used to derive the encryption key.encoded
- encoded parameters to initialize the cipher and derivation function.privateKey
- the private key parameters to encrypt.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.byte[] encrypt(byte[] password, PrivateKeyParameters privateKey) throws GeneralSecurityException, IOException
password
- the password used to derive the encryption key.privateKey
- the private key parameters to encrypt.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.byte[] encrypt(PasswordBasedCipher cipher, PrivateKeyParameters privateKey) throws IOException, GeneralSecurityException
cipher
- the initialized PasswordBasedCipher to use.privateKey
- the private key parameters to encrypt.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.byte[] encrypt(String algHint, byte[] password, KeyDerivationFunctionParameters kdfParameters, PrivateKeyParameters privateKey) throws IOException, GeneralSecurityException
algHint
- the hint of the PasswordBasedCipher to use.password
- the password used to derive the encryption key.kdfParameters
- the parameters of the derivation function.privateKey
- the private key parameters to encrypt.GeneralSecurityException
- if an error occurs during encryption.IOException
- if an error occurs during encoding.Copyright © 2004–2022 XWiki. All rights reserved.