use of i2p.bote.UniqueId in project i2p.i2p-bote by i2p.
the class UnencryptedEmailPacketTest method setUp.
@Before
public void setUp() throws Exception {
String message = "This is a test message. Test 1 2 3 Test";
byte[] content = message.getBytes();
byte[] messageIdBytes = new byte[] { -69, -24, -109, 1, 69, -122, -69, 113, -68, -90, 55, -28, 105, 97, 125, 70, 51, 58, 14, 2, -13, -53, 90, -29, 36, 67, 36, -94, -108, -125, 11, 123 };
UniqueId messageId = new UniqueId(messageIdBytes, 0);
int fragmentIndex = 0;
packet = new UnencryptedEmailPacket(new ByteArrayInputStream(content), messageId, fragmentIndex, I2PBotePacket.MAX_DATAGRAM_SIZE);
packet.setNumFragments(1);
}
use of i2p.bote.UniqueId in project i2p.i2p-bote by i2p.
the class ResponsePacketTest method createDataPacket.
private DataPacket createDataPacket() throws GeneralSecurityException, IOException {
byte[] dataToStore = new byte[] { 2, 109, -80, -37, -106, 83, -33, -39, -94, -76, -112, -98, 99, 25, -61, 44, -92, -85, 1, 10, -128, -2, -27, -86, -126, -33, -11, 42, 56, 3, -97, -101, 111, 7, -96, 25, 121, 74, 89, -40, -33, 82, -50, -18, 49, 106, 13, -121, 53, -83, -2, 35, -7, 71, -71, 26, 90, 1 };
byte[] messageIdBytes = new byte[] { -69, -24, -109, 1, 69, -122, -69, 113, -68, -90, 55, -28, 105, 97, 125, 70, 51, 58, 14, 2, -13, -53, 90, -29, 36, 67, 36, -94, -108, -125, 11, 123 };
UniqueId messageId = new UniqueId(messageIdBytes, 0);
int fragmentIndex = 0;
UnencryptedEmailPacket unencryptedPacket = new UnencryptedEmailPacket(new ByteArrayInputStream(dataToStore), messageId, fragmentIndex, I2PBotePacket.MAX_DATAGRAM_SIZE);
unencryptedPacket.setNumFragments(1);
EmailDestination destination = new EmailDestination("0XuJjhgp58aOhvHHgpaxoQYsCUfDS6BECMEoVxFGEFPdk3y8lbzIsq9eUyeizFleMacYwoscCir8nQLlW34lxfRmirkNpD9vU1XnmjnZ5hGdnor1qIDqz3KJ040dVQ617MwyG97xxYLT0FsH907vBXgdc4RCHwKd1~9siagA5CSMaA~wM8ymKXLypiZGYexENLmim7nMzJTQYoOM~fVS99UaGJleDBN3pgZ2EvRYDQV2VqKH7Gee07R3y7b~c0tAKVHS0IbPQfTVJigrIHjTl~ZczxpaeTM04T8IgxKnO~lSmR1w7Ik8TpEkETwT9PDwUqQsjmlSY8E~WwwGMRJVyIRZUkHeRZ0aFq7us8W9EKzYtjjiU1z0QFpZrTfJE8oqCbnH5Lqv5Q86UdTPpriJC1N99E77TpCTnNzcBnpp6ko2JCy2IJUveaigKxS6EmS9KarkkkBRsckOKZZ6UNTOqPZsBCsx0Q9WvDF-Uc3dtouXWyenxRptaQsdkZyYlEQv");
return new EncryptedEmailPacket(unencryptedPacket, destination);
}
use of i2p.bote.UniqueId in project i2p.i2p-bote by i2p.
the class IndexPacketDeleteRequestTest method setUp.
@Before
public void setUp() throws Exception {
Hash emailDestHash = new Hash(new byte[] { -48, 78, 66, 58, -79, 87, 38, -103, -60, -27, 108, 55, 117, 37, -99, 93, -23, -102, -83, 20, 44, -80, 65, 89, -68, -73, 69, 51, 115, 79, 24, 127 });
delRequest = new IndexPacketDeleteRequest(emailDestHash);
dhtKeys = new Hash[3];
delKeys = new UniqueId[3];
dhtKeys[0] = new Hash(new byte[] { 120, 120, -8, -88, 21, 126, 46, -61, 18, -101, 15, 53, 20, -44, -112, 42, 86, -117, 30, -96, -66, 33, 71, -55, -102, -78, 78, -82, -105, 66, -116, 43 });
delKeys[0] = new UniqueId(new byte[] { -62, -112, 99, -65, 13, 44, -117, -111, 96, 45, -6, 64, 78, 57, 117, 103, -24, 101, 106, -116, -18, 62, 99, -49, 60, -81, 8, 64, 27, -41, -104, 58 }, 0);
delRequest.put(dhtKeys[0], delKeys[0]);
dhtKeys[1] = new Hash(new byte[] { -69, -24, -109, 1, 69, -122, -69, 113, -68, -90, 55, -28, 105, 97, 125, 70, 51, 58, 14, 2, -13, -53, 90, -29, 36, 67, 36, -94, -108, -125, 11, 123 });
delKeys[1] = new UniqueId(new byte[] { -16, 67, 107, 80, 27, 65, 81, 71, 61, 70, -72, 126, 64, -10, 57, -128, 111, -107, -42, 24, -90, -4, -46, 63, 7, -6, 43, 76, -9, -81, 8, -68 }, 0);
delRequest.put(dhtKeys[1], delKeys[1]);
dhtKeys[2] = new Hash(new byte[] { -37, -8, 37, 82, -40, -34, 68, -51, -16, 74, 27, 89, 113, -15, 112, 69, 92, 102, 62, 111, 99, -27, -42, -71, 6, 38, 106, 121, 21, -72, -83, 3 });
delKeys[2] = new UniqueId(new byte[] { 6, -32, -23, 17, 55, 15, -45, -19, 91, 100, -76, -76, 118, -118, -53, -109, -108, 113, -112, 81, 117, 9, -126, 20, 0, -83, -89, 7, 48, 76, -58, 83 }, 0);
delRequest.put(dhtKeys[2], delKeys[2]);
}
use of i2p.bote.UniqueId in project i2p.i2p-bote by i2p.
the class IndexPacketTest method makeEmailPacket.
private EncryptedEmailPacket makeEmailPacket(String message) throws GeneralSecurityException, I2PSessionException, IOException {
byte[] content = message.getBytes();
byte[] messageIdBytes = new byte[] { 6, -32, -23, 17, 55, 15, -45, -19, 91, 100, -76, -76, 118, -118, -53, -109, -108, 113, -112, 81, 117, 9, -126, 20, 0, -83, -89, 7, 48, 76, -58, 83 };
UniqueId messageId = new UniqueId(messageIdBytes, 0);
int fragmentIndex = 0;
UnencryptedEmailPacket plaintextPacket = new UnencryptedEmailPacket(new ByteArrayInputStream(content), messageId, fragmentIndex, I2PBotePacket.MAX_DATAGRAM_SIZE);
plaintextPacket.setNumFragments(1);
return new EncryptedEmailPacket(plaintextPacket, identity);
}
use of i2p.bote.UniqueId in project i2p.i2p-bote by i2p.
the class IndexPacketDeleteRequest method toByteArray.
@Override
public byte[] toByteArray() {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
DataOutputStream dataStream = new DataOutputStream(byteStream);
try {
writeHeader(dataStream);
emailDestHash.writeBytes(dataStream);
dataStream.writeShort(entries.size());
for (Entry<Hash, UniqueId> entry : entries.entrySet()) {
dataStream.write(entry.getKey().toByteArray());
dataStream.write(entry.getValue().toByteArray());
}
} catch (DataFormatException e) {
log.error("Invalid format for email destination.", e);
} catch (IOException e) {
log.error("Can't write to ByteArrayOutputStream.", e);
}
return byteStream.toByteArray();
}
Aggregations