Top Description Fields Constructors Methods
org.conscrypt

pack-priv final Class OpenSSLX509CRL

extends X509CRL
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .InputStream, java.math.BigInteger, java.security.InvalidKeyException, .NoSuchAlgorithmException, .NoSuchProviderException, .Principal, .PublicKey, .Signature, .SignatureException, java.security.cert.CRLException, .Certificate, .X509CRL, .X509CRLEntry, .X509Certificate, java.util.ArrayList, .Arrays, .Calendar, .Date, .HashSet, .List, .Set, .TimeZone, javax.crypto.BadPaddingException, .IllegalBlockSizeException, javax.security.auth.x500.X500Principal, org.conscrypt.OpenSSLX509CertificateFactory.ParsingException

An implementation of X509CRL based on BoringSSL.

Field Summary

Modifier and TypeField and Description
private final long
private final Date
private final Date

Constructor Summary

AccessConstructor and Description
private
OpenSSLX509CRL(long ctx)

Method Summary

Modifier and TypeMethod and Description
protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
pack-priv static List<OpenSSLX509CRL>
pack-priv static List<OpenSSLX509CRL>
pack-priv static OpenSSLX509CRL
pack-priv static OpenSSLX509CRL
public Set<String>
getCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface.
public byte[]
getEncoded()

Implements abstract java.security.cert.X509CRL.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL.
public byte[]
getExtensionValue(String
the Object Identifier value for the extension.
oid
)

Implements java.security.cert.X509Extension.getExtensionValue.

Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String.
public Principal
getIssuerDN()

Implements abstract java.security.cert.X509CRL.getIssuerDN.

Gets the issuer (issuer distinguished name) value from the CRL.
public X500Principal
getIssuerX500Principal()

Overrides java.security.cert.X509CRL.getIssuerX500Principal.

Returns the issuer (issuer distinguished name) value from the CRL as an X500Principal.
public Date
getNextUpdate()

Implements abstract java.security.cert.X509CRL.getNextUpdate.

Gets the nextUpdate date from the CRL.
public Set<String>
getNonCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface.
public X509CRLEntry
getRevokedCertificate(BigInteger
the serial number of the certificate for which a CRL entry is to be looked up
serialNumber
)

Implements abstract java.security.cert.X509CRL.getRevokedCertificate.

Gets the CRL entry, if any, with the given certificate serialNumber.
public X509CRLEntry
getRevokedCertificate(X509Certificate
the certificate for which a CRL entry is to be looked up
certificate
)

Overrides java.security.cert.X509CRL.getRevokedCertificate.

Get the CRL entry, if any, for the given certificate.
public Set<? extends X509CRLEntry>
getRevokedCertificates()

Implements abstract java.security.cert.X509CRL.getRevokedCertificates.

Gets all the entries from this CRL.
public String
getSigAlgName()

Implements abstract java.security.cert.X509CRL.getSigAlgName.

Gets the signature algorithm name for the CRL signature algorithm.
public String
getSigAlgOID()

Implements abstract java.security.cert.X509CRL.getSigAlgOID.

Gets the signature algorithm OID string from the CRL.
public byte[]
getSigAlgParams()

Implements abstract java.security.cert.X509CRL.getSigAlgParams.

Gets the DER-encoded signature algorithm parameters from this CRL's signature algorithm.
public byte[]
getSignature()

Implements abstract java.security.cert.X509CRL.getSignature.

Gets the signature value (the raw signature bits) from the CRL.
public byte[]
getTBSCertList()

Implements abstract java.security.cert.X509CRL.getTBSCertList.

Gets the DER-encoded CRL information, the tbsCertList from this CRL.
public Date
getThisUpdate()

Implements abstract java.security.cert.X509CRL.getThisUpdate.

Gets the thisUpdate date from the CRL.
public int
getVersion()

Implements abstract java.security.cert.X509CRL.getVersion.

Gets the version (version number) value from the CRL.
public boolean
hasUnsupportedCriticalExtension()

Implements java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

Check if there is a critical extension that is not supported.
public boolean
isRevoked(Certificate
the certificate to check for.
cert
)

Implements abstract java.security.cert.CRL.isRevoked.

Checks whether the given certificate is on this CRL.
pack-priv static Date
toDate(long asn1time)

public String
toString()

Implements abstract java.security.cert.CRL.toString.

Returns a string representation of this CRL.
public void
verify(PublicKey
the PublicKey used to carry out the verification.
key
)

