jdk/src/share/classes/java/security/cert/X509Extension.java
changeset 18156 edb590d448c5
parent 10114 d35f0b7bda65
child 18551 882a3948c6e6
equal deleted inserted replaced
18155:889970e5b728 18156:edb590d448c5
    82      * CRITICAL in the certificate/CRL managed by the object
    82      * CRITICAL in the certificate/CRL managed by the object
    83      * implementing this interface.
    83      * implementing this interface.
    84      *
    84      *
    85      * Here is sample code to get a Set of critical extensions from an
    85      * Here is sample code to get a Set of critical extensions from an
    86      * X509Certificate and print the OIDs:
    86      * X509Certificate and print the OIDs:
    87      * <pre><code>
    87      * <pre>{@code
    88      * X509Certificate cert = null;
    88      * X509Certificate cert = null;
    89      * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
    89      * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
    90      *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
    90      *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
    91      *     cert = (X509Certificate)cf.generateCertificate(inStrm);
    91      *     cert = (X509Certificate)cf.generateCertificate(inStrm);
    92      * }<p>
    92      * }
    93      *
    93      *
    94      * Set<String> critSet = cert.getCriticalExtensionOIDs();
    94      * Set<String> critSet = cert.getCriticalExtensionOIDs();
    95      * if (critSet != null && !critSet.isEmpty()) {
    95      * if (critSet != null && !critSet.isEmpty()) {
    96      *     System.out.println("Set of critical extensions:");
    96      *     System.out.println("Set of critical extensions:");
    97      *     for (String oid : critSet) {
    97      *     for (String oid : critSet) {
    98      *         System.out.println(oid);
    98      *         System.out.println(oid);
    99      *     }
    99      *     }
   100      * }
   100      * }
   101      * </code></pre>
   101      * }</pre>
   102      * @return a Set (or an empty Set if none are marked critical) of
   102      * @return a Set (or an empty Set if none are marked critical) of
   103      * the extension OID strings for extensions that are marked critical.
   103      * the extension OID strings for extensions that are marked critical.
   104      * If there are no extensions present at all, then this method returns
   104      * If there are no extensions present at all, then this method returns
   105      * null.
   105      * null.
   106      */
   106      */