6820606: keytool can generate serialno more randomly
Reviewed-by: xuelei
This commit is contained in:
parent
ffa70f7fdd
commit
b1d6f69a58
@ -1072,8 +1072,8 @@ public final class KeyTool {
|
||||
|
||||
X509CertInfo info = new X509CertInfo();
|
||||
info.set(X509CertInfo.VALIDITY, interval);
|
||||
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber
|
||||
((int)(firstDate.getTime()/1000)));
|
||||
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
|
||||
new java.util.Random().nextInt() & 0x7fffffff));
|
||||
info.set(X509CertInfo.VERSION,
|
||||
new CertificateVersion(CertificateVersion.V3));
|
||||
info.set(X509CertInfo.ALGORITHM_ID,
|
||||
@ -2121,8 +2121,8 @@ public final class KeyTool {
|
||||
certInfo.set(X509CertInfo.VALIDITY, interval);
|
||||
|
||||
// Make new serial number
|
||||
certInfo.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber
|
||||
((int)(firstDate.getTime()/1000)));
|
||||
certInfo.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
|
||||
new java.util.Random().nextInt() & 0x7fffffff));
|
||||
|
||||
// Set owner and issuer fields
|
||||
X500Name owner;
|
||||
|
@ -265,8 +265,8 @@ public final class CertAndKeyGen {
|
||||
// Add all mandatory attributes
|
||||
info.set(X509CertInfo.VERSION,
|
||||
new CertificateVersion(CertificateVersion.V3));
|
||||
info.set(X509CertInfo.SERIAL_NUMBER,
|
||||
new CertificateSerialNumber((int)(firstDate.getTime()/1000)));
|
||||
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
|
||||
new java.util.Random().nextInt() & 0x7fffffff));
|
||||
AlgorithmId algID = issuer.getAlgorithmId();
|
||||
info.set(X509CertInfo.ALGORITHM_ID,
|
||||
new CertificateAlgorithmId(algID));
|
||||
|
Loading…
Reference in New Issue
Block a user