Skip to content

Commit 2e51748

Browse files
committed
JCE: zero WolfCryptMac.engineInit encodedKey buffer after use
1 parent 596fa9f commit 2e51748

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/com/wolfssl/provider/jce/WolfCryptMac.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import javax.crypto.MacSpi;
2525
import java.security.Key;
2626
import java.security.spec.AlgorithmParameterSpec;
27+
import java.util.Arrays;
2728
import java.security.InvalidKeyException;
2829
import java.security.InvalidAlgorithmParameterException;
2930
import java.security.NoSuchAlgorithmException;
@@ -232,6 +233,8 @@ protected void engineInit(Key key, AlgorithmParameterSpec params)
232233
}
233234
} catch (com.wolfssl.wolfcrypt.WolfCryptException e) {
234235
throw new InvalidKeyException("Invalid key: " + e.getMessage());
236+
} finally {
237+
Arrays.fill(encodedKey, (byte)0);
235238
}
236239

237240
log("init with key and spec");

0 commit comments

Comments
 (0)