From ff392fee1454773094f08242fa8a82263f1a3976 Mon Sep 17 00:00:00 2001 From: jrandom Date: Sat, 3 Jul 2004 19:41:41 +0000 Subject: [PATCH] properly fake-encrypt the data (this class is only used by the simulator or anything else w/ -Di2p.encryption=off) --- core/java/src/net/i2p/crypto/AESEngine.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/crypto/AESEngine.java b/core/java/src/net/i2p/crypto/AESEngine.java index 4f703340b..206407014 100644 --- a/core/java/src/net/i2p/crypto/AESEngine.java +++ b/core/java/src/net/i2p/crypto/AESEngine.java @@ -45,7 +45,11 @@ public class AESEngine { if ((initializationVector == null) || (payload == null) || (sessionKey == null) || (initializationVector.length != 16)) return null; - byte cyphertext[] = new byte[payload.length + (16 - (payload.length % 16))]; + byte cyphertext[] = null; + if ((payload.length % 16) == 0) + cyphertext = new byte[payload.length]; + else + cyphertext = new byte[payload.length + (16 - (payload.length % 16))]; System.arraycopy(payload, 0, cyphertext, 0, payload.length); return cyphertext; }