public class CertUtil extends Object
| Constructor and Description |
|---|
CertUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
certToPEM(X509Certificate certificate)
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 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(X509Certificate certificate)
certificate - the certificate 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)Copyright © 2011–2016 dCache.org. All rights reserved.