< prev index next >

src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java

Print this page
rev 47483 : [mq]: XXXXXXX-double-trouble-2


 178     public String toString() {
 179         StringBuilder sb = new StringBuilder();
 180         sb.append(super.toString())
 181             .append("PrivateKeyUsage: [\n");
 182         if (notBefore != null) {
 183             sb.append("From: ")
 184                 .append(notBefore);
 185             if (notAfter != null) {
 186                 sb.append(", ");
 187             }
 188         }
 189         if (notAfter != null) {
 190             sb.append("To: ")
 191                 .append(notAfter);
 192         }
 193         sb.append("]\n");
 194         return sb.toString();
 195     }
 196 
 197     /**
 198      * Verify that that the current time is within the validity period.
 199      *
 200      * @exception CertificateExpiredException if the certificate has expired.
 201      * @exception CertificateNotYetValidException if the certificate is not
 202      * yet valid.
 203      */
 204     public void valid()
 205     throws CertificateNotYetValidException, CertificateExpiredException {
 206         Date now = new Date();
 207         valid(now);
 208     }
 209 
 210     /**
 211      * Verify that that the passed time is within the validity period.
 212      *
 213      * @exception CertificateExpiredException if the certificate has expired
 214      * with respect to the <code>Date</code> supplied.
 215      * @exception CertificateNotYetValidException if the certificate is not
 216      * yet valid with respect to the <code>Date</code> supplied.
 217      *
 218      */
 219     public void valid(Date now)
 220     throws CertificateNotYetValidException, CertificateExpiredException {
 221         Objects.requireNonNull(now);
 222         /*
 223          * we use the internal Dates rather than the passed in Date
 224          * because someone could override the Date methods after()
 225          * and before() to do something entirely different.
 226          */
 227         if (notBefore != null && notBefore.after(now)) {
 228             throw new CertificateNotYetValidException("NotBefore: " +
 229                                                       notBefore.toString());
 230         }
 231         if (notAfter != null && notAfter.before(now)) {




 178     public String toString() {
 179         StringBuilder sb = new StringBuilder();
 180         sb.append(super.toString())
 181             .append("PrivateKeyUsage: [\n");
 182         if (notBefore != null) {
 183             sb.append("From: ")
 184                 .append(notBefore);
 185             if (notAfter != null) {
 186                 sb.append(", ");
 187             }
 188         }
 189         if (notAfter != null) {
 190             sb.append("To: ")
 191                 .append(notAfter);
 192         }
 193         sb.append("]\n");
 194         return sb.toString();
 195     }
 196 
 197     /**
 198      * Verify that the current time is within the validity period.
 199      *
 200      * @exception CertificateExpiredException if the certificate has expired.
 201      * @exception CertificateNotYetValidException if the certificate is not
 202      * yet valid.
 203      */
 204     public void valid()
 205     throws CertificateNotYetValidException, CertificateExpiredException {
 206         Date now = new Date();
 207         valid(now);
 208     }
 209 
 210     /**
 211      * Verify that the passed time is within the validity period.
 212      *
 213      * @exception CertificateExpiredException if the certificate has expired
 214      * with respect to the <code>Date</code> supplied.
 215      * @exception CertificateNotYetValidException if the certificate is not
 216      * yet valid with respect to the <code>Date</code> supplied.
 217      *
 218      */
 219     public void valid(Date now)
 220     throws CertificateNotYetValidException, CertificateExpiredException {
 221         Objects.requireNonNull(now);
 222         /*
 223          * we use the internal Dates rather than the passed in Date
 224          * because someone could override the Date methods after()
 225          * and before() to do something entirely different.
 226          */
 227         if (notBefore != null && notBefore.after(now)) {
 228             throw new CertificateNotYetValidException("NotBefore: " +
 229                                                       notBefore.toString());
 230         }
 231         if (notAfter != null && notAfter.before(now)) {


< prev index next >