From 23a0c657fae11ec03fccae8a665141ba68142d5d Mon Sep 17 00:00:00 2001 From: "sandeep.konchady%sun.com" Date: Fri, 2 Sep 2005 22:48:46 +0000 Subject: [PATCH] Added Password.clear() and PBEKeyGenParams.clear() so that the objects are released when GC tries to collect them. git-svn-id: svn://10.0.0.236/trunk@179587 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/jss/org/mozilla/jss/tests/DigestTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mozilla/security/jss/org/mozilla/jss/tests/DigestTest.java b/mozilla/security/jss/org/mozilla/jss/tests/DigestTest.java index 01aa86dbc41..5ecd8e4689b 100644 --- a/mozilla/security/jss/org/mozilla/jss/tests/DigestTest.java +++ b/mozilla/security/jss/org/mozilla/jss/tests/DigestTest.java @@ -107,15 +107,18 @@ public class DigestTest { ///////////////////////////////////////////////////////////// CryptoManager cm = CryptoManager.getInstance(); CryptoToken token = cm.getInternalCryptoToken(); + Password pass = new Password("password".toCharArray()); byte[] salt = { 0, 1, 2, 3,4 ,5 ,6 ,7 }; PBEKeyGenParams pbe = new PBEKeyGenParams( - new Password("password".toCharArray()), + pass, salt, 1 ); + pass.clear(); KeyGenerator kg = token.getKeyGenerator( PBEAlgorithm.PBE_SHA1_DES3_CBC ); kg.initialize(pbe); SymmetricKey symkey = kg.generate(); + pbe.clear(); org.mozilla.jss.crypto.JSSMessageDigest digest = token.getDigestContext( HMACAlgorithm.SHA1 ); digest.initHMAC(symkey);