提交 a9cfbe48 编写于 作者: W weijun

6820606: keytool can generate serialno more randomly

Reviewed-by: xuelei
上级 319ca7a7
...@@ -1072,8 +1072,8 @@ public final class KeyTool { ...@@ -1072,8 +1072,8 @@ public final class KeyTool {
X509CertInfo info = new X509CertInfo(); X509CertInfo info = new X509CertInfo();
info.set(X509CertInfo.VALIDITY, interval); info.set(X509CertInfo.VALIDITY, interval);
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
((int)(firstDate.getTime()/1000))); new java.util.Random().nextInt() & 0x7fffffff));
info.set(X509CertInfo.VERSION, info.set(X509CertInfo.VERSION,
new CertificateVersion(CertificateVersion.V3)); new CertificateVersion(CertificateVersion.V3));
info.set(X509CertInfo.ALGORITHM_ID, info.set(X509CertInfo.ALGORITHM_ID,
...@@ -2121,8 +2121,8 @@ public final class KeyTool { ...@@ -2121,8 +2121,8 @@ public final class KeyTool {
certInfo.set(X509CertInfo.VALIDITY, interval); certInfo.set(X509CertInfo.VALIDITY, interval);
// Make new serial number // Make new serial number
certInfo.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber certInfo.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
((int)(firstDate.getTime()/1000))); new java.util.Random().nextInt() & 0x7fffffff));
// Set owner and issuer fields // Set owner and issuer fields
X500Name owner; X500Name owner;
......
...@@ -265,8 +265,8 @@ public final class CertAndKeyGen { ...@@ -265,8 +265,8 @@ public final class CertAndKeyGen {
// Add all mandatory attributes // Add all mandatory attributes
info.set(X509CertInfo.VERSION, info.set(X509CertInfo.VERSION,
new CertificateVersion(CertificateVersion.V3)); new CertificateVersion(CertificateVersion.V3));
info.set(X509CertInfo.SERIAL_NUMBER, info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
new CertificateSerialNumber((int)(firstDate.getTime()/1000))); new java.util.Random().nextInt() & 0x7fffffff));
AlgorithmId algID = issuer.getAlgorithmId(); AlgorithmId algID = issuer.getAlgorithmId();
info.set(X509CertInfo.ALGORITHM_ID, info.set(X509CertInfo.ALGORITHM_ID,
new CertificateAlgorithmId(algID)); new CertificateAlgorithmId(algID));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册