Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


oracle.security.crypto.core
Class PKCS5

java.lang.Object
  extended by oracle.security.crypto.core.PKCS5

All Implemented Interfaces:
java.io.Serializable, ASN1Object, Streamable

Deprecated. Use PBE, PKCS5PBE, PKCS12PBE and PBEAlgorithmIdentifier instead.

public class PKCS5
extends java.lang.Object
implements ASN1Object, java.io.Serializable

This class implements PKCS #5 and PKCS #12 password-based encryption. The methods encrypt() and decrypt() perform encryption or decryption based on the mode and password.

Please note that PKCS5 is the encryption algorithm used to encrypt and decrypt private keys, encapsulated by the PrivateKeyPKCS8 class. This class may not be backward compatible for Serialization: PKCS5 serialized objects created with PSE 2.2.2 and later until PSE 2.2.3 Build G may not be read.

See Also:
Serialized Form

Field Summary
static int DEFAULT_ITER_COUNT
          Deprecated. Default password-based key derivation iteration count is 1024.
static int DEFAULT_SALT_LEN
          Deprecated. Default password-based key derivation salt length is 8 bytes.
static int MD2_DES
          Deprecated. Encryption mode identifier for MD2 with DES.
static int MD5_DES
          Deprecated. Encryption mode identifier for MD5 with DES.
static int NONE
          Deprecated. Indicates that no encryption mode is set.
static int SHA_128RC2
          Deprecated. Encryption mode identifier for SHA-1 with 128-bit RC2.
static int SHA_128RC4
          Deprecated. Encryption mode identifier for SHA-1 with 128-bit RC4.
static int SHA_2DES
          Deprecated. Encryption mode identifier for SHA-1 with two-key DES.
static int SHA_3DES
          Deprecated. Encryption mode identifier for SHA-1 with triple-DES.
static int SHA_40RC2
          Deprecated. Encryption mode identifier for SHA-1 with 40-bit RC2.
static int SHA_40RC4
          Deprecated. Encryption mode identifier for SHA-1 with 40-bit RC4.

 

Constructor Summary
PKCS5()
          Deprecated. Creates a new PKCS5 instance.
PKCS5(byte[] p, byte[] s, int c)
          Deprecated. Creates a new PKCS5 instance with the given password, salt and count, and MD5_DES encryption mode.
PKCS5(byte[] p, byte[] s, int c, int m)
          Deprecated. Creates a new PKCS5 instance with the given password, salt, count and mode.
PKCS5(int m)
          Deprecated. Creates a new PKCS5 instance with the given mode ID, and default iteration count and source of randomness.
