public final class PKCS12PBE extends PBE
| Modifier and Type | Field and Description | 
|---|---|
static int | 
SHA_128RC2_CBC
The SHA1 with RC2 CBC 128 bits PKCS#12 mode. 
 | 
static int | 
SHA_128RC4
The SHA1 with RC4 128 bits PKCS#12 mode. 
 | 
static int | 
SHA_2_3DES_CBC
The SHA1 with Triple DES CBC 112 bits PKCS#12 mode. 
 | 
static int | 
SHA_3_3DES_CBC
The SHA1 with Triple DES CBC 168 bits PKCS#12 mode. 
 | 
static int | 
SHA_40RC2_CBC
The SHA1 with RC2 CBC 40 bits PKCS#12 mode. 
 | 
static int | 
SHA_40RC4
The SHA1 with RC4 40 bits PKCS#12 mode. 
 | 
algID, cipherAlgID, mdAlgID| Constructor and Description | 
|---|
PKCS12PBE()
Standard contstructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static byte[] | 
createPKCS12MacKey(AlgorithmIdentifier algID, java.lang.String password, byte[] salt, int iterationCount, int keyLength)
Creates a PKCS#12 MAC key according to the PKCS#12 specifications. 
 | 
byte[] | 
decrypt(java.lang.String password, byte[] data)
Decrypt an array of bytes, and return the decrypted array of bytes. 
 | 
PrivateKey | 
decryptPrivateKey(java.lang.String password, byte[] encPrivKey)
Decrypt a private key, and return the decrypted key. 
 | 
SymmetricKey | 
decryptSymmetricKey(java.lang.String password, byte[] encSymKey)
Decrypt a symmetric key, and return the decrypted key. 
 | 
byte[] | 
encrypt(java.lang.String password, byte[] data)
Encrypt an array of bytes, and return the encrypted array of bytes. 
 | 
byte[] | 
encryptPrivateKey(java.lang.String password, PrivateKey privKey)
Encrypt a private key, and return the encrypted key. 
 | 
byte[] | 
encryptSymmetricKey(java.lang.String password, SymmetricKey symKey)
Encrypt a symmetric key, and return the encrypted key. 
 | 
void | 
initialize(AlgorithmIdentifier algID)
Initializes this  
PBE instance with the specified algorithm identifier. | 
void | 
initialize(int mode)
Initializes this  
PBE instance with the specified PBE parameters. | 
void | 
initialize(int mode, byte[] salt, int iterationCount)
Initializes this  
PBE instance with the specified PBE parameters. | 
getAlgID, getInstancepublic static final int SHA_128RC4
public static final int SHA_40RC4
public static final int SHA_3_3DES_CBC
public static final int SHA_2_3DES_CBC
public static final int SHA_128RC2_CBC
public static final int SHA_40RC2_CBC
public void initialize(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
PBE instance with the specified algorithm identifier.initialize in class PBEalgID - The algorithm identifier used to initialize this PBE. It should be a instance of PBEAlgorithmIdentifier.AlgorithmIdentifierException
public void initialize(int mode,
              byte[] salt,
              int iterationCount)
                throws AlgorithmIdentifierException
PBE instance with the specified PBE parameters.initialize in class PBEmode - The mode to use with this PBE. The mode is 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 void initialize(int mode)
                throws AlgorithmIdentifierException
PBE instance with the specified PBE parameters.initialize in class PBEmode - The mode to use with this PBE. The mode is a PKCS12PBE mode value.AlgorithmIdentifierException
public byte[] encrypt(java.lang.String password,
             byte[] data)
               throws CipherException
encrypt in class PBEpassword - The password to use to generate the key.data - The data to encrypt.CipherException
public byte[] decrypt(java.lang.String password,
             byte[] data)
               throws CipherException
decrypt in class PBEpassword - The password to use to generate the key.data - The data to decrypt.CipherException
public byte[] encryptPrivateKey(java.lang.String password,
                       PrivateKey privKey)
                         throws CipherException
encryptPrivateKey in class PBEpassword - The password to use to generate the key.privKey - The private key to encrypt.CipherExceptionpublic PrivateKey decryptPrivateKey(java.lang.String password, byte[] encPrivKey) throws CipherException, java.io.IOException
decryptPrivateKey in class PBEpassword - The password to use to generate the key.encPrivKey - The byte array containing the encrypted private key.CipherExceptionjava.io.IOException
public byte[] encryptSymmetricKey(java.lang.String password,
                         SymmetricKey symKey)
                           throws CipherException
encryptSymmetricKey in class PBEpassword - The password to use to generate the key.symKey - The symmetric key to encrypt.CipherExceptionpublic SymmetricKey decryptSymmetricKey(java.lang.String password, byte[] encSymKey) throws CipherException
decryptSymmetricKey in class PBEpassword - The password to use to generate the key.encSymKey - The byte array containing the encrypted symmetric key.CipherExceptionpublic static byte[] createPKCS12MacKey(AlgorithmIdentifier algID, java.lang.String password, byte[] salt, int iterationCount, int keyLength) throws CipherException
algID - The message digest algorithm identifier to use to generate the key. It is typically SHA1.password - The password to use to generate the key.salt - The salt value to use during the key generation.iterationCount - The iteration count to use during the key generation.keyLength - The length of the key material that will be returned,CipherException