JSS 3.1

org.mozilla.jss.pkcs12
Class MacData

java.lang.Object
  |
  +--org.mozilla.jss.pkcs12.MacData

public class MacData
extends java.lang.Object
implements ASN1Value


Inner Class Summary
static class MacData.Template
          A Template for decoding a MacData from its BER encoding.
 
Field Summary
private static int DEFAULT_ITERATIONS
           
private  DigestInfo mac
           
private  INTEGER macIterationCount
           
private  OCTET_STRING macSalt
           
private static int SALT_LENGTH
           
private static Tag TAG
           
private static MacData.Template templateInstance
           
 
Constructor Summary
MacData()
           
MacData(DigestInfo mac, OCTET_STRING macSalt, INTEGER macIterationCount)
          Creates a MacData from the given parameters.
MacData(Password password, byte[] macSalt, int iterations, byte[] toBeMACed)
          Creates a MacData by computing a HMAC on the given bytes.
 
Method Summary
 void encode(java.io.OutputStream ostream)
           
 void encode(Tag implicitTag, java.io.OutputStream ostream)
           
 DigestInfo getMac()
           
 INTEGER getMacIterationCount()
           
 OCTET_STRING getMacSalt()
           
 Tag getTag()
           
static MacData.Template getTemplate()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mac

private DigestInfo mac

macSalt

private OCTET_STRING macSalt

macIterationCount

private INTEGER macIterationCount

DEFAULT_ITERATIONS

private static final int DEFAULT_ITERATIONS

SALT_LENGTH

private static final int SALT_LENGTH

TAG

private static final Tag TAG

templateInstance

private static final MacData.Template templateInstance
Constructor Detail

MacData

public MacData()

MacData

public MacData(DigestInfo mac,
               OCTET_STRING macSalt,
               INTEGER macIterationCount)
Creates a MacData from the given parameters.
Parameters:
macIterationCount - 1 is the default and should be used for maximum compatibility. null can also be used, in which case the macIterationCount will be omitted from the structure (and the default value of 1 will be implied).

MacData

public MacData(Password password,
               byte[] macSalt,
               int iterations,
               byte[] toBeMACed)
        throws CryptoManager.NotInitializedException,
               java.security.DigestException,
               TokenException,
               java.io.CharConversionException
Creates a MacData by computing a HMAC on the given bytes. An HMAC is a message authentication code, which is a keyed digest. It proves not only that data has not been tampered with, but also that the entity that created the HMAC possessed the symmetric key.
Parameters:
password - The password used to generate a key using a PBE mechanism.
macSalt - The salt used as input to the PBE key generation mechanism. If null is passed in, new random salt will be created.
iterations - The iteration count for creating the PBE key.
toBeMACed - The data on which the HMAC will be computed.
Throws:
CryptoManager.NotInitializedException - If the crypto subsystem has not been initialized yet.
TokenException - If an error occurs on a crypto token.
Method Detail

getMac

public DigestInfo getMac()

getMacSalt

public OCTET_STRING getMacSalt()

getMacIterationCount

public INTEGER getMacIterationCount()

getTag

public Tag getTag()
Specified by:
getTag in interface ASN1Value

encode

public void encode(java.io.OutputStream ostream)
            throws java.io.IOException
Specified by:
encode in interface ASN1Value

encode

public void encode(Tag implicitTag,
                   java.io.OutputStream ostream)
            throws java.io.IOException
Specified by:
encode in interface ASN1Value

getTemplate

public static final MacData.Template getTemplate()

JSS 3.1