PKCS5(int m, int c, RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance.
PKCS5(int m, RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance with the given mode and source of randomness, and the default iteration count.
PKCS5(RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance with the given source of randomness, and the default mode and iteration count.
PKCS5(java.lang.String p, byte[] s, int m)
          Deprecated. Creates a new PKCS5 instance with the given password, salt and mode, and the default iteration count.
PKCS5(java.lang.String p, byte[] s, int c, int m)
          Deprecated. Creates a new PKCS5 instance with the given password, salt, count and mode.
PKCS5(java.lang.String p, int m, int c, RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance with the given password, salt, count, mode and source of randomness.
PKCS5(java.lang.String p, int m, RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance with the given password, mode and source of randomness, and the default iteration count.
PKCS5(java.lang.String p, RandomBitsSource rbs)
          Deprecated. Creates a new PKCS5 instance with the given password and source of randomness, and the default mode and iteration count.

 

Method Summary
 java.lang.String algName()
          Deprecated.  
 byte[] decrypt(byte[] data)
          Deprecated. Decrypt an array of bytes, and return the decrypted array of bytes.
 byte[] encrypt(byte[] data)
          Deprecated. Encrypt an array of bytes, and return the encrypted array of bytes.
 int encryptedLength(int dataLen)
          Deprecated.  
 int getCount()
          Deprecated.  
 int getMode()
          Deprecated.  
 ASN1ObjectID getModeID()
          Deprecated.  
 java.lang.String getPassword()
          Deprecated.  
 byte[] getSalt()
          Deprecated.  
 void input(java.io.InputStream is)
          Deprecated. Reconstructs this object by reading its DER encoding from the specified input stream.
 void inputAlgID(ASN1Sequence s)
          Deprecated.  
 void inputAlgID(java.io.InputStream is)
          Deprecated.  
 int length()
          Deprecated. Returns the length of this object's DER encoding.
static java.lang.String modeString(int mode)
          Deprecated.  
 void output(java.io.OutputStream os)
          Deprecated. Outputs the DER encoding of this object to the specified output stream.
 void outputAlgID(java.io.OutputStream os)
          Deprecated.  
 ASN1Sequence outputAlgIDASN1()
          Deprecated.  
static byte[] pkcs12PseudoRandomBytes(byte ID, int n, AlgorithmIdentifier hashType, java.lang.String passwd, byte[] salt, int count)
          Deprecated.  
 void setCount(int c)
          Deprecated.  
 void setMode(ASN1ObjectID oid)
          Deprecated.  
 void setMode(int m)
          Deprecated.  
 void setPassword(byte[] p)
          Deprecated.  
 void setPassword(java.lang.String p)
          Deprecated.  
 void setSalt(byte[] s)
          Deprecated.  
 java.lang.String toString()
          Deprecated. Returns a string representation of thie object.

 

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

 

Field Detail

NONE

public static final int NONE
Deprecated. 
Indicates that no encryption mode is set.
See Also:
Constant Field Values

MD2_DES

public static final int MD2_DES
Deprecated. 
Encryption mode identifier for MD2 with DES.
See Also:
Constant Field Values

MD5_DES

public static final int MD5_DES
Deprecated. 
Encryption mode identifier for MD5 with DES.
See Also:
Constant Field Values

SHA_128RC4

public static final int SHA_128RC4
Deprecated. 
Encryption mode identifier for SHA-1 with 128-bit RC4.
See Also:
Constant Field Values

SHA_40RC4

public static final int SHA_40RC4
Deprecated. 
Encryption mode identifier for SHA-1 with 40-bit RC4.
See Also:
Constant Field Values

SHA_3DES

public static final int SHA_3DES
Deprecated. 
Encryption mode identifier for SHA-1 with triple-DES.
See Also:
Constant Field Values

SHA_2DES

public static final int SHA_2DES
Deprecated. 
Encryption mode identifier for SHA-1 with two-key DES.
See Also:
Constant Field Values

SHA_128RC2

public static final int SHA_128RC2
Deprecated. 
Encryption mode identifier for SHA-1 with 128-bit RC2.
See Also:
Constant Field Values

SHA_40RC2

public static final int SHA_40RC2
Deprecated. 
Encryption mode identifier for SHA-1 with 40-bit RC2.
See Also:
Constant Field Values

DEFAULT_SALT_LEN

public static final int DEFAULT_SALT_LEN
Deprecated. 
Default password-based key derivation salt length is 8 bytes.
See Also:
Constant Field Values

DEFAULT_ITER_COUNT

public static final int DEFAULT_ITER_COUNT
Deprecated. 
Default password-based key derivation iteration count is 1024.
See Also:
Constant Field Values

Constructor Detail

PKCS5

public PKCS5()
Deprecated. 
Creates a new PKCS5 instance. The default parameters are:

PKCS5

public PKCS5(int m)
Deprecated. 
Creates a new PKCS5 instance with the given mode ID, and default iteration count and source of randomness.
Parameters:
m - The encryption mode ID.
See Also:
PKCS5()

PKCS5

public PKCS5(int m,
             int c,
             RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance.
Parameters:
m - The encryption mode ID.
c - The iteration count.
rbs - The source of randomness.

PKCS5

public PKCS5(int m,
             RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance with the given mode and source of randomness, and the default iteration count.
Parameters:
m - The encryption mode ID.
rbs - The source of randomness.
See Also:
PKCS5()

PKCS5

public PKCS5(RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance with the given source of randomness, and the default mode and iteration count.
Parameters:
rbs - The source of randomness.
See Also:
PKCS5()

PKCS5

public PKCS5(java.lang.String p,
             byte[] s,
             int c,
             int m)
Deprecated. 
Creates a new PKCS5 instance with the given password, salt, count and mode.
Parameters:
p - The password.
s - The salt.
c - The iteration count.
m - The encryption mode.

PKCS5

public PKCS5(java.lang.String p,
             byte[] s,
             int m)
Deprecated. 
Creates a new PKCS5 instance with the given password, salt and mode, and the default iteration count.
Parameters:
p - The password.
s - The salt.
m - The encryption mode.
See Also:
PKCS5()

PKCS5

public PKCS5(java.lang.String p,
             int m,
             int c,
             RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance with the given password, salt, count, mode and source of randomness.
Parameters:
p - The password.
m - The encryption mode.
c - The iteration count.
rbs - The source of randomness.

PKCS5

public PKCS5(java.lang.String p,
             int m,
             RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance with the given password, mode and source of randomness, and the default iteration count.
Parameters:
p - The password.
m - The encryption mode.
rbs - The source of randomness.
See Also:
PKCS5()

PKCS5

public PKCS5(java.lang.String p,
             RandomBitsSource rbs)
Deprecated. 
Creates a new PKCS5 instance with the given password and source of randomness, and the default mode and iteration count.
Parameters:
p - The password.
rbs - The source of randomness.
See Also:
PKCS5()

PKCS5

public PKCS5(byte[] p,
             byte[] s,
             int c,
             int m)
Deprecated. 
Creates a new PKCS5 instance with the given password, salt, count and mode.
Parameters:
p - The password.
s - The salt.
c - The iteration count.
m - The encryption mode.
Since:
SSLava 1.1.1

PKCS5

public PKCS5(byte[] p,
             byte[] s,
             int c)
Deprecated. 
Creates a new PKCS5 instance with the given password, salt and count, and MD5_DES encryption mode.
Parameters:
p - The password.
s - The salt.
c - The iteration count.
Since:
SSLava 1.1.1

Method Detail

encrypt

public byte[] encrypt(byte[] data)
               throws CipherException
Deprecated. 
Encrypt an array of bytes, and return the encrypted array of bytes.
Throws:
CipherException

pkcs12PseudoRandomBytes

public static byte[] pkcs12PseudoRandomBytes(byte ID,
                                             int n,
                                             AlgorithmIdentifier hashType,
                                             java.lang.String passwd,
                                             byte[] salt,
                                             int count)
                                      throws CipherException
Deprecated. 
Throws:
CipherException

decrypt

public byte[] decrypt(byte[] data)
               throws CipherException
Deprecated. 
Decrypt an array of bytes, and return the decrypted array of bytes.
Throws:
CipherException

encryptedLength

public int encryptedLength(int dataLen)
Deprecated. 

setMode

public void setMode(int m)
Deprecated. 

getMode

public int getMode()
Deprecated. 

setPassword

public void setPassword(java.lang.String p)
Deprecated. 

setPassword

public void setPassword(byte[] p)
Deprecated. 

getPassword

public java.lang.String getPassword()
Deprecated. 

setSalt

public void setSalt(byte[] s)
Deprecated. 

getSalt

public byte[] getSalt()
Deprecated. 

setCount

public void setCount(int c)
Deprecated. 

getCount

public int getCount()
Deprecated. 

setMode

public void setMode(ASN1ObjectID oid)
             throws java.io.IOException
Deprecated. 
Throws:
java.io.IOException

getModeID

public ASN1ObjectID getModeID()
Deprecated. 

outputAlgID

public void outputAlgID(java.io.OutputStream os)
                 throws java.io.IOException
Deprecated. 
Throws:
java.io.IOException

outputAlgIDASN1

public ASN1Sequence outputAlgIDASN1()
Deprecated. 

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Deprecated. 
Outputs the DER encoding of this object to the specified output stream.
Specified by:
output in interface Streamable
Parameters:
os - the output stream to which the object will be written
Throws:
java.io.IOException

inputAlgID

public void inputAlgID(java.io.InputStream is)
                throws java.io.IOException
Deprecated. 
Throws:
java.io.IOException

inputAlgID

public void inputAlgID(ASN1Sequence s)
                throws java.io.IOException
Deprecated. 
Throws:
java.io.IOException

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Deprecated. 
Reconstructs this object by reading its DER encoding from the specified input stream.
Specified by:
input in interface Streamable
Parameters:
is - the input stream from which this object will be read
Throws:
java.io.IOException

length

public int length()
Deprecated. 
Returns the length of this object's DER encoding.
Specified by:
length in interface Streamable
Returns:
the length of this object's DER encoding

algName

public java.lang.String algName()
Deprecated. 

modeString

public static java.lang.String modeString(int mode)
Deprecated. 

toString

public java.lang.String toString()
Deprecated. 
Returns a string representation of thie object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object

Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


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