Package org.xipki.ca.server
Class CaUtil
- java.lang.Object
-
- org.xipki.ca.server.CaUtil
-
public class CaUtil extends Object
Util class of CA.- Since:
- 2.0.0
- Author:
- Lijun Liao (xipki)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddExtensions(org.xipki.ca.api.profile.ExtensionValues extensionValues, org.bouncycastle.cert.X509v3CertificateBuilder certBuilder)static <T> List<T>asModifiableList(T... a)static List<org.xipki.security.X509Cert>buildCertChain(org.xipki.security.X509Cert targetCert, List<org.xipki.security.X509Cert> certs)static StringcanonicalizeSignerConf(String signerConf)static org.bouncycastle.asn1.x509.AuthorityInformationAccesscreateAuthorityInformationAccess(List<String> caIssuerUris, List<String> ocspUris)static org.bouncycastle.asn1.x509.BasicConstraintscreateBasicConstraints(org.xipki.ca.api.profile.Certprofile.CertLevel level, Integer pathLen)static org.bouncycastle.asn1.x509.CRLDistPointcreateCrlDistributionPoints(List<String> crlUris, org.bouncycastle.asn1.x500.X500Name caSubject, org.bouncycastle.asn1.x500.X500Name crlSignerSubject)static org.xipki.util.FileOrBinarycreateFileOrBase64Value(ZipOutputStream zipStream, String b64Content, String fileName)If the content of the decoded b64Content is less than 256 bytes, then returns aFileOrBinarywith binary content, otherwise, the content is written to the zipStream and aFileOrBinary, with file name pointing to the location in the ZIP file, is returned.static org.xipki.util.FileOrBinarycreateFileOrBinary(ZipOutputStream zipStream, byte[] content, String fileName)If the content is less than 256 bytes, then returns aFileOrBinarywith binary content, otherwise, the content is written to the zipStream and aFileOrBinary, with file name pointing to the location in the ZIP file, is returned.static org.xipki.util.FileOrValuecreateFileOrValue(ZipOutputStream zipStream, String content, String fileName)If the content has less than 256 chars, then returns aFileOrValuewith text content, otherwise, the content is written to the zipStream and aFileOrValue, with file name pointing to the location in the ZIP file, is returned.static StringencodeCertchain(List<org.xipki.security.X509Cert> certs)static List<String>getPermissions(int permission)static org.xipki.security.X509CertparseCert(byte[] encodedCert)static org.bouncycastle.asn1.x500.X500NameremoveEmptyRdns(org.bouncycastle.asn1.x500.X500Name name)static org.bouncycastle.asn1.x500.X500NamesortX509Name(org.bouncycastle.asn1.x500.X500Name name)
-
-
-
Method Detail
-
addExtensions
public static void addExtensions(org.xipki.ca.api.profile.ExtensionValues extensionValues, org.bouncycastle.cert.X509v3CertificateBuilder certBuilder) throws org.bouncycastle.cert.CertIOException- Throws:
org.bouncycastle.cert.CertIOException
-
asModifiableList
@SafeVarargs public static <T> List<T> asModifiableList(T... a)
-
createBasicConstraints
public static org.bouncycastle.asn1.x509.BasicConstraints createBasicConstraints(org.xipki.ca.api.profile.Certprofile.CertLevel level, Integer pathLen)
-
createAuthorityInformationAccess
public static org.bouncycastle.asn1.x509.AuthorityInformationAccess createAuthorityInformationAccess(List<String> caIssuerUris, List<String> ocspUris)
-
createCrlDistributionPoints
public static org.bouncycastle.asn1.x509.CRLDistPoint createCrlDistributionPoints(List<String> crlUris, org.bouncycastle.asn1.x500.X500Name caSubject, org.bouncycastle.asn1.x500.X500Name crlSignerSubject)
-
sortX509Name
public static org.bouncycastle.asn1.x500.X500Name sortX509Name(org.bouncycastle.asn1.x500.X500Name name)
-
canonicalizeSignerConf
public static String canonicalizeSignerConf(String signerConf) throws org.xipki.ca.api.mgmt.CaMgmtException
- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
createFileOrValue
public static org.xipki.util.FileOrValue createFileOrValue(ZipOutputStream zipStream, String content, String fileName) throws IOException
If the content has less than 256 chars, then returns aFileOrValuewith text content, otherwise, the content is written to the zipStream and aFileOrValue, with file name pointing to the location in the ZIP file, is returned. The specified stream remains open after this method returns.- Parameters:
content- the contentzipStream- the ZIP output streamfileName- the file name in the ZIP stream when writing to the ZIp stream.- Returns:
- a
FileOrBinarywith the content or fileName as value. - Throws:
IOException- if IO error occurs when writing to the ZIP output stream.
-
createFileOrBase64Value
public static org.xipki.util.FileOrBinary createFileOrBase64Value(ZipOutputStream zipStream, String b64Content, String fileName) throws IOException
If the content of the decoded b64Content is less than 256 bytes, then returns aFileOrBinarywith binary content, otherwise, the content is written to the zipStream and aFileOrBinary, with file name pointing to the location in the ZIP file, is returned. The specified stream remains open after this method returns.- Parameters:
b64Content- the BASE64-encoded contentzipStream- the ZIP output streamfileName- the file name in the ZIP stream when writing to the ZIp stream.- Returns:
- a
FileOrBinarywith the content or fileName as value. - Throws:
IOException- if IO error occurs when writing to the ZIP output stream.
-
createFileOrBinary
public static org.xipki.util.FileOrBinary createFileOrBinary(ZipOutputStream zipStream, byte[] content, String fileName) throws IOException
If the content is less than 256 bytes, then returns aFileOrBinarywith binary content, otherwise, the content is written to the zipStream and aFileOrBinary, with file name pointing to the location in the ZIP file, is returned. The specified stream remains open after this method returns.- Parameters:
content- the contentzipStream- the ZIP output streamfileName- the file name in the ZIP stream when writing to the ZIp stream.- Returns:
- a
FileOrBinarywith the content or fileName as value. - Throws:
IOException- if IO error occurs when writing to the ZIP output stream.
-
buildCertChain
public static List<org.xipki.security.X509Cert> buildCertChain(org.xipki.security.X509Cert targetCert, List<org.xipki.security.X509Cert> certs) throws org.xipki.ca.api.mgmt.CaMgmtException
- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
parseCert
public static org.xipki.security.X509Cert parseCert(byte[] encodedCert) throws org.xipki.ca.api.mgmt.CaMgmtException- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
removeEmptyRdns
public static org.bouncycastle.asn1.x500.X500Name removeEmptyRdns(org.bouncycastle.asn1.x500.X500Name name)
-
-