67 * @author Hemma Prafullchandra 68 */ 69 70 public interface X509Extension { 71 72 /** 73 * Check if there is a critical extension that is not supported. 74 * 75 * @return <tt>true</tt> if a critical extension is found that is 76 * not supported, otherwise <tt>false</tt>. 77 */ 78 public boolean hasUnsupportedCriticalExtension(); 79 80 /** 81 * Gets a Set of the OID strings for the extension(s) marked 82 * CRITICAL in the certificate/CRL managed by the object 83 * implementing this interface. 84 * 85 * Here is sample code to get a Set of critical extensions from an 86 * X509Certificate and print the OIDs: 87 * <pre><code> 88 * X509Certificate cert = null; 89 * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) { 90 * CertificateFactory cf = CertificateFactory.getInstance("X.509"); 91 * cert = (X509Certificate)cf.generateCertificate(inStrm); 92 * }<p> 93 * 94 * Set<String> critSet = cert.getCriticalExtensionOIDs(); 95 * if (critSet != null && !critSet.isEmpty()) { 96 * System.out.println("Set of critical extensions:"); 97 * for (String oid : critSet) { 98 * System.out.println(oid); 99 * } 100 * } 101 * </code></pre> 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. 104 * If there are no extensions present at all, then this method returns 105 * null. 106 */ 107 public Set<String> getCriticalExtensionOIDs(); 108 109 /** 110 * Gets a Set of the OID strings for the extension(s) marked 111 * NON-CRITICAL in the certificate/CRL managed by the object 112 * implementing this interface. 113 * 114 * Here is sample code to get a Set of non-critical extensions from an 115 * X509CRL revoked certificate entry and print the OIDs: 116 * <pre><code> 117 * CertificateFactory cf = null; 118 * X509CRL crl = null; 119 * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) { 120 * cf = CertificateFactory.getInstance("X.509"); 121 * crl = (X509CRL)cf.generateCRL(inStrm); | 67 * @author Hemma Prafullchandra 68 */ 69 70 public interface X509Extension { 71 72 /** 73 * Check if there is a critical extension that is not supported. 74 * 75 * @return <tt>true</tt> if a critical extension is found that is 76 * not supported, otherwise <tt>false</tt>. 77 */ 78 public boolean hasUnsupportedCriticalExtension(); 79 80 /** 81 * Gets a Set of the OID strings for the extension(s) marked 82 * CRITICAL in the certificate/CRL managed by the object 83 * implementing this interface. 84 * 85 * Here is sample code to get a Set of critical extensions from an 86 * X509Certificate and print the OIDs: 87 * <pre>{@code 88 * X509Certificate cert = null; 89 * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) { 90 * CertificateFactory cf = CertificateFactory.getInstance("X.509"); 91 * cert = (X509Certificate)cf.generateCertificate(inStrm); 92 * } 93 * 94 * Set<String> critSet = cert.getCriticalExtensionOIDs(); 95 * if (critSet != null && !critSet.isEmpty()) { 96 * System.out.println("Set of critical extensions:"); 97 * for (String oid : critSet) { 98 * System.out.println(oid); 99 * } 100 * } 101 * }</pre> 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. 104 * If there are no extensions present at all, then this method returns 105 * null. 106 */ 107 public Set<String> getCriticalExtensionOIDs(); 108 109 /** 110 * Gets a Set of the OID strings for the extension(s) marked 111 * NON-CRITICAL in the certificate/CRL managed by the object 112 * implementing this interface. 113 * 114 * Here is sample code to get a Set of non-critical extensions from an 115 * X509CRL revoked certificate entry and print the OIDs: 116 * <pre><code> 117 * CertificateFactory cf = null; 118 * X509CRL crl = null; 119 * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) { 120 * cf = CertificateFactory.getInstance("X.509"); 121 * crl = (X509CRL)cf.generateCRL(inStrm); |