Skip to content

Commit 363156a

Browse files
committed
Removed call to deprecated CryptoHelper.computeDerivedKey() method.
1 parent 051d742 commit 363156a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test/java/org/owasp/esapi/crypto/CipherTextTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ public final void testMIC() {
191191
encryptor.init(Cipher.ENCRYPT_MODE, key, ivSpec);
192192
byte[] raw = encryptor.doFinal("This is my secret message!!!".getBytes("UTF8"));
193193
CipherText ciphertext = new CipherText(cipherSpec, raw);
194-
// TODO: Replace this w/ call to KeyDerivationFunction as this is
195-
// deprecated! Shame on me!
196-
SecretKey authKey = CryptoHelper.computeDerivedKey(key, key.getEncoded().length * 8, "authenticity");
194+
KeyDerivationFunction kdf = new KeyDerivationFunction( KeyDerivationFunction.PRF_ALGORITHMS.HmacSHA1 );
195+
SecretKey authKey = kdf.computeDerivedKey(key, key.getEncoded().length * 8, "authenticity");
197196
ciphertext.computeAndStoreMAC( authKey );
198197
// System.err.println("Original ciphertext being serialized: " + ciphertext);
199198
byte[] serializedBytes = ciphertext.asPortableSerializedByteArray();

0 commit comments

Comments
 (0)