|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.MessageDigestSpi | +--java.security.MessageDigest | +--iaik.utils.PretendedMessageDigest
This class pretends to be a MessageDigest engine.
This class does not actually compute a message digest value. Calling one of the
update
methods only will write the supplied data to a internal
buffer. Calling the final digest
method only will return the
contents of this buffer; no digest computation ever has been performed.
Intended purpose of this class is to allow usage of MessageDigest engines
with raw signature engines where the MessageDigest value already has been
calculated outside the Signature engine and therefore no digest computation has
to be done by the Signature engine´s internal digest machine.
Since this class does not (cannot) know the hash algorithm actually used
for hashing the data an application has to take care to provide a proper
hash value when calling an update
method; no check is (can be)
performed if the supplied hash value corresponds to the hash algorithm
in use (e.g. has the correct length).
Constructor Summary | |
PretendedMessageDigest()
Default constructor. |
|
PretendedMessageDigest(String name,
int digestLength)
Creates a PretendedMessageDigest engine with given name and digest length. |
Method Summary | |
Object |
clone()
Returns a clone of this object. |
protected byte[] |
engineDigest()
Returns the final digest value. |
int |
engineGetDigestLength()
SPI: Returns the length of the digest in bytes. |
protected void |
engineReset()
Resets the buffer. |
protected void |
engineUpdate(byte input)
SPI: Updates the internal buffer with the specified byte. |
protected void |
engineUpdate(byte[] input,
int offset,
int len)
SPI: Updates the internal buffer with the specified number of bytes, beginning at the specified offset within the given byte array. |
Methods inherited from class java.security.MessageDigest |
digest, digest, digest, getAlgorithm, getDigestLength, getInstance, getInstance, getProvider, isEqual, reset, toString, update, update, update |
Methods inherited from class java.security.MessageDigestSpi |
engineDigest |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PretendedMessageDigest()
public PretendedMessageDigest(String name, int digestLength)
name
- the name of the digest algorithm this class representsdigestLength
- the length of the digest value produce by this engineMethod Detail |
protected final void engineUpdate(byte input)
engineUpdate
in class MessageDigestSpi
input
- the byte to be written to the internal bufferprotected final void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class MessageDigestSpi
input
- the byte array holding the data to be used for this update
operation.offset
- the offset, indicating the start position within the given
byte array.len
- the number of bytes to be obtained from the given byte array,
starting at the given position.protected byte[] engineDigest()
engineDigest
in class MessageDigestSpi
public int engineGetDigestLength()
digest
already has been
called. Otherwise this method may return 0.engineGetDigestLength
in class MessageDigestSpi
protected void engineReset()
engineReset
in class MessageDigestSpi
public Object clone()
clone
in class MessageDigest
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |