Class CertificateUtil
java.lang.Object
com.itextpdf.text.pdf.security.CertificateUtil
This class contains a series of static methods that
allow you to retrieve information from a Certificate.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CRLGets the CRL object using a CRL URL.static CRLgetCRL(X509Certificate certificate) Gets a CRL from a certificatestatic StringgetCRLURL(X509Certificate certificate) Gets the URL of the Certificate Revocation List for a Certificateprivate static org.bouncycastle.asn1.ASN1PrimitivegetExtensionValue(X509Certificate certificate, String oid) static StringgetOCSPURL(X509Certificate certificate) Retrieves the OCSP URL from the given certificate.private static StringgetStringFromGeneralName(org.bouncycastle.asn1.ASN1Primitive names) Gets a String from an ASN1Primitivestatic StringgetTSAURL(X509Certificate certificate) Gets the URL of the TSA if it's available on the certificate
-
Constructor Details
-
CertificateUtil
public CertificateUtil()
-
-
Method Details
-
getCRL
public static CRL getCRL(X509Certificate certificate) throws CertificateException, CRLException, IOException Gets a CRL from a certificate- Parameters:
certificate-- Returns:
- the CRL or null if there's no CRL available
- Throws:
CertificateExceptionCRLExceptionIOException
-
getCRLURL
Gets the URL of the Certificate Revocation List for a Certificate- Parameters:
certificate- the Certificate- Returns:
- the String where you can check if the certificate was revoked
- Throws:
CertificateParsingExceptionIOException
-
getCRL
Gets the CRL object using a CRL URL.- Parameters:
url- the URL where to get the CRL- Returns:
- a CRL object
- Throws:
IOExceptionCertificateExceptionCRLException
-
getOCSPURL
Retrieves the OCSP URL from the given certificate.- Parameters:
certificate- the certificate- Returns:
- the URL or null
- Throws:
IOException
-
getTSAURL
Gets the URL of the TSA if it's available on the certificate- Parameters:
certificate- a certificate- Returns:
- a TSA URL
- Throws:
IOException
-
getExtensionValue
private static org.bouncycastle.asn1.ASN1Primitive getExtensionValue(X509Certificate certificate, String oid) throws IOException - Parameters:
certificate- the certificate from which we need the ExtensionValueoid- the Object Identifier value for the extension.- Returns:
- the extension value as an ASN1Primitive object
- Throws:
IOException
-
getStringFromGeneralName
private static String getStringFromGeneralName(org.bouncycastle.asn1.ASN1Primitive names) throws IOException Gets a String from an ASN1Primitive- Parameters:
names- the ASN1Primitive- Returns:
- a human-readable String
- Throws:
IOException
-