Implements abstract java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.
public void
verify(PublicKey
the PublicKey used to carry out the verification.
key
,
String
the name of the signature provider.
sigProvider
)

Implements abstract java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.
private void
verifyInternal(PublicKey key, String sigProvider)

private void
Inherited from java.security.cert.X509CRL:
equalshashCodeverify

Field Detail

mContextback to summary
private final long mContext
nextUpdateback to summary
private final Date nextUpdate
thisUpdateback to summary
private final Date thisUpdate

Constructor Detail

OpenSSLX509CRLback to summary
private OpenSSLX509CRL(long ctx) throws ParsingException

Method Detail

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
fromPkcs7DerInputStreamback to summary
pack-priv static List<OpenSSLX509CRL> fromPkcs7DerInputStream(InputStream is) throws ParsingException
fromPkcs7PemInputStreamback to summary
pack-priv static List<OpenSSLX509CRL> fromPkcs7PemInputStream(InputStream is) throws ParsingException
fromX509DerInputStreamback to summary
pack-priv static OpenSSLX509CRL fromX509DerInputStream(InputStream is) throws ParsingException
fromX509PemInputStreamback to summary
pack-priv static OpenSSLX509CRL fromX509PemInputStream(InputStream is) throws ParsingException
getCriticalExtensionOIDsback to summary
public Set<String> getCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getCriticalExtensionOIDs.

Doc from java.security.cert.X509Extension.getCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of critical extensions from an X509Certificate and print the OIDs:

X509Certificate cert = null;
try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    cert = (X509Certificate)cf.generateCertificate(inStrm);
}

Set<String> critSet = cert.getCriticalExtensionOIDs();
if (critSet != null && !critSet.isEmpty()) {
    System.out.println("Set of critical extensions:");
    for (String oid : critSet) {
        System.out.println(oid);
    }
}
Returns:Set<String>

a Set (or an empty Set if none are marked critical) of the extension OID strings for extensions that are marked critical. If there are no extensions present at all, then this method returns null.

Annotations
@Override
getEncodedback to summary
public byte[] getEncoded() throws CRLException

Implements abstract java.security.cert.X509CRL.getEncoded.

Doc from java.security.cert.X509CRL.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL.

Returns:byte[]

the encoded form of this certificate

Annotations
@Override
Exceptions
CRLException:
if an encoding error occurs.
getExtensionValueback to summary
public byte[] getExtensionValue(String oid)

Implements java.security.cert.X509Extension.getExtensionValue.

Doc from java.security.cert.X509Extension.getExtensionValue.

Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String. The oid string is represented by a set of nonnegative whole numbers separated by periods.

For example:

Examples of OIDs and extension names
OID (Object Identifier) Extension Name
2.5.29.14 SubjectKeyIdentifier
2.5.29.15 KeyUsage
2.5.29.16 PrivateKeyUsage
2.5.29.17 SubjectAlternativeName
2.5.29.18 IssuerAlternativeName
2.5.29.19 BasicConstraints
2.5.29.30 NameConstraints
2.5.29.33 PolicyMappings
2.5.29.35 AuthorityKeyIdentifier
2.5.29.36 PolicyConstraints
Parameters
oid:String

the Object Identifier value for the extension.

Returns:byte[]

the DER-encoded octet string of the extension value or null if it is not present.

Annotations
@Override
getIssuerDNback to summary
public Principal getIssuerDN()

Implements abstract java.security.cert.X509CRL.getIssuerDN.

Doc from java.security.cert.X509CRL.getIssuerDN.

Gets the issuer (issuer distinguished name) value from the CRL. The issuer name identifies the entity that signed (and issued) the CRL.

The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is:

issuer    Name

Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::=
    SET OF AttributeValueAssertion

AttributeValueAssertion ::= SEQUENCE {
                              AttributeType,
                              AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY
The Name describes a hierarchical name composed of attributes, such as country name, and corresponding values, such as US. The type of the AttributeValue component is determined by the AttributeType; in general it will be a directoryString. A directoryString is usually one of PrintableString, TeletexString or UniversalString.
Returns:Principal

a Principal whose name is the issuer distinguished name.

Annotations
@Override
getIssuerX500Principalback to summary
public X500Principal getIssuerX500Principal()

Overrides java.security.cert.X509CRL.getIssuerX500Principal.

Doc from java.security.cert.X509CRL.getIssuerX500Principal.

Returns the issuer (issuer distinguished name) value from the CRL as an X500Principal.

It is recommended that subclasses override this method.

Returns:X500Principal

an X500Principal representing the issuer distinguished name

Annotations
@Override
getNextUpdateback to summary
public Date getNextUpdate()

Implements abstract java.security.cert.X509CRL.getNextUpdate.

Doc from java.security.cert.X509CRL.getNextUpdate.

Gets the nextUpdate date from the CRL.

Returns:Date

the nextUpdate date from the CRL, or null if not present.

Annotations
@Override
getNonCriticalExtensionOIDsback to summary
public Set<String> getNonCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Doc from java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of non-critical extensions from an X509CRL revoked certificate entry and print the OIDs:

CertificateFactory cf = null;
X509CRL crl = null;
try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
    cf = CertificateFactory.getInstance("X.509");
    crl = (X509CRL)cf.generateCRL(inStrm);
}

