java.lang.Object
net.i2p.router.message.GarlicMessageParser
Read a GarlicMessage, decrypt it, and return the resulting CloveSet. Thread-safe, does not contain any state. Public as it's now in the RouterContext.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context the parser runs in.private final LogLogger for this class.private static final intHuge limit just to reduce chance of trouble.Constructor Summary
ConstructorsMethod Summary
Public MethodsModifier and TypeMethodDescription(package private) CloveSetgetGarlicCloves(GarlicMessage message, PrivateKey encryptionKey, SessionKeyManager skm) Supports ELGAMAL_2048, ECIES_X25519, and PQ.(package private) CloveSetgetGarlicCloves(GarlicMessage message, PrivateKey elgKey, PrivateKey ecKey, SessionKeyManager skm) Supports both ELGAMAL_2048 and ECIES_X25519.readCloveSet(byte[] data, int offset) ElGamal only.
Field Details
_log
Logger for this class._context
The router context the parser runs in.MAX_CLOVES
private static final int MAX_CLOVESHuge limit just to reduce chance of trouble. Typ. usage is 3. As of 0.9.12. Was 255.- See Also:
Constructor Details
GarlicMessageParser
Create a garlic message parser.- Parameters:
context- the router context
Method Details
getGarlicCloves
Supports ELGAMAL_2048, ECIES_X25519, and PQ.- Parameters:
message- the garlic message to decryptencryptionKey- an ElGamal or ECIES_X25519 keyskm- use tags from this session key manager- Returns:
- null on error
getGarlicCloves
CloveSet getGarlicCloves(GarlicMessage message, PrivateKey elgKey, PrivateKey ecKey, SessionKeyManager skm) Supports both ELGAMAL_2048 and ECIES_X25519.- Parameters:
message- the garlic message to decryptelgKey- must be ElG OR PQ, non-nullecKey- must be EC, non-nullskm- use tags from this session key manager- Returns:
- null on error
readCloveSet
ElGamal only.- Parameters:
data- the raw data to read fromoffset- where in data to start- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException- if the data is malformed