Modifier and Type | Field and Description |
---|---|
protected PBEAlgorithmIdentifier |
algID |
protected AlgorithmIdentifier |
cipherAlgID |
protected AlgorithmIdentifier |
mdAlgID |
Modifier | Constructor and Description |
---|---|
protected |
PBE()
Standard contstructor.
|
Modifier and Type | Method and Description |
---|---|
abstract byte[] |
decrypt(java.lang.String password, byte[] data)
Decrypt an array of bytes, and return the decrypted array of bytes.
|
abstract PrivateKey |
decryptPrivateKey(java.lang.String password, byte[] encPrivKey)
Decrypt a private key, and return the decrypted key.
|
abstract SymmetricKey |
decryptSymmetricKey(java.lang.String password, byte[] encSymKey)
Decrypt a symmetric key, and return the decrypted key.
|
abstract byte[] |
encrypt(java.lang.String password, byte[] data)
Encrypt an array of bytes, and return the encrypted array of bytes.
|
abstract byte[] |
encryptPrivateKey(java.lang.String password, PrivateKey privKey)
Encrypt a private key, and return the encrypted key.
|
abstract byte[] |
encryptSymmetricKey(java.lang.String password, SymmetricKey symKey)
Encrypt a symmetric key, and return the encrypted key.
|
AlgorithmIdentifier |
getAlgID()
Returns the algorithm identifier of this PBE.
|
static PBE |
getInstance(AlgorithmIdentifier algID)
Creates a new
PBE instance using the specified AlgorithmIdentifier. |
abstract void |
initialize(AlgorithmIdentifier algID)
Initializes this
PBE instance with the specified algorithm identifier. |
abstract void |
initialize(int mode)
Initializes this
PBE instance with the specified PBE parameters. |
abstract void |
initialize(int mode, byte[] salt, int iterationCount)
Initializes this
PBE instance with the specified PBE parameters. |
protected PBEAlgorithmIdentifier algID
protected AlgorithmIdentifier mdAlgID
protected AlgorithmIdentifier cipherAlgID
public static PBE getInstance(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
PBE
instance using the specified AlgorithmIdentifier.algID
- The algorithm identifier to create the PBE. It should be a instance of PBEAlgorithmIdentifier
.AlgorithmIdentifierException
public abstract void initialize(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
PBE
instance with the specified algorithm identifier.algID
- The algorithm identifier used to initialize this PBE. It should be a instance of PBEAlgorithmIdentifier
.AlgorithmIdentifierException
public abstract void initialize(int mode, byte[] salt, int iterationCount) throws AlgorithmIdentifierException
PBE
instance with the specified PBE parameters.mode
- The mode to use with this PBE. The mode can be a PKCS5PBE
mode value or a PKCS12PBE
mode value.salt
- The salt to use during the key generation.iterationCount
- The iteration count to use during the key generation.AlgorithmIdentifierException
public abstract void initialize(int mode) throws AlgorithmIdentifierException
PBE
instance with the specified PBE parameters.mode
- The mode to use with this PBE. The mode can be a PKCS5PBE
mode value or a PKCS12PBE
mode value.AlgorithmIdentifierException
public AlgorithmIdentifier getAlgID()
AlgorithmIdentifier
object representing the algorithm used with this PBE.public abstract byte[] encryptPrivateKey(java.lang.String password, PrivateKey privKey) throws CipherException
password
- The password to use to generate the key.privKey
- The private key to encrypt.CipherException
public abstract PrivateKey decryptPrivateKey(java.lang.String password, byte[] encPrivKey) throws CipherException, java.io.IOException
password
- The password to use to generate the key.encPrivKey
- The byte array containing the encrypted private key.CipherException
java.io.IOException
public abstract byte[] encryptSymmetricKey(java.lang.String password, SymmetricKey symKey) throws CipherException
password
- The password to use to generate the key.symKey
- The symmetric key to encrypt.CipherException
public abstract SymmetricKey decryptSymmetricKey(java.lang.String password, byte[] encSymKey) throws CipherException
password
- The password to use to generate the key.encSymKey
- The byte array containing the encrypted symmetric key.CipherException
public abstract byte[] encrypt(java.lang.String password, byte[] data) throws CipherException
password
- The password to use to generate the key.data
- The data to encrypt.CipherException
public abstract byte[] decrypt(java.lang.String password, byte[] data) throws CipherException
password
- The password to use to generate the key.data
- The data to decrypt.CipherException