Skip to content

Commit

Permalink
add back private key clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
wangweij committed Jan 31, 2025
1 parent b24065d commit 2568238
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ protected byte[][] implGenerateKeyPair(String name, SecureRandom sr) {
r.nextBytes(seed);
ML_DSA mlDsa = new ML_DSA(name2int(name));
ML_DSA.ML_DSA_KeyPair kp = mlDsa.generateKeyPairInternal(seed);
return new byte[][]{
mlDsa.pkEncode(kp.publicKey()),
seed,
mlDsa.skEncode(kp.privateKey())
};
try {
return new byte[][]{
mlDsa.pkEncode(kp.publicKey()),
seed,
mlDsa.skEncode(kp.privateKey())
};
} finally {
kp.privateKey().destroy();
}
}
}

Expand Down

0 comments on commit 2568238

Please sign in to comment.