Package eu.emi.security.authn.x509.impl
Class X509Formatter
- java.lang.Object
-
- eu.emi.security.authn.x509.impl.X509Formatter
-
public class X509Formatter extends java.lang.Object
Utility allowing for converting certificates to various text representations.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
EKU
private static java.util.Map<java.lang.String,java.lang.String>
EXT_USAGES
private FormatMode
mode
private static java.lang.String[]
USAGES
-
Constructor Summary
Constructors Constructor Description X509Formatter(FormatMode mode)
Creates a new X509Formatter object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
appendAltNames(java.lang.StringBuilder sb, java.lang.String info, java.lang.String sep, java.util.Collection<java.util.List<?>> altNames)
java.lang.String
format(java.security.cert.X509Certificate cert)
Produces a human readable text representation of the provided certificate.java.lang.String
format(java.security.cert.X509Certificate[] certChain)
Produces a human readable text representation of the provided certificate chain.java.lang.String
format(java.security.cert.X509Certificate[] certChain, boolean preamble)
Produces a human readable text representation of the provided certificate chain.
-
-
-
Field Detail
-
mode
private final FormatMode mode
-
USAGES
private static final java.lang.String[] USAGES
-
EKU
private static final java.lang.String EKU
- See Also:
- Constant Field Values
-
EXT_USAGES
private static final java.util.Map<java.lang.String,java.lang.String> EXT_USAGES
-
-
Constructor Detail
-
X509Formatter
public X509Formatter(FormatMode mode)
Creates a new X509Formatter object- Parameters:
mode
- the formatting mode that will be used by this object.
-
-
Method Detail
-
format
public java.lang.String format(java.security.cert.X509Certificate cert)
Produces a human readable text representation of the provided certificate.- Parameters:
cert
- input certificate- Returns:
- the text representation
-
appendAltNames
private void appendAltNames(java.lang.StringBuilder sb, java.lang.String info, java.lang.String sep, java.util.Collection<java.util.List<?>> altNames)
-
format
public java.lang.String format(java.security.cert.X509Certificate[] certChain)
Produces a human readable text representation of the provided certificate chain.- Parameters:
certChain
- input certificates- Returns:
- the text representation
-
format
public java.lang.String format(java.security.cert.X509Certificate[] certChain, boolean preamble)
Produces a human readable text representation of the provided certificate chain.- Parameters:
certChain
- input certificatespreamble
- whether to print a first line with an information on the number of elements.- Returns:
- the text representation
-
-