public final class CsrUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
commonNames(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
Gets all the common names from the subject of the certificate request.
|
static org.bouncycastle.asn1.pkcs.CertificationRequest |
decodeCsr(byte[] csr)
Decodes DER-encoded PKCS#10 certificate signing request into a structured object.
|
static org.bouncycastle.asn1.pkcs.CertificationRequest |
decodeCsr(String csr)
Decodes PEM-encoded PKCS#10 certificate signing request into a structured object.
|
static String |
encodeCsr(org.bouncycastle.pkcs.PKCS10CertificationRequest csr)
Encodes a PKCS#10 certificate signing request to PEM-encoded string format.
|
static org.bouncycastle.pkcs.PKCS10CertificationRequest |
generateCsr(KeyPair keyPair,
String subjectDN,
String... subjectAltNames)
Generates a CSR given a key pair, subject DN, and optional subject alternative names.
|
static int |
keyLength(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
Gets the size in bits of the public key in the CSR.
|
static org.bouncycastle.asn1.pkcs.CertificationRequest |
readCsr(File file)
Decodes either a PEM or DER-encoded PKCS#10 certificate signing request from a file into a structured object.
|
static org.bouncycastle.asn1.pkcs.CertificationRequest |
readCsr(InputStream in)
Decodes either a PEM or DER-encoded PKCS#10 certificate signing request from a stream into a structured object.
|
static String |
sigAlgName(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
Gets the name of the signature algorithm mentioned in the CSR.
|
static List<String> |
subjectAltNames(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
Gets all subject alternative names mentioned on the certificate request.
|
public static String encodeCsr(org.bouncycastle.pkcs.PKCS10CertificationRequest csr)
csr - Certificate signing request.EncodingException - on errors writing PEM-encoded data.public static org.bouncycastle.asn1.pkcs.CertificationRequest decodeCsr(String csr)
csr - PEM-encoded CSR.IllegalArgumentException - if input does not appear to be PEM-encoded data.public static org.bouncycastle.asn1.pkcs.CertificationRequest decodeCsr(byte[] csr)
csr - Bytes of a DER-encoded CSR.public static org.bouncycastle.asn1.pkcs.CertificationRequest readCsr(File file)
file - File containing PEM or DER-encoded data.public static org.bouncycastle.asn1.pkcs.CertificationRequest readCsr(InputStream in)
in - Input stream containing PEM or DER-encoded data.public static List<String> commonNames(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
csr - Certificate request.public static List<String> subjectAltNames(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
csr - Certificate request.public static String sigAlgName(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
csr - Certificate request.public static int keyLength(org.bouncycastle.asn1.pkcs.CertificationRequest csr)
csr - Certificate request.IllegalArgumentException - if CSR specifies a key algorithm other than RSA or EC.CryptoException - on errors creating a public key from data in the CSR.public static org.bouncycastle.pkcs.PKCS10CertificationRequest generateCsr(KeyPair keyPair, String subjectDN, String... subjectAltNames)
keyPair - Key pair.subjectDN - Subject distinguished name, e.g. "CN=host.example.org, DC=example, DC=org".subjectAltNames - Zero or more DNS subject alternative names.PKCS10CertificationRequest.toASN1Structure() to get the
underlying CertificationRequest that may be used with other helper methods.IllegalArgumentException - if CSR specifies a key algorithm other than RSA or EC.CryptoException - on errors generating the CSR from data provided.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.