|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
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_COUNT Default password-based key derivation iteration count. |
static AlgorithmIdentifier |
DEFAULT_MAC Default password-based MAC algorithm is HMAC-SHA. |
static AlgorithmIdentifier |
DEFAULT_OWF Default password-based key derivation hash function is SHA-1. |
static int |
DEFAULT_SALT_LEN Default 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.AlgorithmIdentifierException
PBMacAlgID
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.AlgorithmIdentifierException
PBMacAlgID
Method Detail |
---|
public void setAlgID(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
PasswordBasedMAC
.setAlgID
in class MessageDigest
algID
- The algorithm identifier to use.AlgorithmIdentiferException
- If algID
does not identify a password-based MAC or if an error occurs processing the parameters.AlgorithmIdentifierException
PBMacAlgID
public 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 MessageDigest
java.lang.IllegalStateException
- If an error occurs constructing a new PBMacAlgID
using the parameters present in this PasswordBasedMAC
.PBMacAlgID
public void setSalt(byte[] salt)
salt
- The salt value to use for password-based key derivation.PBMacAlgID
public 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.AlgorithmIdentifierException
PBMacAlgID
public AlgorithmIdentifier getOwfAlgID()
null
if none is present.PBMacAlgID
public void setCount(int count)
count
- The iteration count to use for password-based key derivation.PBMacAlgID
public 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.PBMacAlgID
public AlgorithmIdentifier getMacAlgID()
null
if none is present.PBMacAlgID
public void setRandomBitsSource(RandomBitsSource rbs)
rbs
- The RNG to use for generating random salt bytes.PBMacAlgID
public void setPassword(byte[] password)
PasswordBasedMAC
.password
- The bytes of the password.public void init()
MessageDigest
init
in class MessageDigest
public int blockSize()
MessageDigest
blockSize
in class MessageDigest
public void update(byte b)
MessageDigest
update
in class MessageDigest
public void update(byte[] input, int off, int len)
MessageDigest
update
in class MessageDigest
input
- the input arrayoff
- start position in the input arraylen
- the number of input array elements to add to the data being digestedpublic void computeCurrent()
MessageDigest
MessageDigest.getDigestBits()
.computeCurrent
in class MessageDigest
public java.lang.String algName()
MessageDigest
algName
in class MessageDigest
public int getDigestLength()
MessageDigest
getDigestLength
in class MessageDigest
public byte[] getDigestBits()
getDigestBits
in class MessageDigest
public boolean isValid()
true
if this PasswordBasedMAC
is in a valid state and its digest bits are usable; otherwise returns false
.isValid
in class MessageDigest
public java.lang.Object clone()
MessageDigest
clone
in class MessageDigest
protected MessageDigest.MDState getState()
MessageDigest
getState
in class MessageDigest
protected void setState(MessageDigest.MDState state)
MessageDigest
setState
in class MessageDigest
|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |