public abstract class CapiDigest
extends java.security.MessageDigest
An MS-CAPI based message digest algorithm instance can be obtained using the
Java Cryptography Architecture (JCA), by requesting the '<algorithm>'
algorithm from the Entrust cryptographic service provider. This can be done using the following
call:
Message.getInstance("<algorithm>", "Entrust");MessageDigest.getInstance() is called. A message digest in CAPI
is associated with a Cryptographic Service Provider (CSP), so a handle to
provider is required. This must be set with a call to
createCapiHash() before any of the engine methods are called.
Also, the CAPI hash object returned by getHash() must be
explicitly closed after the digesting procedure is completed.reset method is not currently supported, a new digest
instance must be obtained for each digest computation.Signature classes included with the Toolkit will handle this
automatically, so there should be no need to explicitly use CAPI to calculate
a message digest.| Modifier and Type | Method and Description |
|---|---|
void |
closeHash()
Closes any open handles to native CAPI objects referenced by this hash
object.
|
void |
createCapiHash(CryptProvider provider)
Create the internal native CAPI hasher.
|
protected byte[] |
engineDigest()
Completes the hash computation by performing final operations such as
padding.
|
protected int |
engineGetDigestLength()
Returns the digest length in bytes.
|
protected void |
engineReset()
Resets the digest for further use.
|
protected void |
engineUpdate(byte input)
Updates the digest using the specified byte.
|
protected void |
engineUpdate(byte[] input,
int offset,
int length)
Updates the digest using the specified array of bytes, starting at the
specified offset.
|
CryptHash |
getHash()
Returns a reference to the internal CAPI hasher.
|
public final CryptHash getHash()
public void closeHash()
public void createCapiHash(CryptProvider provider) throws CapiException
provider - [FIPS 140-2 control output] the CAPI CSP which will provide
the native hashing capability.CapiException - [FIPS 140-2 status output] if the hashing algorithm is not
SHA1 or MD5, or if the CSP does not support the hash
algorithm.protected void engineUpdate(byte input)
engineUpdate in class java.security.MessageDigestSpiinput - [FIPS 140-2 data input] the byte to use for the update.protected void engineUpdate(byte[] input,
int offset,
int length)
engineUpdate in class java.security.MessageDigestSpiinput - [FIPS 140-2 data input] the array of bytes to use for the
update.offset - [FIPS 140-2 data input] the offset to start from in the array
of bytes.len - [FIPS 140-2 data input] the number of bytes to use, starting
at offset.protected byte[] engineDigest()
engineDigest has been called, the engine
should be reset (see engineReset). Resetting is
the responsibility of the engine implementor.
engineDigest in class java.security.MessageDigestSpiFips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected void engineReset()
engineReset in class java.security.MessageDigestSpiprotected final int engineGetDigestLength()
engineGetDigestLength in class java.security.MessageDigestSpiFips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operations