|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.util.Message_digest_wrapper
public class Message_digest_wrapper
Wrap an java.security.MessageDigest
instance into an javacard.security.MessageDigest
interface. With this wrapper code that is shared between host and
card does not have to care about the different interfaces of
MessageDigest objects. The abstraction is achieved in the following
way: Shared code should declare its MessageDigest objects with MESSAGE_DIGEST,
which will expand to MessageDigest
on the
card and Message_digest_wrapper
on the host. New digest
objects can be created with Misc.get_message_digest()
. On the
host this will return an instance of this class.
This class is only for SHA-1 160 bit digests.
Field Summary | |
---|---|
private MessageDigest |
digest
The wrapped MessageDigest instance. |
Constructor Summary | |
---|---|
Message_digest_wrapper()
Create an instance that wraps a SHA-1 160 bit message digest object. |
Method Summary | |
---|---|
void |
doFinal(byte[] in_buff,
short in_off,
short in_len,
byte[] out_buff,
short out_off)
Fed the digest with in_len bytes from in_buff ,
starting at in_off . |
void |
update(byte[] in_buf,
short offset,
short len)
Fed the digest with len bytes from in_buf ,
starting at offset . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private MessageDigest digest
MessageDigest
instance.
Constructor Detail |
---|
public Message_digest_wrapper()
Method Detail |
---|
public void update(byte[] in_buf, short offset, short len)
len
bytes from in_buf
,
starting at offset
.
in_buf
- data bufferoffset
- starting offset in in_buf
len
- number of bytes to digestjavacard.security.MessageDigest.update
,
java.security.MessageDigest.update
public void doFinal(byte[] in_buff, short in_off, short in_len, byte[] out_buff, short out_off)
in_len
bytes from in_buff
,
starting at in_off
. Afterwards finish the hash
computation and copy the digest into out_buff
at index
out_off
.
If there is not enough place in out_buff
(less then 20
bytes starting at out_off
) an IndexOutOfBoundsException
is thrown.
in_buff
- data bufferin_off
- starting offset in in_buf
in_len
- number of bytes to digestout_buff
- buffer for the digestout_off
- starting index to copy the result digest to
IndexOutOfBoundsException
- if there is not enough place
in out_buff
javacard.security.MessageDigest.doFinal
,
java.security.MessageDigest.update
,
java.security.MessageDigest.digest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |