Top Description Inners Fields Constructors Methods
org.bouncycastle.pkix.jcajce

public Class X509RevocationChecker

extends PKIXCertPathChecker
Class Inheritance
Imports
java.net.URI, java.security.GeneralSecurityException, .KeyStore, .KeyStoreException, .Provider, .PublicKey, java.security.cert.CRL, .CertPathValidatorException, .CertStore, .CertStoreException, .Certificate, .CertificateFactory, .PKIXCertPathChecker, .PKIXParameters, .TrustAnchor, .X509CRL, .X509CRLSelector, .X509Certificate, java.text.SimpleDateFormat, java.util.ArrayList, .Collection, .Collections, .Date, .Enumeration, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, .TimeZone, java.util.logging.Level, .Logger, javax.security.auth.x500.X500Principal, org.bouncycastle.asn1.ASN1Primitive, .ASN1String, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.CRLDistPoint, .DistributionPoint, .DistributionPointName, .Extension, .GeneralName, .GeneralNames, org.bouncycastle.jcajce.PKIXCRLStore, .PKIXCRLStoreSelector, .PKIXExtendedParameters, org.bouncycastle.jcajce.util.JcaJceHelper, org.bouncycastle.util.CollectionStore, .Iterable, .Selector, .Store

X.509 Certificate Revocation Checker - still lacks OCSP support and support for delta CRLs.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private class

Field Summary

Modifier and TypeField and Description
private final boolean
public static final int
CHAIN_VALIDITY_MODEL

This model uses the following validity model.

private final List<CertStore>
protected static final String[]
private final List<Store<CRL>>
private Date
private final long
private final long
private final Map<X500Principal, Long>
private final PKIXJcaJceHelper
private final boolean
private static Logger
public static final int
PKIX_VALIDITY_MODEL

This is the default PKIX validity model.

private X509Certificate
private final Set<TrustAnchor>
private final Date
private final int
private X500Principal
private PublicKey

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
addIssuers(final List<X500Principal> issuerList, CertStore certStore)

private void
addIssuers(final List<X500Principal> issuerList, Store<CRL> certStore)

public void
check(Certificate
the Certificate to be checked
certificate
,
Collection<String>
a Collection of OID strings representing the current set of unresolved critical extensions
collection
)

Implements abstract java.security.cert.PKIXCertPathChecker.check.

Performs the check(s) on the specified certificate using its internal state and removes any critical extensions that it processes from the specified collection of OID strings that represent the unresolved critical extensions.
protected void
checkCRLs(PKIXExtendedParameters
PKIX parameters.
pkixParams
,
Date currentDate, Date
The date when the certificate revocation status should be checked.
validityDate
,
X509Certificate
Certificate to check if it is revoked.
cert
,
X509Certificate
The issuer certificate of the certificate cert.
sign
,
PublicKey
The public key of the issuer certificate sign.
workingPublicKey
,
List<E>
The certificates of the certification path.
certPathCerts
,
PKIXJcaJceHelper helper)

Checks a certificate if it is revoked.

public Object
clone()

Overrides java.security.cert.PKIXCertPathChecker.clone.

Returns a clone of this object.
private Set<CRL>
downloadCRLs(X500Principal issuer, Date currentDate, ASN1Primitive crlDpPrimitive, JcaJceHelper helper)

pack-priv static List<PKIXCRLStore<T extends CRL>>
public Set<String>
getSupportedExtensions()

Implements abstract java.security.cert.PKIXCertPathChecker.getSupportedExtensions.

Returns an immutable Set of X.509 certificate extensions that this PKIXCertPathChecker supports (i.e. recognizes, is able to process), or null if no extensions are supported.
public void
init(boolean
the order that certificates are presented to the check method. If true, certificates are presented from target to most-trusted CA (forward); if false, from most-trusted CA to target (reverse).
forward
)

Implements abstract java.security.cert.PKIXCertPathChecker.init.

Implements java.security.cert.CertPathChecker.init.

Initializes the internal state of this PKIXCertPathChecker.
public boolean
Inherited from java.security.cert.PKIXCertPathChecker:
check

