Package org.dogtagpki.util.cert
Class CertUtil
java.lang.Object
org.dogtagpki.util.cert.CertUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.mozilla.jss.netscape.security.x509.CertificateExtensions
createRequestExtensions
(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) static org.mozilla.jss.netscape.security.pkcs.PKCS10
decodePKCS10
(String request) Decode PKCS #10 certificate request from Base64.static void
deleteCert
(String tokenname, org.mozilla.jss.crypto.X509Certificate cert) static String
fingerPrintFormat
(String content) static Set<org.mozilla.jss.CertificateUsage>
getCertificateUsages
(String nickname) Get certificate usages.static String
getCommonName
(org.mozilla.jss.netscape.security.x509.X500Name name) getDNSNames
(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) Get DNS names from PKCS #10 request.getDNSNames
(org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension sanExtension) Get DNS names from SAN extension.static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension
getSANExtension
(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) Get SAN extension from PKCS #10 request.static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension
getSANExtension
(org.mozilla.jss.netscape.security.x509.Extensions extensions) Get SAN extension from a collection of extensions.static org.mozilla.jss.pkix.crmf.CertReqMsg[]
static byte[]
static org.mozilla.jss.CertificateUsage
toCertificateUsage
(String certUsage) Convert cert usage string into CertificateUsage object.static String
toPEM
(X509Certificate cert) static String
toPEM
(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) static String
unwrapPKCS10
(String request, boolean checkHeader) Convert PKCS #10 request from PEM to Base64.static void
verifyCertificateUsage
(String nickname, String certUsage) Verify certificate usage.static void
verifyCertValidity
(String nickname) Verify that the cert is currently valid (notBefore <= now <= notAfter).
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
CERT_NEW_REQUEST_HEADER
- See Also:
-
CERT_NEW_REQUEST_FOOTER
- See Also:
-
CERT_RENEWAL_HEADER
- See Also:
-
CERT_RENEWAL_FOOTER
- See Also:
-
CRL_HEADER
- See Also:
-
CRL_FOOTER
- See Also:
-
LINE_COUNT
public static final int LINE_COUNT- See Also:
-
-
Constructor Details
-
CertUtil
public CertUtil()
-
-
Method Details
-
unwrapPKCS10
Convert PKCS #10 request from PEM to Base64.- Parameters:
request
- string-formated PKCS #10 request- Returns:
- Base64-encoded PKCS #10 request
- Throws:
EBaseException
-
parseCSR
-
parseCRMF
- Throws:
Exception
-
decodePKCS10
public static org.mozilla.jss.netscape.security.pkcs.PKCS10 decodePKCS10(String request) throws EBaseException Decode PKCS #10 certificate request from Base64.- Parameters:
request
- Base64-encoded certificate request- Returns:
- PKCS10 object
- Throws:
EBaseException
-
toPEM
- Throws:
Exception
-
toPEM
- Throws:
Exception
-
fingerPrintFormat
-
deleteCert
public static void deleteCert(String tokenname, org.mozilla.jss.crypto.X509Certificate cert) throws Exception - Throws:
Exception
-
createRequestExtensions
public static org.mozilla.jss.netscape.security.x509.CertificateExtensions createRequestExtensions(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception - Throws:
Exception
-
getSANExtension
public static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension getSANExtension(org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception Get SAN extension from a collection of extensions.- Throws:
Exception
-
getSANExtension
public static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension getSANExtension(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception Get SAN extension from PKCS #10 request.- Throws:
Exception
-
getDNSNames
public static Set<String> getDNSNames(org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension sanExtension) throws Exception Get DNS names from SAN extension.- Throws:
Exception
-
getCommonName
public static String getCommonName(org.mozilla.jss.netscape.security.x509.X500Name name) throws Exception - Throws:
Exception
-
getDNSNames
public static Set<String> getDNSNames(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception Get DNS names from PKCS #10 request.- Throws:
Exception
-
toCertificateUsage
public static org.mozilla.jss.CertificateUsage toCertificateUsage(String certUsage) throws Exception Convert cert usage string into CertificateUsage object.- Throws:
Exception
-
getCertificateUsages
public static Set<org.mozilla.jss.CertificateUsage> getCertificateUsages(String nickname) throws Exception Get certificate usages.- Throws:
Exception
-
verifyCertificateUsage
Verify certificate usage.- Throws:
Exception
-
verifyCertValidity
Verify that the cert is currently valid (notBefore <= now <= notAfter).- Throws:
Exception
-