Skip to content

Commit 914c69c

Browse files
Aleksei VoitylovRealCLanger
authored andcommitted
8371935: Enhance key generation
Reviewed-by: andrew Backport-of: d0c1a0707ac9f863aa1e98613032e15b2f998056
1 parent 59a0ef7 commit 914c69c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ final class PBES1Core {
4747
private final MessageDigest md;
4848
private final String algo;
4949
private byte[] salt = null;
50-
private int iCount = 10;
50+
// RFC 8018 and NIST SP 800-132 sec 5.2 recommend 1000 as the minimum
51+
private int iCount = PKCS12PBECipherCore.DEFAULT_COUNT;
5152

5253
/**
5354
* Creates an instance of PBE Cipher using the specified CipherSpi

src/java.base/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@ final class PKCS12PBECipherCore {
5353
private int iCount = 0;
5454

5555
private static final int DEFAULT_SALT_LENGTH = 20;
56-
private static final int DEFAULT_COUNT = 1024;
56+
static final int DEFAULT_COUNT = 1024;
5757

5858
static final int CIPHER_KEY = 1;
5959
static final int CIPHER_IV = 2;

0 commit comments

Comments
 (0)