public class CertUtils extends Object
| Constructor and Description |
|---|
CertUtils() |
| Modifier and Type | Method and Description |
|---|---|
static X509Certificate |
certFromFile(String certFile)
Creates an X509Certificate object from an existing file.
|
static byte[] |
pkcs12ToStrippedPkcs12(byte[] bytes,
String passphrase)
Takes a PKCS12 byte stream and returns a PKCS12 byte stream with the pass phrase protection and encryption removed.
|
static X509Certificate |
toX509Certificate(byte[] data)
Converts a byte stream to an X509Certificate.
|
static X509Certificate |
toX509Certificate(byte[] data,
String passPhrase)
Converts a byte stream to an X509Certificate.
|
static byte[] |
x509CertificateToBytes(X509Certificate cert)
Converts an X509Certificate to a byte stream representation.
|
public static byte[] pkcs12ToStrippedPkcs12(byte[] bytes,
String passphrase)
throws org.nhindirect.dns.DNSException
bytes - The PKCS12 byte stream that will be stripped.passphrase - The pass phrase of the PKCS12 byte stream. This is used to decrypt the PKCS12 stream.org.nhindirect.dns.DNSExceptionpublic static byte[] x509CertificateToBytes(X509Certificate cert) throws org.nhindirect.dns.DNSException
cert - The certificate to convert.org.nhindirect.dns.DNSExceptionpublic static X509Certificate toX509Certificate(byte[] data) throws org.nhindirect.dns.DNSException
If the stream is a PKCS12 representation, then an empty ("") pass phrase is used to decrypt the stream. In addition the resulting X509Certificate implementation will contain the private key.
data - The byte stream representation to convert.org.nhindirect.dns.DNSExceptionpublic static X509Certificate toX509Certificate(byte[] data, String passPhrase) throws org.nhindirect.dns.DNSException
If the stream is a PKCS12 representation, then the pass phrase is used to decrypt the stream. In addition the resulting X509Certificate implementation will contain the private key.
data - The byte stream representation to convert.passPhrase - If the byte stream is a PKCS12 representation, then the then the pass phrase is used to decrypt the stream. Can be
null if the stream is an encoded X509Certificate and not a PKCS12 byte stream.org.nhindirect.dns.DNSExceptionpublic static X509Certificate certFromFile(String certFile)
certFile - The file to load into a certificate object.Copyright © 2016. All Rights Reserved.