public class TlsUtils extends Object
Constructor and Description |
---|
TlsUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
extensionPrettyPrint(String oid,
byte[] derOctetString,
X509Certificate certificate)
Human-readable representation of an X509 certificate extension.
|
static void |
logPeerCertificateInfo(SSLSession session)
Log details on peer certificate and certification chain.
|
static String |
peerCertificateInfo(Certificate certificate,
String prefix)
Get a string representation of certificate info.
|
static String |
stripCRLF(String value)
Strips carriage return (CR) and line feed (LF) characters to mitigate CWE-117.
|
public static void logPeerCertificateInfo(SSLSession session)
The log level is debug. Common X509 extensions are displayed in a best-effort fashion, a hexadecimal dump is made for less commonly used extensions.
session
- the SSLSession
to extract the certificates frompublic static String peerCertificateInfo(Certificate certificate, String prefix)
certificate
- the certificate to analyzeprefix
- the line prefixpublic static String extensionPrettyPrint(String oid, byte[] derOctetString, X509Certificate certificate)
Common extensions are supported in a best-effort fashion, less commonly used extensions are displayed as an hexadecimal dump.
Extensions come encoded as a DER Octet String, which itself can contain other DER-encoded objects, making a comprehensive support in this utility impossible.
oid
- extension OIDderOctetString
- the extension value as a DER octet stringcertificate
- the certificateCopyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.