Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-03


oracle.security.crypto.core
Class PKCS5PBE

java.lang.Object
  extended by oracle.security.crypto.core.PBE
      extended by oracle.security.crypto.core.PKCS5PBE


public final class PKCS5PBE
extends PBE

Class to perform password-based encryption, as defined in the PKCS#5v2 specification.


Field Summary
static int MD2_DES
          The MD2 with DES CBC PKCS#5 mode.
static int MD2_RC2
          The MD2 with RC2 CBC PKCS#5 mode.
static int MD5_DES
          The MD5 with DES CBC PKCS#5 mode.
static int MD5_RC2
          The MD5 with RC2 CBC PKCS#5 mode.
static int SHA1_DES
          The SHA1 with DES CBC PKCS#5 mode.
static int SHA1_RC2
          The SHA1 with RC2 CBC PKCS#5 mode.

 

Fields inherited from class oracle.security.crypto.core.PBE
algID, cipherAlgID, mdAlgID

 

Constructor Summary
PKCS5PBE()
          Standard contstructor.

 

Method Summary
 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.

 

Methods inherited from class oracle.security.crypto.core.PBE
getAlgID, getInstance

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

MD2_DES

public static final int MD2_DES
The MD2 with DES CBC PKCS#5 mode.
See Also:
Constant Field Values

MD2_RC2

public static final int MD2_RC2
The MD2 with RC2 CBC PKCS#5 mode.
See Also:
Constant Field Values

MD5_DES

public static final int MD5_DES
The MD5 with DES CBC PKCS#5 mode.
See Also:
Constant Field Values

MD5_RC2

public static final int MD5_RC2
The MD5 with RC2 CBC PKCS#5 mode.
See Also:
Constant Field Values

SHA1_DES

public static final int SHA1_DES
The SHA1 with DES CBC PKCS#5 mode.
See Also:
Constant Field Values

SHA1_RC2

public static final int SHA1_RC2
The SHA1 with RC2 CBC PKCS#5 mode.
See Also:
Constant Field Values

Constructor Detail

PKCS5PBE

public PKCS5PBE()
Standard contstructor.

Method Detail

initialize

public void initialize(AlgorithmIdentifier algID)
                throws AlgorithmIdentifierException
Initializes this PBE instance with the specified algorithm identifier.
Specified by:
initialize in class PBE
Parameters:
algID - The algorithm identifier used to initialize this PBE. It should be a instance of PBEAlgorithmIdentifier.
Throws:
AlgorithmIdentifierException

initialize

public void initialize(int mode,
                       byte[] salt,
                       int iterationCount)
                throws AlgorithmIdentifierException
Initializes this PBE instance with the specified PBE parameters.
Specified by:
initialize in class PBE
Parameters:
mode - The mode to use with this PBE. The mode is a PKCS5PBE mode value.
salt - The salt to use during the key generation.
iterationCount - The iteration count to use during the key generation.
Throws:
AlgorithmIdentifierException

initialize

public void initialize(int mode)
                throws AlgorithmIdentifierException
Initializes this PBE instance with the specified PBE parameters.
Specified by:
initialize in class PBE
Parameters:
mode - The mode to use with this PBE. The mode is a PKCS5PBE mode value.
Throws:
AlgorithmIdentifierException

encrypt

public byte[] encrypt(java.lang.String password,
                      byte[] data)
               throws CipherException
Encrypt an array of bytes, and return the encrypted array of bytes.
Specified by:
encrypt in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding.
data - The data to encrypt.
Returns:
The encrypted data.
Throws:
CipherException

decrypt

public byte[] decrypt(java.lang.String password,
                      byte[] data)
               throws CipherException
Decrypt an array of bytes, and return the decrypted array of bytes.
Specified by:
decrypt in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding. If the decryption fails, the local encoding is used.
data - The data to decrypt.
Returns:
The decrypted data.
Throws:
CipherException

encryptPrivateKey

public byte[] encryptPrivateKey(java.lang.String password,
                                PrivateKey privKey)
                         throws CipherException
Encrypt a private key, and return the encrypted key.
Specified by:
encryptPrivateKey in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding.
privKey - The private key to encrypt.
Returns:
A byte array containing the encrypted private key.
Throws:
CipherException

decryptPrivateKey

public PrivateKey decryptPrivateKey(java.lang.String password,
                                    byte[] encPrivKey)
                             throws CipherException,
                                    java.io.IOException
Decrypt a private key, and return the decrypted key.
Specified by:
decryptPrivateKey in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding. If the decryption fails, the local encoding is used.
encPrivKey - The byte array containing the encrypted private key.
Returns:
The decrypted private key.
Throws:
CipherException
java.io.IOException

encryptSymmetricKey

public byte[] encryptSymmetricKey(java.lang.String password,
                                  SymmetricKey symKey)
                           throws CipherException
Encrypt a symmetric key, and return the encrypted key.
Specified by:
encryptSymmetricKey in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding.
symKey - The symmetric key to encrypt.
Returns:
A byte array containing the encrypted symmetric key.
Throws:
CipherException

decryptSymmetricKey

public SymmetricKey decryptSymmetricKey(java.lang.String password,
                                        byte[] encSymKey)
                                 throws CipherException
Decrypt a symmetric key, and return the decrypted key.
Specified by:
decryptSymmetricKey in class PBE
Parameters:
password - The password to use to generate the key. The password transformed to a byte array using the US-ASCII encoding. If the decryption fails, the local encoding is used.
encSymKey - The byte array containing the encrypted symmetric key.
Returns:
The decrypted symmetric key.
Throws:
CipherException

Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-03


Copyright © 2005, 2011 , Oracle. All rights reserved.