Field Detail

canSoftFailback to summary
private final boolean canSoftFail
CHAIN_VALIDITY_MODELback to summary
public static final int CHAIN_VALIDITY_MODEL

This model uses the following validity model. Each certificate must have been valid at the moment where is was used. That means the end certificate must have been valid at the time the signature was done. The CA certificate which signed the end certificate must have been valid, when the end certificate was signed. The CA (or Root CA) certificate must have been valid, when the CA certificate was signed and so on. So the PKIXParameters#setDate(Date) method sets the time, when the end certificate must have been valid. It is used e.g. in the German signature law.

crlCertStoresback to summary
private final List<CertStore> crlCertStores
crlReasonsback to summary
protected static final String[] crlReasons
crlsback to summary
private final List<Store<CRL>> crls
currentDateback to summary
private Date currentDate
failHardMaxTimeback to summary
private final long failHardMaxTime
failLogMaxTimeback to summary
private final long failLogMaxTime
failuresback to summary
private final Map<X500Principal, Long> failures
helperback to summary
private final PKIXJcaJceHelper helper
isCheckEEOnlyback to summary
private final boolean isCheckEEOnly
LOGback to summary
private static Logger LOG
PKIX_VALIDITY_MODELback to summary
public static final int PKIX_VALIDITY_MODEL

This is the default PKIX validity model. Actually there are two variants of this: The PKIX model and the modified PKIX model. The PKIX model verifies that all involved certificates must have been valid at the current time. The modified PKIX model verifies that all involved certificates were valid at the time of signing. Both are indirectly chosen with the PKIXParameters#setDate(Date) method, so this methods sets the Date when all certificates must have been valid.

signingCertback to summary
private X509Certificate signingCert
trustAnchorsback to summary
private final Set<TrustAnchor> trustAnchors
validationDateback to summary
private final Date validationDate
validityModelback to summary
private final int validityModel
workingIssuerNameback to summary
private X500Principal workingIssuerName
workingPublicKeyback to summary
private PublicKey workingPublicKey

Constructor Detail

X509RevocationCheckerback to summary
private X509RevocationChecker(X509RevocationChecker.Builder bldr)

Method Detail

addIssuersback to summary
private void addIssuers(final List<X500Principal> issuerList, CertStore certStore) throws CertStoreException
addIssuersback to summary
private void addIssuers(final List<X500Principal> issuerList, Store<CRL> certStore)
checkback to summary
public void check(Certificate certificate, Collection<String> collection) throws CertPathValidatorException

Implements abstract java.security.cert.PKIXCertPathChecker.check.

Doc from java.security.cert.PKIXCertPathChecker.check.

Performs the check(s) on the specified certificate using its internal state and removes any critical extensions that it processes from the specified collection of OID strings that represent the unresolved critical extensions. The certificates are presented in the order specified by the init method.

Parameters
certificate:Certificate

the Certificate to be checked

collection:Collection<String>

a Collection of OID strings representing the current set of unresolved critical extensions

Exceptions
CertPathValidatorException:
if the specified certificate does not pass the check
checkCRLsback to summary
protected void checkCRLs(PKIXExtendedParameters pkixParams, Date currentDate, Date validityDate, X509Certificate cert, X509Certificate sign, PublicKey workingPublicKey, List<E> certPathCerts, PKIXJcaJceHelper helper) throws AnnotatedException, CertPathValidatorException

Checks a certificate if it is revoked.

Parameters
pkixParams:PKIXExtendedParameters

PKIX parameters.

validityDate:Date

The date when the certificate revocation status should be checked.

cert:X509Certificate

Certificate to check if it is revoked.

sign:X509Certificate

The issuer certificate of the certificate cert.

workingPublicKey:PublicKey

The public key of the issuer certificate sign.

certPathCerts:List<E>

The certificates of the certification path.

Exceptions
AnnotatedException:
if the certificate is revoked or the status cannot be checked or some error occurs.
cloneback to summary
public Object clone()

Overrides java.security.cert.PKIXCertPathChecker.clone.

