public interface MAC
This interface is a slimmed-down version of Mac
.
The library gets the implementation class from a configuration option (with the name of the algorithm as key) and then instantiates an object using the no-argument constructor. The algorithms to be used are negotiated during key exchange.
The library includes two implementations for each of the algorithms
hmac-sha1
, hmac-sha1-96
, hmac-md5
,
hmac-md5-96
, one based on JCE's Mac
class
(available in Java SE from 1.4 on) and another one done manually
(using MessageDigest
).
The latter ones are by default used on Mac OS X
, the former ones
on other systems.
Modifier and Type | Method and Description |
---|---|
void |
doFinal(byte[] buf,
int offset)
Finalizes the production of the digest,
producing the digest value.
|
int |
getBlockSize()
The size of the produced MAC, i.e. the digest length, in bytes.
|
String |
getName()
The name of the algorithm, as defined in RFC 4253.
|
void |
init(byte[] key)
Initializes the MAC, providing the key.
|
void |
update(byte[] foo,
int start,
int len)
Updates the MAC with some data.
|
void |
update(int foo)
Updates the MAC with 4 bytes of data.
|
String getName()
hmac-sha1
,
hmac-sha1-96
, hmac-md5
and hmac-md5-96
.int getBlockSize()
void init(byte[] key) throws Exception
Exception
void update(byte[] foo, int start, int len)
foo
- an array containing the data to authenticate.start
- the position in foo
where the data starts.len
- the length of the data.void update(int foo)
foo
- a 32 bit value, which will be interpreted as
4 bytes in big-endian order.void doFinal(byte[] buf, int offset)
buf
- an array to put the authentication code into.offset
- the position in buf
where the output
should begin.This is an inofficial Javadoc created by PaĆlo Ebermann. Have a look at the official homepage.