public void performTest() throws Exception { super.performTest(); byte[] keyBytes = new byte[16]; _engine.init(true, new KeyParameter(keyBytes)); // // init tests // try { byte[] dudKey = new byte[6]; _engine.init(true, new KeyParameter(dudKey)); fail("failed key length check"); } catch (IllegalArgumentException e) { // expected } try { byte[] iv = new byte[16]; _engine.init(true, new ParametersWithIV(null, iv)); fail("failed parameter check"); } catch (IllegalArgumentException e) { // expected } testNullCBC(); testNullSIC(); testNullOFB(); testNullCFB(); }
/** * Dekodiert einen Block mit DES * * @param key Byte-Array enthält den 3DES-Schlüssel * @param z verschlüsselter Block * @return entschlüsselter block */ @Override public byte[] decryptBlock(byte[] key, byte[] z) { byte[] s = new byte[16]; KeyParameter encKey = new KeyParameter(key); BlockCipher cipher = new DESedeEngine(); cipher.init(false, encKey); cipher.processBlock(z, 0, s, 0); return s; }