Doc from java.security.cert.PKIXCertPathChecker.clone.

Returns a clone of this object. Calls the Object.clone() method. All subclasses which maintain state must support and override this method, if necessary.

Returns:Object

a copy of this PKIXCertPathChecker

downloadCRLsback to summary
private Set<CRL> downloadCRLs(X500Principal issuer, Date currentDate, ASN1Primitive crlDpPrimitive, JcaJceHelper helper)
getAdditionalStoresFromCRLDistributionPointback to summary
pack-priv static List<PKIXCRLStore<T extends CRL>> getAdditionalStoresFromCRLDistributionPoint(CRLDistPoint crldp, Map<GeneralName, PKIXCRLStore<T extends CRL>> namedCRLStoreMap) throws AnnotatedException
getSupportedExtensionsback to summary
public Set<String> getSupportedExtensions()

Implements abstract java.security.cert.PKIXCertPathChecker.getSupportedExtensions.

Doc from java.security.cert.PKIXCertPathChecker.getSupportedExtensions.

Returns an immutable Set of X.509 certificate extensions that this PKIXCertPathChecker supports (i.e. recognizes, is able to process), or null if no extensions are supported.

Each element of the set is a String representing the Object Identifier (OID) of the X.509 extension that is supported. The OID is represented by a set of nonnegative integers separated by periods.

All X.509 certificate extensions that a PKIXCertPathChecker might possibly be able to process should be included in the set.

Returns:Set<String>

an immutable Set of X.509 extension OIDs (in String format) supported by this PKIXCertPathChecker, or null if no extensions are supported

initback to summary
public void init(boolean forward) throws CertPathValidatorException

Implements abstract java.security.cert.PKIXCertPathChecker.init.

Implements java.security.cert.CertPathChecker.init.

Doc from java.security.cert.PKIXCertPathChecker.init.

Initializes the internal state of this PKIXCertPathChecker.

The forward flag specifies the order that certificates will be passed to the check method (forward or reverse). A PKIXCertPathChecker must support reverse checking and may support forward checking.

Parameters
forward:boolean

the order that certificates are presented to the check method. If true, certificates are presented from target to most-trusted CA (forward); if false, from most-trusted CA to target (reverse).

Exceptions
CertPathValidatorException:
if this PKIXCertPathChecker is unable to check certificates in the specified order; it should never be thrown if the forward flag is false since reverse checking must be supported
isForwardCheckingSupportedback to summary
public boolean isForwardCheckingSupported()

Implements abstract java.security.cert.PKIXCertPathChecker.isForwardCheckingSupported.

Implements java.security.cert.CertPathChecker.isForwardCheckingSupported.

Doc from java.security.cert.PKIXCertPathChecker.isForwardCheckingSupported.

Indicates if forward checking is supported. Forward checking refers to the ability of the PKIXCertPathChecker to perform its checks when certificates are presented to the check method in the forward direction (from target to most-trusted CA).

Returns:boolean

true if forward checking is supported, false otherwise

org.bouncycastle.pkix.jcajce back to summary

public Class X509RevocationChecker.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private List<CertStore>
private List<Store<CRL>>
private long
private long
private boolean
private Provider
private String
private Set<TrustAnchor>
private Date
private int

Constructor Summary

AccessConstructor and Description
public
Builder(TrustAnchor
the trust anchor our chain should start with.
trustAnchor
)

Base constructor.

public
Builder(Set<TrustAnchor>
a set of potential trust anchors
trustAnchors
)

Base constructor.

public
Builder(KeyStore
a keystore of potential trust anchors
trustStore
)

Base constructor.

Method Summary

Modifier and TypeMethod and Description
public X509RevocationChecker.Builder

Returns:

the current builder instance.
addCrls
(CertStore
CRLs to be examined.
crls
)

Add a collection of CRLs to the checker.

public X509RevocationChecker.Builder

Returns:

the current builder instance.
addCrls
(Store<CRL>
CRLs to be examined.
crls
)

Add a collection of CRLs to the checker.

public X509RevocationChecker

Returns:

a new X509RevocationChecker.
build
()

Build a revocation checker conforming to the current builder.

public X509RevocationChecker.Builder

Returns:

the current builder instance.
setCheckEndEntityOnly
(boolean
true if only end-entities should be checked, false otherwise.
isTrue
)

public X509RevocationChecker.Builder

Returns:

the current builder instance.
setDate
(Date
date we are validating for.
validityDate
)

Set the current date for checking if not today.

public X509RevocationChecker.Builder

Returns:

the current builder instance.
setSoftFail
(boolean
true soft failure should be enabled, false otherwise.
isTrue
,
long
the time that can pass between the first failure and the most recent.
maxTime
)

Configure soft failure if CRLs/OCSP not available.

public X509RevocationChecker.Builder

Returns:

the current builder instance.
setSoftFailHardLimit
(boolean
true soft failure should be enabled, false otherwise.
isTrue
,
long
the time that can pass between the first failure and the most recent.
maxTime
)

Configure soft failure with a hard limit if CRLs/OCSP not available.

public X509RevocationChecker.Builder
setValidityModel(int
The validity model to set.
validityModel
)

public X509RevocationChecker.Builder

Returns:

the current builder instance.
usingProvider
(Provider
provider to use.
provider
)

Configure to use the installed provider with name ProviderName.

public X509RevocationChecker.Builder

Returns:

the current builder instance.
usingProvider
(String
name of the installed provider to use.
providerName
)

Configure to use the installed provider with name ProviderName.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canSoftFailback to summary
private boolean canSoftFail
crlCertStoresback to summary
private List<CertStore> crlCertStores
crlsback to summary
private List<Store<CRL>> crls
failHardMaxTimeback to summary
private long failHardMaxTime
failLogMaxTimeback to summary
private long failLogMaxTime
isCheckEEOnlyback to summary
private boolean isCheckEEOnly
providerback to summary
private Provider provider
providerNameback to summary
private String providerName
trustAnchorsback to summary
private Set<TrustAnchor> trustAnchors
validityDateback to summary
private Date validityDate
validityModelback to summary
private int validityModel

Constructor Detail

Builderback to summary
public Builder(TrustAnchor trustAnchor)

Base constructor.

Parameters
trustAnchor:TrustAnchor

the trust anchor our chain should start with.

Builderback to summary
public Builder(Set<TrustAnchor> trustAnchors)

Base constructor.

Parameters
trustAnchors:Set<TrustAnchor>

a set of potential trust anchors

Builderback to summary
public Builder(KeyStore trustStore) throws KeyStoreException

Base constructor.

Parameters
trustStore:KeyStore

a keystore of potential trust anchors

Method Detail

addCrlsback to summary
public X509RevocationChecker.Builder addCrls(CertStore crls)

Add a collection of CRLs to the checker.

Parameters
crls:CertStore

CRLs to be examined.

Returns:X509RevocationChecker.Builder

the current builder instance.

addCrlsback to summary
public X509RevocationChecker.Builder addCrls(Store<CRL> crls)

Add a collection of CRLs to the checker.

Parameters
crls:Store<CRL>

CRLs to be examined.

Returns:X509RevocationChecker.Builder

the current builder instance.

buildback to summary
public X509RevocationChecker build()

Build a revocation checker conforming to the current builder.

Returns:X509RevocationChecker

a new X509RevocationChecker.

setCheckEndEntityOnlyback to summary
public X509RevocationChecker.Builder setCheckEndEntityOnly(boolean isTrue)
Parameters
isTrue:boolean

true if only end-entities should be checked, false otherwise.

Returns:X509RevocationChecker.Builder

the current builder instance.

setDateback to summary
public X509RevocationChecker.Builder setDate(Date validityDate)

Set the current date for checking if not today.

Parameters
validityDate:Date

date we are validating for.

Returns:X509RevocationChecker.Builder

the current builder instance.

setSoftFailback to summary
public X509RevocationChecker.Builder setSoftFail(boolean isTrue, long maxTime)

Configure soft failure if CRLs/OCSP not available. If maxTime is greater than zero it represents the acceptable downtime for any responders or distribution points we are trying to connect to, with downtime measured from the first failure. Initially failures will log at Level.WARNING, once maxTime is exceeded any failures will be logged as Level.SEVERE. Setting maxTime to zero will mean 1 failure will be allowed before failures are logged as severe.

Parameters
isTrue:boolean

true soft failure should be enabled, false otherwise.

maxTime:long

the time that can pass between the first failure and the most recent.

Returns:X509RevocationChecker.Builder

the current builder instance.

setSoftFailHardLimitback to summary
public X509RevocationChecker.Builder setSoftFailHardLimit(boolean isTrue, long maxTime)

Configure soft failure with a hard limit if CRLs/OCSP not available. If maxTime is greater than zero it represents the acceptable downtime for any responders or distribution points we are trying to connect to, with downtime measured from the first failure. Initially failures will log at Level.WARNING, once 75% of maxTime is exceeded any failures will be logged as Level.SEVERE. At maxTime any failures will be treated as hard, setting maxTime to zero will mean 1 failure will be allowed.

Parameters
isTrue:boolean

true soft failure should be enabled, false otherwise.

maxTime:long

the time that can pass between the first failure and the most recent.

Returns:X509RevocationChecker.Builder

the current builder instance.

setValidityModelback to summary
public X509RevocationChecker.Builder setValidityModel(int validityModel)
Parameters
validityModel:int

The validity model to set.

See Also
CHAIN_VALIDITY_MODEL, PKIX_VALIDITY_MODEL
usingProviderback to summary
public X509RevocationChecker.Builder usingProvider(Provider provider)

Configure to use the installed provider with name ProviderName.

Parameters
provider:Provider

provider to use.

Returns:X509RevocationChecker.Builder

the current builder instance.

usingProviderback to summary
public X509RevocationChecker.Builder usingProvider(String providerName)

Configure to use the installed provider with name ProviderName.

Parameters
providerName:String

name of the installed provider to use.

Returns:X509RevocationChecker.Builder

the current builder instance.

org.bouncycastle.pkix.jcajce back to summary

private Class X509RevocationChecker.LocalCRLStore

extends Object
implements PKIXCRLStore<CRL>, Iterable<CRL>
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.pkix.jcajce.X509RevocationChecker.LocalCRLStore
All Implemented Interfaces
org.bouncycastle.util.Iterable, java.lang.Iterable, org.bouncycastle.jcajce.PKIXCRLStore, org.bouncycastle.util.Store

Field Summary

Modifier and TypeField and Description
private Collection<CRL>

Constructor Summary

AccessConstructor and Description
public
LocalCRLStore(Store<CRL>
- initial contents for the store, this is copied.
collection
)

Basic constructor.

Method Summary

Modifier and TypeMethod and Description
public Collection<CRL>

Returns:

a possibly empty collection of matching objects.
getMatches
(Selector<CRL>
the selector to match against.
selector
)

Implements org.bouncycastle.jcajce.PKIXCRLStore.getMatches.

Return the matches in the collection for the passed in selector.
public Iterator<CRL>
iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Returns an iterator over a set of elements of type T.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_localback to summary
private Collection<CRL> _local

Constructor Detail

LocalCRLStoreback to summary
public LocalCRLStore(Store<CRL> collection)

Basic constructor.

Parameters
collection:Store<CRL>

- initial contents for the store, this is copied.

Method Detail

getMatchesback to summary
public Collection<CRL> getMatches(Selector<CRL> selector)

Implements org.bouncycastle.jcajce.PKIXCRLStore.getMatches.

Return the matches in the collection for the passed in selector.

Parameters
selector:Selector<CRL>

the selector to match against.

Returns:Collection<CRL>

a possibly empty collection of matching objects.

iteratorback to summary
public Iterator<CRL> iterator()

Implements org.bouncycastle.util.Iterable.iterator.

Doc from org.bouncycastle.util.Iterable.iterator.

Returns an iterator over a set of elements of type T.

Returns:Iterator<CRL>

an Iterator.