jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   227             // Add all mandatory attributes
   227             // Add all mandatory attributes
   228             info.set(X509CertInfo.VERSION,
   228             info.set(X509CertInfo.VERSION,
   229                      new CertificateVersion(CertificateVersion.V3));
   229                      new CertificateVersion(CertificateVersion.V3));
   230             info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
   230             info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
   231                     new java.util.Random().nextInt() & 0x7fffffff));
   231                     new java.util.Random().nextInt() & 0x7fffffff));
   232             AlgorithmId algID = AlgorithmId.getAlgorithmId(sigAlg);
   232             AlgorithmId algID = AlgorithmId.get(sigAlg);
   233             info.set(X509CertInfo.ALGORITHM_ID,
   233             info.set(X509CertInfo.ALGORITHM_ID,
   234                      new CertificateAlgorithmId(algID));
   234                      new CertificateAlgorithmId(algID));
   235             info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(myname));
   235             info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(myname));
   236             info.set(X509CertInfo.KEY, new CertificateX509Key(publicKey));
   236             info.set(X509CertInfo.KEY, new CertificateX509Key(publicKey));
   237             info.set(X509CertInfo.VALIDITY, interval);
   237             info.set(X509CertInfo.VALIDITY, interval);