org.mozilla.jss.pkcs11

Class PK11MessageDigest


public final class PK11MessageDigest
extends JSSMessageDigest

Message Digesting with PKCS #11.

Method Summary

int
digest(byte[] outbuf, int offset, int len)
Completes digesting, storing the result into the provided array.
DigestAlgorithm
getAlgorithm()
Returns the algorithm that this digest uses.
void
initHMAC(SymmetricKey key)
Initializes an HMAC digest with the given symmetric key.
void
reset()
Resets this digest for further use.
void
update(byte[] input, int offset, int len)
Updates the digest with a portion of an array.

Methods inherited from class org.mozilla.jss.crypto.JSSMessageDigest

digest, digest, digest, getAlgorithm, getOutputSize, initHMAC, reset, update, update, update

Method Details

digest

public int digest(byte[] outbuf,
                  int offset,
                  int len)
            throws DigestException
Completes digesting, storing the result into the provided array.
Overrides:
digest in interface JSSMessageDigest
Parameters:
offset - The offset in the buffer at which to store the output.
len - The amount of space available in the buffer for the digest output.
Returns:
The number of bytes actually stored into buf.

getAlgorithm

public DigestAlgorithm getAlgorithm()
Returns the algorithm that this digest uses.
Overrides:
getAlgorithm in interface JSSMessageDigest

initHMAC

public void initHMAC(SymmetricKey key)
            throws DigestException,
                   InvalidKeyException
Initializes an HMAC digest with the given symmetric key. This also has the effect of resetting the digest.
Overrides:
initHMAC in interface JSSMessageDigest

reset

public void reset()
            throws DigestException
Resets this digest for further use. This clears all input and output streams. If this is an HMAC digest, the HMAC key is not cleared.
Overrides:
reset in interface JSSMessageDigest

update

public void update(byte[] input,
                   int offset,
                   int len)
            throws DigestException
Updates the digest with a portion of an array.
Overrides:
update in interface JSSMessageDigest
Parameters:
input - An array from which to update the digest.
offset - The index in the array at which to start digesting.
len - The number of bytes to digest.