Package org.xipki.security
Class X509Cert
- java.lang.Object
-
- org.xipki.security.X509Cert
-
public class X509Cert extends Object
Wrapper to anX509Certificate.- Since:
- 5.3.8
- Author:
- Lijun Liao (xipki)
-
-
Constructor Summary
Constructors Constructor Description X509Cert(X509Certificate cert)X509Cert(X509Certificate cert, byte[] encoded)X509Cert(org.bouncycastle.asn1.x509.Certificate cert)X509Cert(org.bouncycastle.asn1.x509.Certificate cert, byte[] encoded)X509Cert(org.bouncycastle.cert.X509CertificateHolder cert)X509Cert(org.bouncycastle.cert.X509CertificateHolder cert, byte[] encoded)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)byte[]getAuthorityKeyId()intgetBasicConstraints()Gets the certificate constraints path length from the criticalBasicConstraintsextension, (OID = 2.5.29.19).StringgetCommonName()byte[]getEncoded()byte[]getExtensionCoreValue(org.bouncycastle.asn1.ASN1ObjectIdentifier extnType)org.bouncycastle.asn1.x500.X500NamegetIssuer()StringgetIssuerText()boolean[]getKeyUsage()InstantgetNotAfter()InstantgetNotBefore()PublicKeygetPublicKey()BigIntegergetSerialNumber()StringgetSerialNumberHex()org.bouncycastle.asn1.x500.X500NamegetSubject()byte[]getSubjectAltNames()byte[]getSubjectKeyId()org.bouncycastle.asn1.x509.SubjectPublicKeyInfogetSubjectPublicKeyInfo()StringgetSubjectText()inthashCode()booleanhasKeyusage(KeyUsage usage)booleanisSelfSigned()org.bouncycastle.cert.X509CertificateHoldertoBcCert()X509CertificatetoJceCert()voidverify(PublicKey key)voidverify(PublicKey key, String sigProvider)
-
-
-
Constructor Detail
-
X509Cert
public X509Cert(org.bouncycastle.asn1.x509.Certificate cert)
-
X509Cert
public X509Cert(org.bouncycastle.asn1.x509.Certificate cert, byte[] encoded)
-
X509Cert
public X509Cert(X509Certificate cert)
-
X509Cert
public X509Cert(X509Certificate cert, byte[] encoded)
-
X509Cert
public X509Cert(org.bouncycastle.cert.X509CertificateHolder cert)
-
X509Cert
public X509Cert(org.bouncycastle.cert.X509CertificateHolder cert, byte[] encoded)
-
-
Method Detail
-
getBasicConstraints
public int getBasicConstraints()
Gets the certificate constraints path length from the criticalBasicConstraintsextension, (OID = 2.5.29.19).The basic constraints extension identifies whether the subject of the certificate is a Certificate Authority (CA) and how deep a certification path may exist through that CA. The
pathLenConstraintfield (see below) is meaningful only ifcAis set to TRUE. In this case, it gives the maximum number of CA certificates that may follow this certificate in a certification path. A value of zero indicates that only an end-entity certificate may follow in the path.The ASN.1 definition for this is:
BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL }- Returns:
- the value of
pathLenConstraintif the BasicConstraints extension is present in the certificate and the subject of the certificate is a CA, otherwise -1. If the subject of the certificate is a CA andpathLenConstraintdoes not appear,Integer.MAX_VALUEis returned to indicate that there is no limit to the allowed length of the certification path.
-
getSerialNumber
public BigInteger getSerialNumber()
-
getSerialNumberHex
public String getSerialNumberHex()
-
getPublicKey
public PublicKey getPublicKey()
-
getKeyUsage
public boolean[] getKeyUsage()
-
getSubjectAltNames
public byte[] getSubjectAltNames()
-
getIssuer
public org.bouncycastle.asn1.x500.X500Name getIssuer()
-
getSubject
public org.bouncycastle.asn1.x500.X500Name getSubject()
-
getSubjectKeyId
public byte[] getSubjectKeyId()
-
getAuthorityKeyId
public byte[] getAuthorityKeyId()
-
getSubjectText
public String getSubjectText()
-
getIssuerText
public String getIssuerText()
-
getSubjectPublicKeyInfo
public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo()
-
toJceCert
public X509Certificate toJceCert()
-
toBcCert
public org.bouncycastle.cert.X509CertificateHolder toBcCert()
-
isSelfSigned
public boolean isSelfSigned()
-
getNotBefore
public Instant getNotBefore()
-
getNotAfter
public Instant getNotAfter()
-
getEncoded
public byte[] getEncoded()
-
getCommonName
public String getCommonName()
-
verify
public void verify(PublicKey key) throws SignatureException, InvalidKeyException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException
-
verify
public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, NoSuchProviderException
-
getExtensionCoreValue
public byte[] getExtensionCoreValue(org.bouncycastle.asn1.ASN1ObjectIdentifier extnType)
-
hasKeyusage
public boolean hasKeyusage(KeyUsage usage)
-
-