Package com.itextpdf.text.pdf.security
Class CertificateUtil
- java.lang.Object
-
- com.itextpdf.text.pdf.security.CertificateUtil
-
public class CertificateUtil extends java.lang.Object
This class contains a series of static methods that allow you to retrieve information from a Certificate.
-
-
Constructor Summary
Constructors Constructor Description CertificateUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.cert.CRL
getCRL(java.lang.String url)
Gets the CRL object using a CRL URL.static java.security.cert.CRL
getCRL(java.security.cert.X509Certificate certificate)
Gets a CRL from a certificatestatic java.lang.String
getCRLURL(java.security.cert.X509Certificate certificate)
Gets the URL of the Certificate Revocation List for a Certificateprivate static org.bouncycastle.asn1.ASN1Primitive
getExtensionValue(java.security.cert.X509Certificate certificate, java.lang.String oid)
static java.lang.String
getOCSPURL(java.security.cert.X509Certificate certificate)
Retrieves the OCSP URL from the given certificate.private static java.lang.String
getStringFromGeneralName(org.bouncycastle.asn1.ASN1Primitive names)
Gets a String from an ASN1Primitivestatic java.lang.String
getTSAURL(java.security.cert.X509Certificate certificate)
Gets the URL of the TSA if it's available on the certificate
-
-
-
Method Detail
-
getCRL
public static java.security.cert.CRL getCRL(java.security.cert.X509Certificate certificate) throws java.security.cert.CertificateException, java.security.cert.CRLException, java.io.IOException
Gets a CRL from a certificate- Parameters:
certificate
-- Returns:
- the CRL or null if there's no CRL available
- Throws:
java.security.cert.CertificateException
java.security.cert.CRLException
java.io.IOException
-
getCRLURL
public static java.lang.String getCRLURL(java.security.cert.X509Certificate certificate) throws java.security.cert.CertificateParsingException
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:
java.security.cert.CertificateParsingException
java.io.IOException
-
getCRL
public static java.security.cert.CRL getCRL(java.lang.String url) throws java.io.IOException, java.security.cert.CertificateException, java.security.cert.CRLException
Gets the CRL object using a CRL URL.- Parameters:
url
- the URL where to get the CRL- Returns:
- a CRL object
- Throws:
java.io.IOException
java.security.cert.CertificateException
java.security.cert.CRLException
-
getOCSPURL
public static java.lang.String getOCSPURL(java.security.cert.X509Certificate certificate)
Retrieves the OCSP URL from the given certificate.- Parameters:
certificate
- the certificate- Returns:
- the URL or null
- Throws:
java.io.IOException
-
getTSAURL
public static java.lang.String getTSAURL(java.security.cert.X509Certificate certificate)
Gets the URL of the TSA if it's available on the certificate- Parameters:
certificate
- a certificate- Returns:
- a TSA URL
- Throws:
java.io.IOException
-
getExtensionValue
private static org.bouncycastle.asn1.ASN1Primitive getExtensionValue(java.security.cert.X509Certificate certificate, java.lang.String oid) throws java.io.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:
java.io.IOException
-
getStringFromGeneralName
private static java.lang.String getStringFromGeneralName(org.bouncycastle.asn1.ASN1Primitive names) throws java.io.IOException
Gets a String from an ASN1Primitive- Parameters:
names
- the ASN1Primitive- Returns:
- a human-readable String
- Throws:
java.io.IOException
-
-