jdk/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java
changeset 29264 5172066a2da6
parent 25859 3317bb8137f4
child 32649 2ee9017c7597
equal deleted inserted replaced
29263:66e30e926405 29264:5172066a2da6
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2015, 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
   207 
   207 
   208             /* This means a CA is the target, so match on same stuff as
   208             /* This means a CA is the target, so match on same stuff as
   209              * getMatchingEECerts
   209              * getMatchingEECerts
   210              */
   210              */
   211             if (debug != null) {
   211             if (debug != null) {
   212                 debug.println("ForwardBuilder.getMatchingCACerts(): ca is target");
   212                 debug.println("ForwardBuilder.getMatchingCACerts(): " +
       
   213                               "the target is a CA");
   213             }
   214             }
   214 
   215 
   215             if (caTargetSelector == null) {
   216             if (caTargetSelector == null) {
   216                 caTargetSelector =
   217                 caTargetSelector =
   217                     (X509CertSelector) targetCertConstraints.clone();
   218                     (X509CertSelector) targetCertConstraints.clone();
   289         sel.setBasicConstraints(-1);
   290         sel.setBasicConstraints(-1);
   290 
   291 
   291         for (X509Certificate trustedCert : trustedCerts) {
   292         for (X509Certificate trustedCert : trustedCerts) {
   292             if (sel.match(trustedCert)) {
   293             if (sel.match(trustedCert)) {
   293                 if (debug != null) {
   294                 if (debug != null) {
   294                     debug.println("ForwardBuilder.getMatchingCACerts: "
   295                     debug.println("ForwardBuilder.getMatchingCACerts: " +
   295                         + "found matching trust anchor");
   296                         "found matching trust anchor." +
       
   297                         "\n  SN: " +
       
   298                             Debug.toHexString(trustedCert.getSerialNumber()) +
       
   299                         "\n  Subject: " +
       
   300                             trustedCert.getSubjectX500Principal() +
       
   301                         "\n  Issuer: " +
       
   302                             trustedCert.getIssuerX500Principal());
   296                 }
   303                 }
   297                 if (caCerts.add(trustedCert) && !searchAllCertStores) {
   304                 if (caCerts.add(trustedCert) && !searchAllCertStores) {
   298                     return;
   305                     return;
   299                 }
   306                 }
   300             }
   307             }