|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1.9) E56315-01 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
oracle.security.crypto.core.MessageDigest
oracle.security.crypto.core.PasswordBasedMAC
public class PasswordBasedMAC
The password-base MAC algorithm, as defined in CRMF (RFC 2511). Supports HMAC-SHA1 and HMAC-MD5 for the underlying keyed MAC algorithm.
PBMacAlgID| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class oracle.security.crypto.core.MessageDigest |
|---|
MessageDigest.MDState |
| Field Summary | |
|---|---|
static int |
DEFAULT_ITER_COUNTDefault password-based key derivation iteration count. |
static AlgorithmIdentifier |
DEFAULT_MACDefault password-based MAC algorithm is HMAC-SHA. |
static AlgorithmIdentifier |
DEFAULT_OWFDefault password-based key derivation hash function is SHA-1. |
static int |
DEFAULT_SALT_LENDefault password-based key derivation salt length. |
| Fields inherited from class oracle.security.crypto.core.MessageDigest |
|---|
algID |
| Constructor Summary | |
|---|---|
PasswordBasedMAC()Creates a new PasswordBasedMAC instance. |
|
PasswordBasedMAC(AlgorithmIdentifier algID, byte[] password)Creates a new PasswordBasedMAC instance with the given algorithm identifier and password. |
|
PasswordBasedMAC(AlgorithmIdentifier algID, byte[] password, RandomBitsSource rbs)Creates a new PasswordBasedMAC instance with the given algorithm identifier and password. |
|
PasswordBasedMAC(byte[] password)Creates a new PasswordBasedMAC instance with the given password. |
|
| Method Summary | |
|---|---|
java.lang.String |
algName()Returns the algorithm name of this message digest. |
int |
blockSize()Returns the blocksize of this instance. |
java.lang.Object |
clone()Returns a clone of this message digest object. |
void |
computeCurrent()Completes the hash computation, performing any necessary operations such as padding. |
AlgorithmIdentifier |
getAlgID()Returns the algorithm identifier for this PasswordBasedMAC. |
int |
getCount()Returns the iteration count to use for password-based key derivation. |
byte[] |
getDigestBits()Returns a copy of the current digest bytes. |
int |
getDigestLength()Returns the length in bytes of the message digest. |
AlgorithmIdentifier |
getMacAlgID()Returns the keyed MAC algorithm to use. |
AlgorithmIdentifier |
getOwfAlgID()Returns the one-way (hash) function to use for password-based key derivation. |
byte[] |
getSalt()Gets the salt value used in this PasswordBasedMAC. |
protected MessageDigest.MDState |
getState()Gets the state of this MessageDigest instance. |
void |
init()Resets this message digest object to its initial state. |
boolean |
isValid()Returns true if this PasswordBasedMAC is in a valid state and its digest bits are usable; otherwise returns false. |
void |
setAlgID(AlgorithmIdentifier algID)Sets the algorithm identifier for this PasswordBasedMAC. |
void |
setCount(int count)Sets the iteration count to use for password-based key derivation. |
void |
setMacAlgID(AlgorithmIdentifier macAlgID)Sets the keyed MAC algorithm to use. |
void |
setOwfAlgID(AlgorithmIdentifier owfAlgID)Sets the one-way (hash) function to use for password-based key derivation. |
void |
setPassword(byte[] password)Sets the password to be used for this PasswordBasedMAC. |
void |
setRandomBitsSource(RandomBitsSource rbs)Sets the RNG to use for generating random salt bytes, if needed. |
void |
setSalt(byte[] salt)Sets the salt value. |
protected void |
setState(MessageDigest.MDState state)Sets the state of this MessageDigest instance. |
void |
update(byte b)Adds the specifed byte to the data being digested. |
void |
update(byte[] input, int off, int len)Adds the specified sequence of bytes to the data being digested. |
| Methods inherited from class oracle.security.crypto.core.MessageDigest |
|---|
computeDigest, computeDigest, getInstance, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCII |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SALT_LEN
PKCS5.DEFAULT_SALT_LEN, Constant Field Valuespublic static final AlgorithmIdentifier DEFAULT_OWF
public static final int DEFAULT_ITER_COUNT
PKCS5.DEFAULT_ITER_COUNT, Constant Field Valuespublic static final AlgorithmIdentifier DEFAULT_MAC
| Constructor Detail |
|---|
public PasswordBasedMAC()
PasswordBasedMAC instance.
public PasswordBasedMAC(byte[] password)
throws AlgorithmIdentifierException
PasswordBasedMAC instance with the given password. The default algorithm identifier AlgID.PasswordBasedMac will be used.
password - The password to use.AlgorithmIdentiferException - If algID does not identify a password-based MAC or if an error occurs processing the parameters.AlgorithmIdentifierException
public PasswordBasedMAC(AlgorithmIdentifier algID,
byte[] password)
throws AlgorithmIdentifierException
PasswordBasedMAC instance with the given algorithm identifier and password.
algID - The algorithm identifier to use.password - The password to use.AlgorithmIdentiferException - If algID does not identify a password-based MAC or if an error occurs processing the parameters.AlgorithmIdentifierExceptionPBMacAlgID
public PasswordBasedMAC(AlgorithmIdentifier algID,
byte[] password,
RandomBitsSource rbs)
throws AlgorithmIdentifierException
PasswordBasedMAC instance with the given algorithm identifier and password. Use this constructor if algID does not contain parameters; the given RandomBitsSource will be used to generate the salt bytes.
algID - The algorithm identifier to use.password - The password to use.rbs - The RNG to use for generating the salt bytes.AlgorithmIdentiferException - If algID does not identify a password-based MAC or if an error occurs processing the parameters.AlgorithmIdentifierExceptionPBMacAlgID| Method Detail |
|---|
public void setAlgID(AlgorithmIdentifier algID)
throws AlgorithmIdentifierException
PasswordBasedMAC.setAlgID in class MessageDigestalgID - The algorithm identifier to use.AlgorithmIdentiferException - If algID does not identify a password-based MAC or if an error occurs processing the parameters.AlgorithmIdentifierExceptionPBMacAlgIDpublic AlgorithmIdentifier getAlgID()
PasswordBasedMAC.
If all of the parameter fields (salt, one-way function algorithm, iteration count and MAC algorithm) are defined (or defaults can be used and/or generated), then a new PBMacAlgID containing the parameters is returned; otherwise a PBMacAlgID with no parameters is returned.
getAlgID in class MessageDigestjava.lang.IllegalStateException - If an error occurs constructing a new PBMacAlgID using the parameters present in this PasswordBasedMAC.PBMacAlgIDpublic void setSalt(byte[] salt)
salt - The salt value to use for password-based key derivation.PBMacAlgIDpublic byte[] getSalt()
PasswordBasedMAC.null is none is present.PBMacAlgID
public void setOwfAlgID(AlgorithmIdentifier owfAlgID)
throws AlgorithmIdentifierException
owfAlgID - The algorithm identifier for the password-based key derivation one-way (hash) function.AlgorithmIdentifierExceptionPBMacAlgIDpublic AlgorithmIdentifier getOwfAlgID()
null if none is present.PBMacAlgIDpublic void setCount(int count)
count - The iteration count to use for password-based key derivation.PBMacAlgIDpublic int getCount()
PBMacAlgID
public void setMacAlgID(AlgorithmIdentifier macAlgID)
throws AlgorithmIdentifierException
macAlgID - The algorithm identifier for the keyed MAC algorithm.AlgorithmIdentifierException - If macAlgID does not identify a a supported MAC algorithm.PBMacAlgIDpublic AlgorithmIdentifier getMacAlgID()
null if none is present.PBMacAlgIDpublic void setRandomBitsSource(RandomBitsSource rbs)
rbs - The RNG to use for generating random salt bytes.PBMacAlgIDpublic void setPassword(byte[] password)
PasswordBasedMAC.password - The bytes of the password.public void init()
MessageDigestinit in class MessageDigestpublic int blockSize()
MessageDigestblockSize in class MessageDigestpublic void update(byte b)
MessageDigestupdate in class MessageDigest
public void update(byte[] input,
int off,
int len)
MessageDigestupdate in class MessageDigestinput - the input arrayoff - start position in the input arraylen - the number of input array elements to add to the data being digestedpublic void computeCurrent()
MessageDigestMessageDigest.getDigestBits().computeCurrent in class MessageDigestpublic java.lang.String algName()
MessageDigestalgName in class MessageDigestpublic int getDigestLength()
MessageDigestgetDigestLength in class MessageDigestpublic byte[] getDigestBits()
getDigestBits in class MessageDigestpublic boolean isValid()
true if this PasswordBasedMAC is in a valid state and its digest bits are usable; otherwise returns false.isValid in class MessageDigestpublic java.lang.Object clone()
MessageDigestclone in class MessageDigestprotected MessageDigest.MDState getState()
MessageDigestgetState in class MessageDigestprotected void setState(MessageDigest.MDState state)
MessageDigestsetState in class MessageDigest
|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1.9) E56315-01 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||