byte[] certData = <DER-encoded certificate data>
ByteArrayInputStream bais = new ByteArrayInputStream(certData);
X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
X509CRLEntry badCert =
             crl.getRevokedCertificate(cert.getSerialNumber());

if (badCert != null) {
    Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();
    if (nonCritSet != null)
        for (String oid : nonCritSet) {
            System.out.println(oid);
        }
}
Returns:Set<String>

a Set (or an empty Set if none are marked non-critical) of the extension OID strings for extensions that are marked non-critical. If there are no extensions present at all, then this method returns null.

Annotations
@Override
getRevokedCertificateback to summary
public X509CRLEntry getRevokedCertificate(BigInteger serialNumber)

Implements abstract java.security.cert.X509CRL.getRevokedCertificate.

Doc from java.security.cert.X509CRL.getRevokedCertificate.

Gets the CRL entry, if any, with the given certificate serialNumber.

Parameters
serialNumber:BigInteger

the serial number of the certificate for which a CRL entry is to be looked up

Returns:X509CRLEntry

the entry with the given serial number, or null if no such entry exists in this CRL.

Annotations
@Override
getRevokedCertificateback to summary
public X509CRLEntry getRevokedCertificate(X509Certificate certificate)

Overrides java.security.cert.X509CRL.getRevokedCertificate.

Doc from java.security.cert.X509CRL.getRevokedCertificate.

Get the CRL entry, if any, for the given certificate.

This method can be used to lookup CRL entries in indirect CRLs, that means CRLs that contain entries from issuers other than the CRL issuer. The default implementation will only return entries for certificates issued by the CRL issuer. Subclasses that wish to support indirect CRLs should override this method.

Parameters
certificate:X509Certificate

the certificate for which a CRL entry is to be looked up

Returns:X509CRLEntry

the entry for the given certificate, or null if no such entry exists in this CRL.

Annotations
@Override
getRevokedCertificatesback to summary
public Set<? extends X509CRLEntry> getRevokedCertificates()

Implements abstract java.security.cert.X509CRL.getRevokedCertificates.

Doc from java.security.cert.X509CRL.getRevokedCertificates.

Gets all the entries from this CRL. This returns a Set of X509CRLEntry objects.

Returns:Set<? extends X509CRLEntry>

all the entries or null if there are none present.

Annotations
@Override
getSigAlgNameback to summary
public String getSigAlgName()

Implements abstract java.security.cert.X509CRL.getSigAlgName.

Doc from java.security.cert.X509CRL.getSigAlgName.

Gets the signature algorithm name for the CRL signature algorithm. An example is the string "SHA256withRSA". The ASN.1 definition for this is:

signatureAlgorithm   AlgorithmIdentifier

AlgorithmIdentifier  ::=  SEQUENCE  {
    algorithm               OBJECT IDENTIFIER,
    parameters              ANY DEFINED BY algorithm OPTIONAL  }
                            -- contains a value of the type
                            -- registered for use with the
                            -- algorithm object identifier value

The algorithm name is determined from the algorithm OID string.

Returns:String

the signature algorithm name.

Annotations
@Override
getSigAlgOIDback to summary
public String getSigAlgOID()

Implements abstract java.security.cert.X509CRL.getSigAlgOID.

Doc from java.security.cert.X509CRL.getSigAlgOID.

Gets the signature algorithm OID string from the CRL. An OID is represented by a set of nonnegative whole numbers separated by periods. For example, the string "1.2.840.10040.4.3" identifies the SHA-1 with DSA signature algorithm defined in RFC 3279: Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and CRL Profile.

See getSigAlgName for relevant ASN.1 definitions.

Returns:String

the signature algorithm OID string.

Annotations
@Override
getSigAlgParamsback to summary
public byte[] getSigAlgParams()

Implements abstract java.security.cert.X509CRL.getSigAlgParams.

