|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.crypto.HMACGenerator
net.i2p.crypto.HMAC256Generator
public class HMAC256Generator
Calculate the HMAC-SHA256 of a key+message. This is compatible with javax.crypto.Mac.getInstance("HmacSHA256"). As of 0.9.12, uses javax.crypto.Mac. Deprecated, used only by Syndie.
Field Summary |
---|
Fields inherited from class net.i2p.crypto.HMACGenerator |
---|
_available |
Constructor Summary | |
---|---|
HMAC256Generator(I2PAppContext context)
|
Method Summary | |
---|---|
protected I2PHMac |
acquire()
Deprecated. unused (not even by Syndie) |
Hash |
calculate(SessionKey key,
byte[] data)
Deprecated. unused (not even by Syndie) |
void |
calculate(SessionKey key,
byte[] data,
int offset,
int length,
byte[] target,
int targetOffset)
Calculate the HMAC of the data with the given key. |
boolean |
verify(SessionKey key,
byte[] curData,
int curOffset,
int curLength,
byte[] origMAC,
int origMACOffset,
int origMACLength)
Verify the MAC inline, reducing some unnecessary memory churn. |
Methods inherited from class net.i2p.crypto.HMACGenerator |
---|
acquireTmp, releaseTmp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HMAC256Generator(I2PAppContext context)
context
- unusedMethod Detail |
---|
protected I2PHMac acquire()
acquire
in class HMACGenerator
UnsupportedOperationException
- since 0.9.12public Hash calculate(SessionKey key, byte[] data)
calculate
in class HMACGenerator
UnsupportedOperationException
- alwayspublic void calculate(SessionKey key, byte[] data, int offset, int length, byte[] target, int targetOffset)
calculate
in class HMACGenerator
target
- out parameter the first 16 bytes contain the HMAC, the last 16 bytes are zerotargetOffset
- offset into target to put the hmac
UnsupportedOperationException
- if the JVM does not support it
IllegalArgumentException
- for bad key or target too smallpublic boolean verify(SessionKey key, byte[] curData, int curOffset, int curLength, byte[] origMAC, int origMACOffset, int origMACLength)
verify
in class HMACGenerator
key
- session key to verify the MAC withcurData
- MAC to verifycurOffset
- index into curData to MACcurLength
- how much data in curData do we want to run the HMAC overorigMAC
- what do we expect the MAC of curData to equalorigMACOffset
- index into origMACorigMACLength
- how much of the MAC do we want to verify, use 32 for HMAC256
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |