public class PasswordBasedMacParameterSpec extends java.lang.Object implements java.security.spec.AlgorithmParameterSpec, ASN1Type
PBMParameter ::= SEQUENCE {
salt OCTET STRING,
owf AlgorithmIdentifier,
-- AlgId for a One-Way Function (SHA-1 recommended)
iterationCount INTEGER,
-- number of times the OWF is applied
mac AlgorithmIdentifier
-- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
-- or HMAC [RFC2104, RFC2202])
}
The process of using a PBMParameter to compute a password-based MAC consists of two stages. The first stage uses shared secret information (Entrust authentication code) to produce a MAC key. The second stage MACs the data in question using this MAC key to produce a MAC value.
Initialization of the first stage of the algorithm assumes the existence of a shared secret (Entrust authentication code) in a trusted fashion between CA/RA and end-entity. The salt value is appended to the shared secret and the one way function (owf) is applied iterationCount times, where the salted salted secret is the input to the first iteration and, for each successive iteration, the input is set to be the output of the previous iteration, yielding a key K.
In the second stage, K and the data are inputs to a MAC routine, which produces the MAC value.
| Constructor and Description |
|---|
PasswordBasedMacParameterSpec(ASN1Object obj)
Creates a
PasswordBasedMacParameterSpec object from an
ASN1Object. |
PasswordBasedMacParameterSpec(byte[] salt,
AlgorithmID owf,
int iterationCount,
AlgorithmID mac)
Creates a new
PasswordBasedMacParameterSpec object with the
specified components. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object obj)
Decodes a
PasswordBasedMacParameterSpec object from an
ASN1Object. |
int |
getIterationCount()
Returns the number of times to apply the owf.
|
AlgorithmID |
getMac()
Returns the mac algorithm.
|
AlgorithmID |
getOwf()
Returns the one-way function algorithm.
|
byte[] |
getSalt()
Returns the salt value.
|
void |
setIterationCount(int iterationCount)
Sets the number of times to apply the owf.
|
void |
setMac(AlgorithmID mac)
Sets the mac algorithm.
|
void |
setOwf(AlgorithmID owf)
Sets the one-way function algorithm.
|
void |
setSalt(byte[] salt)
Sets the salt value.
|
ASN1Object |
toASN1Object()
Encodes this
PasswordBasedMacParameterSpec object as an
ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
PasswordBasedMacParameterSpec object. |
public PasswordBasedMacParameterSpec(byte[] salt,
AlgorithmID owf,
int iterationCount,
AlgorithmID mac)
PasswordBasedMacParameterSpec object with the
specified components.
salt - the salt valueowf - the one-way function algorithmiterationCount - the number of times to apply the owfmac - the mac algorithmpublic PasswordBasedMacParameterSpec(ASN1Object obj) throws CodingException
PasswordBasedMacParameterSpec object from an
ASN1Object.
The ASN1Object must be a PasswordBasedMacParameterSpec
structure.
obj - the ASN.1 representation of a PBMParameter structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic byte[] getSalt()
public AlgorithmID getOwf()
public int getIterationCount()
public AlgorithmID getMac()
public void setSalt(byte[] salt)
salt - the salt componentpublic void setOwf(AlgorithmID owf)
owf - the owf componentpublic void setIterationCount(int iterationCount)
iterationCount - the iterationCount componentpublic void setMac(AlgorithmID mac)
mac - the mac componentpublic void decode(ASN1Object obj) throws CodingException
PasswordBasedMacParameterSpec object from an
ASN1Object.
The ASN1Object must be a PasswordBasedMacParameterSpec
structure.
decode in interface ASN1Typeobj - an ASN.1 representation of a PBMParameter structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic ASN1Object toASN1Object()
PasswordBasedMacParameterSpec object as an
ASN1Object.
toASN1Object in interface ASN1Typepublic java.lang.String toString()
PasswordBasedMacParameterSpec object.
toString in class java.lang.Object