Doc from java.security.cert.X509CRL.getSigAlgParams.

Gets the DER-encoded signature algorithm parameters from this CRL's signature algorithm. In most cases, the signature algorithm parameters are null; the parameters are usually supplied with the public key. If access to individual parameter values is needed then use AlgorithmParameters and instantiate with the name returned by getSigAlgName.

See getSigAlgName for relevant ASN.1 definitions.

Returns:byte[]

the DER-encoded signature algorithm parameters, or null if no parameters are present.

Annotations
@Override
getSignatureback to summary
public byte[] getSignature()

Implements abstract java.security.cert.X509CRL.getSignature.

Doc from java.security.cert.X509CRL.getSignature.

Gets the signature value (the raw signature bits) from the CRL. The ASN.1 definition for this is:

signature     BIT STRING
Returns:byte[]

the signature.

Annotations
@Override
getTBSCertListback to summary
public byte[] getTBSCertList() throws CRLException

Implements abstract java.security.cert.X509CRL.getTBSCertList.

Doc from java.security.cert.X509CRL.getTBSCertList.

Gets the DER-encoded CRL information, the tbsCertList from this CRL. This can be used to verify the signature independently.

Returns:byte[]

the DER-encoded CRL information.

Annotations
@Override
Exceptions
CRLException:
if an encoding error occurs.
getThisUpdateback to summary
public Date getThisUpdate()

Implements abstract java.security.cert.X509CRL.getThisUpdate.

Doc from java.security.cert.X509CRL.getThisUpdate.

Gets the thisUpdate date from the CRL. The ASN.1 definition for this is:

thisUpdate   ChoiceOfTime
ChoiceOfTime ::= CHOICE {
    utcTime        UTCTime,
    generalTime    GeneralizedTime }
Returns:Date

the thisUpdate date from the CRL.

Annotations
@Override
getVersionback to summary
public int getVersion()

Implements abstract java.security.cert.X509CRL.getVersion.

Doc from java.security.cert.X509CRL.getVersion.

Gets the version (version number) value from the CRL. The ASN.1 definition for this is:

version    Version OPTIONAL,
            -- if present, must be v2

Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
            -- v3 does not apply to CRLs but appears for consistency
            -- with definition of Version for certs
Returns:int

the version number, i.e. 1 or 2.

Annotations
@Override
hasUnsupportedCriticalExtensionback to summary
public boolean hasUnsupportedCriticalExtension()

Implements java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

Doc from java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

Check if there is a critical extension that is not supported.

Returns:boolean

true if a critical extension is found that is not supported, otherwise false.

Annotations
@Override
isRevokedback to summary
public boolean isRevoked(Certificate cert)

Implements abstract java.security.cert.CRL.isRevoked.

Doc from java.security.cert.CRL.isRevoked.

Checks whether the given certificate is on this CRL.

Parameters
cert:Certificate

the certificate to check for.

Returns:boolean

true if the given certificate is on this CRL, false otherwise.

Annotations
@Override
toDateback to summary
pack-priv static Date toDate(long asn1time) throws ParsingException
toStringback to summary
public String toString()

Implements abstract java.security.cert.CRL.toString.

Doc from java.security.cert.CRL.toString.

Returns a string representation of this CRL.

Returns:String

a string representation of this CRL.

Annotations
@Override
verifyback to summary
public void verify(PublicKey key) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException

Implements abstract java.security.cert.X509CRL.verify.

Doc from java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.

Parameters
key:PublicKey

the PublicKey used to carry out the verification.

Annotations
@Override
Exceptions
CRLException:
on encoding errors.
NoSuchAlgorithmException:
on unsupported signature algorithms.
InvalidKeyException:
on incorrect key.
NoSuchProviderException:
if there's no default provider.
SignatureException:
on signature errors.
verifyback to summary
public void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException

Implements abstract java.security.cert.X509CRL.verify.

Doc from java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key. This method uses the signature verification engine supplied by the given provider.

Parameters
key:PublicKey

the PublicKey used to carry out the verification.

sigProvider:String

the name of the signature provider.

Annotations
@Override
Exceptions
CRLException:
on encoding errors.
NoSuchAlgorithmException:
on unsupported signature algorithms.
InvalidKeyException:
on incorrect key.
NoSuchProviderException:
on incorrect provider.
SignatureException:
on signature errors.
verifyInternalback to summary
private void verifyInternal(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verifyOpenSSLback to summary
private void verifyOpenSSL(OpenSSLKey pkey) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException