File tree Expand file tree Collapse file tree
src/main/java/com/wolfssl/provider/jce Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1459,11 +1459,14 @@ private void checkCertificateChainMatchesPrivateKey(
14591459 if (pkcs8Key == null || pkcs8Key .length == 0 ) {
14601460 throw new KeyStoreException ("Bad PrivateKey PKCS#8 encoding" );
14611461 }
1462-
1463- match = X509CheckPrivateKey (derCert , pkcs8Key );
1464- if (!match ) {
1465- throw new KeyStoreException ("X509Certificate does not match " +
1466- "provided private key" );
1462+ try {
1463+ match = X509CheckPrivateKey (derCert , pkcs8Key );
1464+ if (!match ) {
1465+ throw new KeyStoreException ("X509Certificate does not match " +
1466+ "provided private key" );
1467+ }
1468+ } finally {
1469+ Arrays .fill (pkcs8Key , (byte )0 );
14671470 }
14681471 }
14691472
@@ -1986,7 +1989,7 @@ else if (entry.getValue() instanceof WKSSecretKey) {
19861989
19871990 log ("KeyStore successfully stored to OutputStream" );
19881991
1989- return ;
1992+ return ;
19901993 }
19911994
19921995 /**
You can’t perform that action at this time.
0 commit comments