public final class ElGamalAESEngine
extends java.lang.Object
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static int |
MAX_TAGS_RECEIVED |
enforced since release 0.6
|
コンストラクタ | 説明 |
---|---|
ElGamalAESEngine(I2PAppContext ctx) |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
byte[] |
decrypt(byte[] data,
PrivateKey targetPrivateKey) |
推奨されていません。
specify the key manager!
|
byte[] |
decrypt(byte[] data,
PrivateKey targetPrivateKey,
SessionKeyManager keyManager) |
Decrypt the message using the given private key
and using tags from the specified key manager.
|
(package private) byte[] |
decryptAESBlock(byte[] encrypted,
int offset,
int encryptedLen,
SessionKey key,
byte[] iv,
byte[] sentTag,
java.util.Set<SessionTag> foundTags,
SessionKey foundKey) |
private byte[] decryptAESBlock(byte encrypted[], SessionKey key, byte iv[],
byte sentTag[], Set foundTags, SessionKey foundKey) throws DataFormatException {
return decryptAESBlock(encrypted, 0, encrypted.length, key, iv, sentTag, foundTags, foundKey);
}
|
byte[] |
encrypt(byte[] data,
PublicKey target,
SessionKey key,
long paddedSize) |
推奨されていません。
unused
|
byte[] |
encrypt(byte[] data,
PublicKey target,
SessionKey key,
java.util.Set<SessionTag> tagsForDelivery,
long paddedSize) |
推奨されていません。
unused
|
byte[] |
encrypt(byte[] data,
PublicKey target,
SessionKey key,
java.util.Set<SessionTag> tagsForDelivery,
SessionTag currentTag,
long paddedSize) |
Encrypt the data to the target using the given key and deliver the specified tags
No new session key
This is the one called from GarlicMessageBuilder and is the primary entry point.
|
byte[] |
encrypt(byte[] data,
PublicKey target,
SessionKey key,
java.util.Set<SessionTag> tagsForDelivery,
SessionTag currentTag,
SessionKey newKey,
long paddedSize) |
Encrypt the unencrypted data to the target.
|
(package private) byte[] |
encryptAESBlock(byte[] data,
SessionKey key,
byte[] iv,
java.util.Set<SessionTag> tagsForDelivery,
SessionKey newKey,
long paddedSize) |
For both scenarios, this method encrypts the AES area using the given key, iv
and making sure the resulting data is at least as long as the paddedSize and
also mod 16 bytes.
|
(package private) static byte[] |
getPadding(I2PAppContext context,
int curSize,
long minPaddedSize) |
Return random bytes for padding the data to a mod 16 size so that it is
at least minPaddedSize
|
(package private) static int |
getPaddingSize(int curSize,
long minPaddedSize) |
public static final int MAX_TAGS_RECEIVED
public ElGamalAESEngine(I2PAppContext ctx)
public byte[] decrypt(byte[] data, PrivateKey targetPrivateKey) throws DataFormatException
public byte[] decrypt(byte[] data, PrivateKey targetPrivateKey, SessionKeyManager keyManager) throws DataFormatException
DataFormatException
byte[] decryptAESBlock(byte[] encrypted, int offset, int encryptedLen, SessionKey key, byte[] iv, byte[] sentTag, java.util.Set<SessionTag> foundTags, SessionKey foundKey) throws DataFormatException
public byte[] encrypt(byte[] data, PublicKey target, SessionKey key, java.util.Set<SessionTag> tagsForDelivery, SessionTag currentTag, SessionKey newKey, long paddedSize)
target
- public key to which the data should be encrypted.key
- session key to use during encryptiontagsForDelivery
- session tags to be associated with the key (or newKey if specified), or null;
200 max enforced at receivercurrentTag
- sessionTag to use, or null if it should use ElG (i.e. new session)newKey
- key to be delivered to the target, with which the tagsForDelivery should be associated, or nullpaddedSize
- minimum size in bytes of the body after padding it (if less than the
body's real size, no bytes are appended but the body is not truncated)
Unused externally, only called by below (i.e. newKey is always null)public byte[] encrypt(byte[] data, PublicKey target, SessionKey key, java.util.Set<SessionTag> tagsForDelivery, SessionTag currentTag, long paddedSize)
target
- public key to which the data should be encrypted.key
- session key to use during encryptiontagsForDelivery
- session tags to be associated with the key or null;
200 max enforced at receivercurrentTag
- sessionTag to use, or null if it should use ElG (i.e. new session)paddedSize
- minimum size in bytes of the body after padding it (if less than the
body's real size, no bytes are appended but the body is not truncated)public byte[] encrypt(byte[] data, PublicKey target, SessionKey key, java.util.Set<SessionTag> tagsForDelivery, long paddedSize)
tagsForDelivery
- session tags to be associated with the key or null;
200 max enforced at receiverpublic byte[] encrypt(byte[] data, PublicKey target, SessionKey key, long paddedSize)
final byte[] encryptAESBlock(byte[] data, SessionKey key, byte[] iv, java.util.Set<SessionTag> tagsForDelivery, SessionKey newKey, long paddedSize)
- 2 byte integer specifying the # of session tags - that many 32 byte session tags - 4 byte integer specifying data.length - SHA256 of data - 1 byte flag that, if == 1, is followed by a new SessionKey - data - random bytes, padding the total size to greater than paddedSize with a mod 16 = 0Note: package private for ElGamalTest.testAES()
tagsForDelivery
- session tags to be associated with the key or null;
200 max enforced at receiverstatic final byte[] getPadding(I2PAppContext context, int curSize, long minPaddedSize)
static final int getPaddingSize(int curSize, long minPaddedSize)