|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.PKCS5
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.
PrivateKeyPKCS8
, Serialized FormField Summary | |
static int |
DEFAULT_ITER_COUNT Default password-based key derivation iteration count is 1024. |
static int |
DEFAULT_SALT_LEN Default password-based key derivation salt length is 8 bytes. |
static int |
MD2_DES Encryption mode identifier for MD2 with DES. |
static int |
MD5_DES Encryption mode identifier for MD5 with DES. |
static int |
NONE Indicates that no encryption mode is set. |
static int |
SHA_128RC2 Encryption mode identifier for SHA-1 with 128-bit RC2. |
static int |
SHA_128RC4 Encryption mode identifier for SHA-1 with 128-bit RC4. |
static int |
SHA_2DES Encryption mode identifier for SHA-1 with two-key DES. |
static int |
SHA_3DES Encryption mode identifier for SHA-1 with triple-DES. |
static int |
SHA_40RC2 Encryption mode identifier for SHA-1 with 40-bit RC2. |
static int |
SHA_40RC4 Encryption mode identifier for SHA-1 with 40-bit RC4. |
Constructor Summary | |
PKCS5() Creates a new PKCS5 instance. |
|
PKCS5(byte[] p, byte[] s, int c) 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) Creates a new PKCS5 instance with the given password, salt, count and mode. |
|
PKCS5(int m) 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) Creates a new PKCS5 instance. |
|
PKCS5(int m, RandomBitsSource rbs) Creates a new PKCS5 instance with the given mode and source of randomness, and the default iteration count. |
|
PKCS5(RandomBitsSource rbs) 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) 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) Creates a new PKCS5 instance with the given password, salt, count and mode. |
|
PKCS5(java.lang.String p, int m, int c, RandomBitsSource rbs) 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) 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) 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() |
byte[] |
decrypt(byte[] data) Decrypt an array of bytes, and return the decrypted array of bytes. |
byte[] |
encrypt(byte[] data) Encrypt an array of bytes, and return the encrypted array of bytes. |
int |
encryptedLength(int dataLen) |
int |
getCount() |
int |
getMode() |
ASN1ObjectID |
getModeID() |
java.lang.String |
getPassword() |
byte[] |
getSalt() |
void |
input(java.io.InputStream is) Reconstructs this object by reading its DER encoding from the specified input stream. |
void |
inputAlgID(ASN1Sequence s) |
void |
inputAlgID(java.io.InputStream is) |
int |
length() Returns the length of this object's DER encoding. |
static java.lang.String |
modeString(int mode) |
void |
output(java.io.OutputStream os) Outputs the DER encoding of this object to the specified output stream. |
void |
outputAlgID(java.io.OutputStream os) |
ASN1Sequence |
outputAlgIDASN1() |
byte[] |
pad(byte[] bytes, int blockSize) Deprecated. |
static byte[] |
pkcs12PseudoRandomBytes(byte ID, int n, AlgorithmIdentifier hashType, java.lang.String passwd, byte[] salt, int count) |
void |
setCount(int c) |
void |
setMode(ASN1ObjectID oid) |
void |
setMode(int m) |
void |
setPassword(byte[] p) |
void |
setPassword(java.lang.String p) |
void |
setSalt(byte[] s) |
java.lang.String |
toString() Returns a string representation of thie object. |
byte[] |
unpad(byte[] bytes) Deprecated. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NONE
public static final int MD2_DES
public static final int MD5_DES
public static final int SHA_128RC4
public static final int SHA_40RC4
public static final int SHA_3DES
public static final int SHA_2DES
public static final int SHA_128RC2
public static final int SHA_40RC2
public static final int DEFAULT_SALT_LEN
public static final int DEFAULT_ITER_COUNT
Constructor Detail |
public PKCS5()
PKCS5
instance. The default parameters are:
public PKCS5(int m)
PKCS5
instance with the given mode ID, and default iteration count and source of randomness.m
- The encryption mode ID.PKCS5()
public PKCS5(int m, int c, RandomBitsSource rbs)
PKCS5
instance.m
- The encryption mode ID.c
- The iteration count.rbs
- The source of randomness.public PKCS5(int m, RandomBitsSource rbs)
PKCS5
instance with the given mode and source of randomness, and the default iteration count.m
- The encryption mode ID.rbs
- The source of randomness.PKCS5()
public PKCS5(RandomBitsSource rbs)
PKCS5
instance with the given source of randomness, and the default mode and iteration count.rbs
- The source of randomness.PKCS5()
public PKCS5(java.lang.String p, byte[] s, int c, int m)
PKCS5
instance with the given password, salt, count and mode.p
- The password.s
- The salt.c
- The iteration count.m
- The encryption mode.public PKCS5(java.lang.String p, byte[] s, int m)
PKCS5
instance with the given password, salt and mode, and the default iteration count.p
- The password.s
- The salt.m
- The encryption mode.PKCS5()
public PKCS5(java.lang.String p, int m, int c, RandomBitsSource rbs)
PKCS5
instance with the given password, salt, count, mode and source of randomness.p
- The password.m
- The encryption mode.c
- The iteration count.rbs
- The source of randomness.public PKCS5(java.lang.String p, int m, RandomBitsSource rbs)
PKCS5
instance with the given password, mode and source of randomness, and the default iteration count.p
- The password.m
- The encryption mode.rbs
- The source of randomness.PKCS5()
public PKCS5(java.lang.String p, RandomBitsSource rbs)
PKCS5
instance with the given password and source of randomness, and the default mode and iteration count.p
- The password.rbs
- The source of randomness.PKCS5()
public PKCS5(byte[] p, byte[] s, int c, int m)
PKCS5
instance with the given password, salt, count and mode.p
- The password.s
- The salt.c
- The iteration count.m
- The encryption mode.public PKCS5(byte[] p, byte[] s, int c)
PKCS5
instance with the given password, salt and count, and MD5_DES
encryption mode.p
- The password.s
- The salt.c
- The iteration count.Method Detail |
public byte[] pad(byte[] bytes, int blockSize) throws CipherException
CipherException
public byte[] unpad(byte[] bytes) throws CipherException
CipherException
public byte[] encrypt(byte[] data) throws CipherException
CipherException
public static byte[] pkcs12PseudoRandomBytes(byte ID, int n, AlgorithmIdentifier hashType, java.lang.String passwd, byte[] salt, int count) throws CipherException
CipherException
public byte[] decrypt(byte[] data) throws CipherException
CipherException
public int encryptedLength(int dataLen)
public void setMode(int m)
public int getMode()
public void setPassword(java.lang.String p)
public void setPassword(byte[] p)
public java.lang.String getPassword()
public void setSalt(byte[] s)
public byte[] getSalt()
public void setCount(int c)
public int getCount()
public void setMode(ASN1ObjectID oid) throws java.io.IOException
java.io.IOException
public ASN1ObjectID getModeID()
public void outputAlgID(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public ASN1Sequence outputAlgIDASN1()
public void output(java.io.OutputStream os) throws java.io.IOException
output
in interface Streamable
os
- the output stream to which the object will be writtenjava.io.IOException
public void inputAlgID(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public void inputAlgID(ASN1Sequence s) throws java.io.IOException
java.io.IOException
public void input(java.io.InputStream is) throws java.io.IOException
input
in interface Streamable
is
- the input stream from which this object will be readjava.io.IOException
public int length()
length
in interface Streamable
public java.lang.String algName()
public static java.lang.String modeString(int mode)
public java.lang.String toString()
|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |