public class BouncyCastleUtil extends Object
Constructor and Description |
---|
BouncyCastleUtil() |
Modifier and Type | Method and Description |
---|---|
static org.bouncycastle.asn1.ASN1Primitive |
duplicate(org.bouncycastle.asn1.ASN1Primitive obj)
Replicates a given
DERObject . |
static GSIConstants.CertificateType |
getCertificateType(org.bouncycastle.asn1.x509.TBSCertificateStructure crt,
TrustedCertificates trustedCerts) |
static GSIConstants.CertificateType |
getCertificateType(X509Certificate cert)
Returns certificate type of the given certificate.
|
static GSIConstants.CertificateType |
getCertificateType(X509Certificate cert,
CertStore trustedCerts)
Returns the certificate type of the given certificate.
|
static GSIConstants.CertificateType |
getCertificateType(X509Certificate cert,
TrustedCertificates trustedCerts)
Deprecated.
|
static org.bouncycastle.asn1.ASN1Primitive |
getExtensionObject(org.bouncycastle.asn1.x509.X509Extension ext)
Extracts the value of a certificate extension.
|
static byte[] |
getExtensionValue(byte[] certExtValue)
Retrieves the actual value of the X.509 extension.
|
static byte[] |
getExtensionValue(X509Certificate cert,
String oid)
Returns the actual value of the extension.
|
static String |
getIdentity(X509Certificate cert)
Returns the subject DN of the given certificate in the Globus format.
|
static String |
getIdentity(X509Certificate[] chain)
Finds the identity certificate in the given chain and
returns the subject DN of that certificate in the Globus format.
|
static X509Certificate |
getIdentityCertificate(X509Certificate[] chain)
Finds the identity certificate in the given chain.
|
static String |
getIdentityPrefix(X509Certificate cert) |
static boolean[] |
getKeyUsage(org.bouncycastle.asn1.x509.X509Extension ext)
Gets a boolean array representing bits of the KeyUsage extension.
|
static ProxyCertInfo |
getProxyCertInfo(org.bouncycastle.asn1.x509.TBSCertificateStructure crt) |
static ProxyCertInfo |
getProxyCertInfo(org.bouncycastle.asn1.x509.X509Extension ext)
Creates a
ProxyCertInfo object from given
extension. |
static int |
getProxyPathConstraint(org.bouncycastle.asn1.x509.TBSCertificateStructure crt) |
static int |
getProxyPathConstraint(X509Certificate cert) |
static org.bouncycastle.asn1.x509.TBSCertificateStructure |
getTBSCertificateStructure(X509Certificate cert)
Extracts the TBS certificate from the given certificate.
|
static org.bouncycastle.asn1.ASN1Primitive |
toASN1Primitive(byte[] data)
Converts the DER-encoded byte array into a
DERObject . |
static byte[] |
toByteArray(org.bouncycastle.asn1.ASN1Primitive obj)
Converts given
DERObject into
a DER-encoded byte array. |
public static byte[] toByteArray(org.bouncycastle.asn1.ASN1Primitive obj) throws IOException
DERObject
into
a DER-encoded byte array.obj
- DERObject to convert.IOException
- if conversion failspublic static org.bouncycastle.asn1.ASN1Primitive toASN1Primitive(byte[] data) throws IOException
DERObject
.data
- the DER-encoded byte array to convert.IOException
- if conversion failspublic static org.bouncycastle.asn1.ASN1Primitive duplicate(org.bouncycastle.asn1.ASN1Primitive obj) throws IOException
DERObject
.obj
- the DERObject to replicate.IOException
- if replication failspublic static org.bouncycastle.asn1.x509.TBSCertificateStructure getTBSCertificateStructure(X509Certificate cert) throws CertificateEncodingException, IOException
cert
- the X.509 certificate to extract the TBS certificate from.IOException
- if extraction fails.CertificateEncodingException
- if extraction fails.public static org.bouncycastle.asn1.ASN1Primitive getExtensionObject(org.bouncycastle.asn1.x509.X509Extension ext) throws IOException
ext
- the certificate extension to extract the value from.IOException
- if extraction fails.public static GSIConstants.CertificateType getCertificateType(X509Certificate cert, TrustedCertificates trustedCerts) throws CertificateException
getCertificateType
for details for
determining the certificate type.cert
- the certificate to get the type of.trustedCerts
- the trusted certificates to double check the
GSIConstants.EEC
certificate against.getCertificateType
.CertificateException
- if something goes wrong.public static GSIConstants.CertificateType getCertificateType(X509Certificate cert, CertStore trustedCerts) throws CertificateException
getCertificateType
for details for
determining the certificate type.cert
- the certificate to get the type of.trustedCerts
- the trusted certificates to double check the
GSIConstants.EEC
certificate against.getCertificateType
.CertificateException
- if something goes wrong.public static GSIConstants.CertificateType getCertificateType(X509Certificate cert) throws CertificateException
getCertificateType
for details for determining the certificate type.cert
- the certificate to get the type of.getCertificateType
.CertificateException
- if something goes wrong.public static GSIConstants.CertificateType getCertificateType(org.bouncycastle.asn1.x509.TBSCertificateStructure crt, TrustedCertificates trustedCerts) throws CertificateException, IOException
CertificateException
IOException
public static boolean[] getKeyUsage(org.bouncycastle.asn1.x509.X509Extension ext) throws IOException
IOException
- if failed to extract the KeyUsage extension value.X509Certificate.getKeyUsage()
public static ProxyCertInfo getProxyCertInfo(org.bouncycastle.asn1.x509.X509Extension ext) throws IOException
ProxyCertInfo
object from given
extension.ext
- the extension.ProxyCertInfo
object.IOException
- if something fails.public static String getIdentity(X509Certificate cert)
cert
- the certificate to get the subject of. The certificate
must be of X509CertificateObject
type.public static String getIdentityPrefix(X509Certificate cert)
public static String getIdentity(X509Certificate[] chain) throws CertificateException
chain
- the certificate chain to find the identity
certificate in. The certificates must be
of X509CertificateObject
type.CertificateException
- if something goes wrong.public static X509Certificate getIdentityCertificate(X509Certificate[] chain) throws CertificateException
chain
- the certificate chain to find the identity
certificate in.CertificateException
- if something goes wrong.public static byte[] getExtensionValue(byte[] certExtValue) throws IOException
certExtValue
- the DER-encoded OCTET string value of the extension.IOException
public static byte[] getExtensionValue(X509Certificate cert, String oid) throws IOException
cert
- the certificate that contains the extensions to retrieve.oid
- the oid of the extension to retrieve.IOException
- if decoding the extension fails.public static int getProxyPathConstraint(X509Certificate cert) throws IOException, CertificateEncodingException
public static int getProxyPathConstraint(org.bouncycastle.asn1.x509.TBSCertificateStructure crt) throws IOException
IOException
public static ProxyCertInfo getProxyCertInfo(org.bouncycastle.asn1.x509.TBSCertificateStructure crt) throws IOException
IOException
Copyright © 2016. All rights reserved.