public class CertUtil extends Object
| Constructor and Description |
|---|
CertUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
certToPEM(byte[] der)
Encodes to PEM format with default X.509 certificate
header/footer
|
static String |
computeHash(MessageDigest md,
X500Principal principal)
Computes the hash from the principal, using the passed-in digest
(usually MD5).
|
static String |
computeMD5Hash(X500Principal principal)
Convenience method to compute a openssl-compatible md5 hash
|
static byte[] |
fromPEM(String pem,
String header,
String footer)
Decodes PEM by removing the given header and footer, and decodes
the inner content with base64.
|
static List<X509Certificate> |
parseCerts(Reader in)
Parses a sequence of certificates from an input source and returns it
as a list.
|
static String |
toPEM(byte[] der,
String header,
String footer)
Encodes to PEM.
|
public static byte[] fromPEM(String pem, String header, String footer)
pem - the full PEM-encoded data including header + footerheader - the header to be striped offfooter - the footer to be striped offpublic static String certToPEM(byte[] der)
der - the content to be encodedpublic static String toPEM(byte[] der, String header, String footer)
der - the content to be encodedheader - the header linefooter - the footer linepublic static String computeMD5Hash(X500Principal principal)
principal - the principal (either issuer or subject)public static String computeHash(MessageDigest md, X500Principal principal)
md - the digest instanceprincipal - the principal (subject or issuer)public static List<X509Certificate> parseCerts(Reader in) throws IOException, GeneralSecurityException
in - the input sourceIOException - if an parse error occursGeneralSecurityException - if not certificates are foundCopyright © 2014 dCache.org. All rights reserved.