Skip to content

Commit

Permalink
Increase default iteration count to 4096 for PBE PEM
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Jan 29, 2024
1 parent 688173f commit 6a275a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion convex-core/src/main/java/convex/core/crypto/PEMTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ public static String encryptPrivateKeyToPEM(PrivateKey privateKey, char[] passwo
StringWriter stringWriter = new StringWriter();
JcaPEMWriter writer = new JcaPEMWriter(stringWriter);

JcePKCSPBEOutputEncryptorBuilder builder = new JcePKCSPBEOutputEncryptorBuilder(PKCS8Generator.PBE_SHA1_RC2_128);
try {
JcePKCSPBEOutputEncryptorBuilder builder = new JcePKCSPBEOutputEncryptorBuilder(PKCS8Generator.PBE_SHA1_RC2_128);
builder.setIterationCount(4096); // TODO: double check requirements here?
OutputEncryptor encryptor = builder.build(password);
JcaPKCS8Generator generator = new JcaPKCS8Generator(privateKey, encryptor);
writer.writeObject(generator);
Expand Down

0 comments on commit 6a275a0

Please sign in to comment.