Only allow key sizes of 16 in native cipher

This commit is contained in:
md_5 2014-02-12 19:45:28 +11:00
parent a9b2660aa8
commit 90104b03b7

View File

@ -59,6 +59,7 @@ public class NativeCipher implements BungeeCipher
@Override @Override
public void init(boolean forEncryption, SecretKey key) throws GeneralSecurityException public void init(boolean forEncryption, SecretKey key) throws GeneralSecurityException
{ {
Preconditions.checkArgument( key.getEncoded().length == 16, "Invalid key size" );
if ( pointer != 0 ) if ( pointer != 0 )
{ {
nativeCipher.free( pointer ); nativeCipher.free( pointer );