From 90104b03b7c1319f4700be4dbaa63874af49b6b4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Feb 2014 19:45:28 +1100 Subject: [PATCH] Only allow key sizes of 16 in native cipher --- native/src/main/java/net/md_5/bungee/NativeCipher.java | 1 + 1 file changed, 1 insertion(+) diff --git a/native/src/main/java/net/md_5/bungee/NativeCipher.java b/native/src/main/java/net/md_5/bungee/NativeCipher.java index 10e15bf8..6d4c42c3 100644 --- a/native/src/main/java/net/md_5/bungee/NativeCipher.java +++ b/native/src/main/java/net/md_5/bungee/NativeCipher.java @@ -59,6 +59,7 @@ public class NativeCipher implements BungeeCipher @Override public void init(boolean forEncryption, SecretKey key) throws GeneralSecurityException { + Preconditions.checkArgument( key.getEncoded().length == 16, "Invalid key size" ); if ( pointer != 0 ) { nativeCipher.free( pointer );