public class CertificateUtils
extends java.lang.Object
| Constructor and Description |
|---|
CertificateUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.security.cert.X509Certificate |
getCertificate(java.io.InputStream certificate,
java.lang.String password)
Reads the certificate from the input stream, and returns an instance of X509Certificate.
|
static java.util.Map<java.lang.String,java.lang.String> |
splitCertificateSubject(java.io.InputStream certificate,
java.lang.String password)
Split the subject into it's components such as UID, C, OU, CN.
|
static java.util.Map<java.lang.String,java.lang.String> |
splitCertificateSubject(java.lang.String subject)
Split the subject into it's components such as UID, C, OU, DN.
|
static void |
validateCertificate(boolean production,
java.security.cert.X509Certificate certificate)
Checks a certificate for it's validity, as well as that it's a push certificate.
|
public static java.util.Map<java.lang.String,java.lang.String> splitCertificateSubject(java.io.InputStream certificate,
java.lang.String password)
throws java.security.KeyStoreException,
java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException,
java.io.IOException
Example: {UID=com.wizrocket.BeardedRobot, C=US, OU=PNEY234A6B, CN=Apple Production IOS Push Services: com.wizrocket.BeardedRobot}
certificate - The certificatepassword - The passwordjava.security.cert.CertificateException - if any of the certificates in the keystore could not be loadedjava.security.NoSuchAlgorithmException - if the algorithm used to check the integrity of the keystore cannot be foundjava.io.IOException - if there is an I/O or format problem with the keystore data,
if a password is required but not given, or if the given password was incorrectjava.security.KeyStoreException - if no Provider supports a KeyStoreSpi implementation for the specified typepublic static java.security.cert.X509Certificate getCertificate(java.io.InputStream certificate,
java.lang.String password)
throws java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException,
java.io.IOException,
java.security.KeyStoreException
certificate - The certificatepassword - The passwordjava.security.cert.CertificateException - if any of the certificates in the keystore could not be loadedjava.security.NoSuchAlgorithmException - if the algorithm used to check the integrity of the keystore cannot be foundjava.io.IOException - if there is an I/O or format problem with the keystore data,
if a password is required but not given, or if the given password was incorrectjava.security.KeyStoreException - if no Provider supports a KeyStoreSpi implementation for the specified typepublic static java.util.Map<java.lang.String,java.lang.String> splitCertificateSubject(java.lang.String subject)
Example: {UID=com.wizrocket.BeardedRobot, C=US, OU=PNEY234A6B, CN=Apple Production IOS Push Services: com.wizrocket.BeardedRobot}
subject - The subject of the certificatepublic static void validateCertificate(boolean production,
java.security.cert.X509Certificate certificate)
throws java.security.cert.CertificateException
production - Validate the certificate environment, if requiredcertificate - The certificate to be validatedjava.security.cert.CertificateException - When the certificate is not valid, or if it's expired,
or if it's not a push certificateCopyright © 2020. All Rights Reserved.