public class PKIXCertPathReviewer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ANY_POLICY |
protected static java.lang.String |
AUTHORITY_KEY_IDENTIFIER |
protected static java.lang.String |
BASIC_CONSTRAINTS |
protected static java.lang.String |
CERTIFICATE_POLICIES |
protected java.security.cert.CertPath |
certPath |
protected java.util.List |
certs |
protected static java.lang.String |
CRL_DISTRIBUTION_POINTS |
protected static java.lang.String |
CRL_NUMBER |
protected static int |
CRL_SIGN |
protected static org.bouncycastle.x509.PKIXCRLUtil |
CRL_UTIL |
protected static java.lang.String[] |
crlReasons |
protected static java.lang.String |
DELTA_CRL_INDICATOR |
protected java.util.List[] |
errors |
protected static java.lang.String |
FRESHEST_CRL |
protected static java.lang.String |
INHIBIT_ANY_POLICY |
protected static java.lang.String |
ISSUING_DISTRIBUTION_POINT |
protected static int |
KEY_CERT_SIGN |
protected static java.lang.String |
KEY_USAGE |
protected int |
n |
protected static java.lang.String |
NAME_CONSTRAINTS |
protected java.util.List[] |
notifications |
protected java.security.cert.PKIXParameters |
pkixParams |
protected static java.lang.String |
POLICY_CONSTRAINTS |
protected static java.lang.String |
POLICY_MAPPINGS |
protected java.security.cert.PolicyNode |
policyTree |
protected static java.lang.String |
SUBJECT_ALTERNATIVE_NAME |
protected java.security.PublicKey |
subjectPublicKey |
protected java.security.cert.TrustAnchor |
trustAnchor |
protected java.util.Date |
validDate |
Constructor and Description |
---|
PKIXCertPathReviewer()
Creates an empty PKIXCertPathReviewer.
|
PKIXCertPathReviewer(java.security.cert.CertPath certPath,
java.security.cert.PKIXParameters params)
Creates a PKIXCertPathReviewer and initializes it with the given
CertPath and PKIXParameters params |
Modifier and Type | Method and Description |
---|---|
protected static void |
addAdditionalStoreFromLocation(java.lang.String location,
ExtendedPKIXParameters pkixParams) |
protected static void |
addAdditionalStoresFromAltNames(java.security.cert.X509Certificate cert,
ExtendedPKIXParameters pkixParams) |
protected static void |
addAdditionalStoresFromCRLDistributionPoint(CRLDistPoint crldp,
ExtendedPKIXParameters pkixParams) |
protected void |
addError(ErrorBundle msg) |
protected void |
addError(ErrorBundle msg,
int index) |
protected void |
addNotification(ErrorBundle msg) |
protected void |
addNotification(ErrorBundle msg,
int index) |
protected void |
checkCRLs(java.security.cert.PKIXParameters paramsPKIX,
java.security.cert.X509Certificate cert,
java.util.Date validDate,
java.security.cert.X509Certificate sign,
java.security.PublicKey workingPublicKey,
java.util.Vector crlDistPointUrls,
int index) |
protected void |
checkRevocation(java.security.cert.PKIXParameters paramsPKIX,
java.security.cert.X509Certificate cert,
java.util.Date validDate,
java.security.cert.X509Certificate sign,
java.security.PublicKey workingPublicKey,
java.util.Vector crlDistPointUrls,
java.util.Vector ocspUrls,
int index) |
protected void |
doChecks() |
protected static java.util.Collection |
findCertificates(PKIXCertStoreSelector certSelect,
java.util.List certStores) |
protected static java.util.Collection |
findCertificates(X509AttributeCertStoreSelector certSelect,
java.util.List certStores) |
protected static java.util.Collection |
findCertificates(X509CertStoreSelector certSelect,
java.util.List certStores)
Return a Collection of all certificates or attribute certificates found
in the X509Store's that are matching the certSelect criteriums.
|
protected static java.security.cert.TrustAnchor |
findTrustAnchor(java.security.cert.X509Certificate cert,
java.util.Set trustAnchors)
Search the given Set of TrustAnchor's for one that is the
issuer of the given X509 certificate.
|
protected static java.security.cert.TrustAnchor |
findTrustAnchor(java.security.cert.X509Certificate cert,
java.util.Set trustAnchors,
java.lang.String sigProvider)
Search the given Set of TrustAnchor's for one that is the
issuer of the given X509 certificate.
|
protected static AlgorithmIdentifier |
getAlgorithmIdentifier(java.security.PublicKey key) |
java.security.cert.CertPath |
getCertPath() |
int |
getCertPathSize() |
protected static void |
getCertStatus(java.util.Date validDate,
java.security.cert.X509CRL crl,
java.lang.Object cert,
org.bouncycastle.x509.CertStatus certStatus) |
protected static java.util.Set |
getCompleteCRLs(DistributionPoint dp,
java.lang.Object cert,
java.util.Date currentDate,
ExtendedPKIXParameters paramsPKIX)
Fetches complete CRLs according to RFC 3280.
|
protected java.util.Vector |
getCRLDistUrls(CRLDistPoint crlDistPoints) |
protected static void |
getCRLIssuersFromDistributionPoint(DistributionPoint dp,
java.util.Collection issuerPrincipals,
java.security.cert.X509CRLSelector selector,
ExtendedPKIXParameters pkixParams)
Add the CRL issuers from the cRLIssuer field of the distribution point or
from the certificate if not given to the issuer criterion of the
selector . |
protected static java.util.Set |
getDeltaCRLs(java.util.Date currentDate,
ExtendedPKIXParameters paramsPKIX,
java.security.cert.X509CRL completeCRL)
Fetches delta CRLs according to RFC 3280 section 5.2.4.
|
protected static javax.security.auth.x500.X500Principal |
getEncodedIssuerPrincipal(java.lang.Object cert)
Returns the issuer of an attribute certificate or certificate.
|
java.util.List[] |
getErrors()
Returns an Array of Lists which contains a List of global error messages
and a List of error messages for each certificate in the path.
|
java.util.List |
getErrors(int index)
Returns an List of error messages for the certificate at the given index in the CertPath.
|
protected static ASN1Primitive |
getExtensionValue(java.security.cert.X509Extension ext,
java.lang.String oid)
Extract the value of the given extension, if it exists.
|
protected static javax.security.auth.x500.X500Principal |
getIssuerPrincipal(java.security.cert.X509CRL crl) |
protected static java.security.PublicKey |
getNextWorkingKey(java.util.List certs,
int index)
Return the next working key inheriting DSA parameters if necessary.
|
java.util.List[] |
getNotifications()
Returns an Array of Lists which contains a List of global notification messages
and a List of botification messages for each certificate in the path.
|
java.util.List |
getNotifications(int index)
Returns an List of notification messages for the certificate at the given index in the CertPath.
|
protected java.util.Vector |
getOCSPUrls(AuthorityInformationAccess authInfoAccess) |
java.security.cert.PolicyNode |
getPolicyTree() |
protected static java.util.Set |
getQualifierSet(ASN1Sequence qualifiers) |
protected static javax.security.auth.x500.X500Principal |
getSubjectPrincipal(java.security.cert.X509Certificate cert) |
java.security.PublicKey |
getSubjectPublicKey() |
java.security.cert.TrustAnchor |
getTrustAnchor() |
protected java.util.Collection |
getTrustAnchors(java.security.cert.X509Certificate cert,
java.util.Set trustanchors) |
protected static java.util.Date |
getValidCertDateFromValidityModel(ExtendedPKIXParameters paramsPKIX,
java.security.cert.CertPath certPath,
int index) |
protected static java.util.Date |
getValidDate(java.security.cert.PKIXParameters paramsPKIX) |
void |
init(java.security.cert.CertPath certPath,
java.security.cert.PKIXParameters params)
Initializes the PKIXCertPathReviewer with the given
CertPath and PKIXParameters params |
protected static boolean |
isAnyPolicy(java.util.Set policySet) |
protected static boolean |
isSelfIssued(java.security.cert.X509Certificate cert) |
boolean |
isValidCertPath() |
protected static void |
prepareNextCertB1(int i,
java.util.List[] policyNodes,
java.lang.String id_p,
java.util.Map m_idp,
java.security.cert.X509Certificate cert) |
protected static PKIXPolicyNode |
prepareNextCertB2(int i,
java.util.List[] policyNodes,
java.lang.String id_p,
PKIXPolicyNode validPolicyTree) |
protected static boolean |
processCertD1i(int index,
java.util.List[] policyNodes,
ASN1ObjectIdentifier pOid,
java.util.Set pq) |
protected static void |
processCertD1ii(int index,
java.util.List[] policyNodes,
ASN1ObjectIdentifier _poid,
java.util.Set _pq) |
protected static PKIXPolicyNode |
removePolicyNode(PKIXPolicyNode validPolicyTree,
java.util.List[] policyNodes,
PKIXPolicyNode _node) |
protected static void |
verifyX509Certificate(java.security.cert.X509Certificate cert,
java.security.PublicKey publicKey,
java.lang.String sigProvider) |
protected java.security.cert.CertPath certPath
protected java.security.cert.PKIXParameters pkixParams
protected java.util.Date validDate
protected java.util.List certs
protected int n
protected java.util.List[] notifications
protected java.util.List[] errors
protected java.security.cert.TrustAnchor trustAnchor
protected java.security.PublicKey subjectPublicKey
protected java.security.cert.PolicyNode policyTree
protected static final org.bouncycastle.x509.PKIXCRLUtil CRL_UTIL
protected static final java.lang.String CERTIFICATE_POLICIES
protected static final java.lang.String BASIC_CONSTRAINTS
protected static final java.lang.String POLICY_MAPPINGS
protected static final java.lang.String SUBJECT_ALTERNATIVE_NAME
protected static final java.lang.String NAME_CONSTRAINTS
protected static final java.lang.String KEY_USAGE
protected static final java.lang.String INHIBIT_ANY_POLICY
protected static final java.lang.String ISSUING_DISTRIBUTION_POINT
protected static final java.lang.String DELTA_CRL_INDICATOR
protected static final java.lang.String POLICY_CONSTRAINTS
protected static final java.lang.String FRESHEST_CRL
protected static final java.lang.String CRL_DISTRIBUTION_POINTS
protected static final java.lang.String AUTHORITY_KEY_IDENTIFIER
protected static final java.lang.String ANY_POLICY
protected static final java.lang.String CRL_NUMBER
protected static final int KEY_CERT_SIGN
protected static final int CRL_SIGN
protected static final java.lang.String[] crlReasons
public PKIXCertPathReviewer(java.security.cert.CertPath certPath, java.security.cert.PKIXParameters params) throws CertPathReviewerException
CertPath
and PKIXParameters
paramscertPath
- the CertPath
to validateparams
- the PKIXParameters
to useCertPathReviewerException
- if the certPath is emptypublic PKIXCertPathReviewer()
public void init(java.security.cert.CertPath certPath, java.security.cert.PKIXParameters params) throws CertPathReviewerException
CertPath
and PKIXParameters
paramscertPath
- the CertPath
to validateparams
- the PKIXParameters
to useCertPathReviewerException
- if the certPath is emptyjava.lang.IllegalStateException
- if the PKIXCertPathReviewer
is already initializedpublic java.security.cert.CertPath getCertPath()
public int getCertPathSize()
public java.util.List[] getErrors()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.util.List getErrors(int index)
index
- the index of the certificate in the CertPathjava.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.util.List[] getNotifications()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.util.List getNotifications(int index)
index
- the index of the certificate in the CertPathjava.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.security.cert.PolicyNode getPolicyTree()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.security.PublicKey getSubjectPublicKey()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic java.security.cert.TrustAnchor getTrustAnchor()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedpublic boolean isValidCertPath()
java.lang.IllegalStateException
- if the PKIXCertPathReviewer
was not initializedprotected void addNotification(ErrorBundle msg)
protected void addNotification(ErrorBundle msg, int index)
protected void addError(ErrorBundle msg)
protected void addError(ErrorBundle msg, int index)
protected void doChecks()
protected void checkRevocation(java.security.cert.PKIXParameters paramsPKIX, java.security.cert.X509Certificate cert, java.util.Date validDate, java.security.cert.X509Certificate sign, java.security.PublicKey workingPublicKey, java.util.Vector crlDistPointUrls, java.util.Vector ocspUrls, int index) throws CertPathReviewerException
CertPathReviewerException
protected void checkCRLs(java.security.cert.PKIXParameters paramsPKIX, java.security.cert.X509Certificate cert, java.util.Date validDate, java.security.cert.X509Certificate sign, java.security.PublicKey workingPublicKey, java.util.Vector crlDistPointUrls, int index) throws CertPathReviewerException
CertPathReviewerException
protected java.util.Vector getCRLDistUrls(CRLDistPoint crlDistPoints)
protected java.util.Vector getOCSPUrls(AuthorityInformationAccess authInfoAccess)
protected java.util.Collection getTrustAnchors(java.security.cert.X509Certificate cert, java.util.Set trustanchors) throws CertPathReviewerException
CertPathReviewerException
protected static java.security.cert.TrustAnchor findTrustAnchor(java.security.cert.X509Certificate cert, java.util.Set trustAnchors) throws AnnotatedException
cert
- the X509 certificatetrustAnchors
- a Set of TrustAnchor'sTrustAnchor
object if found or
null
if not.AnnotatedException
- if a TrustAnchor was found but the signature verification
on the given certificate has thrown an exception.protected static java.security.cert.TrustAnchor findTrustAnchor(java.security.cert.X509Certificate cert, java.util.Set trustAnchors, java.lang.String sigProvider) throws AnnotatedException
cert
- the X509 certificatetrustAnchors
- a Set of TrustAnchor'ssigProvider
- the provider to use for signature verificationTrustAnchor
object if found or
null
if not.AnnotatedException
- if a TrustAnchor was found but the signature verification
on the given certificate has thrown an exception.protected static void addAdditionalStoresFromAltNames(java.security.cert.X509Certificate cert, ExtendedPKIXParameters pkixParams) throws java.security.cert.CertificateParsingException
java.security.cert.CertificateParsingException
protected static javax.security.auth.x500.X500Principal getEncodedIssuerPrincipal(java.lang.Object cert)
cert
- The attribute certificate or certificate.X500Principal
.protected static java.util.Date getValidDate(java.security.cert.PKIXParameters paramsPKIX)
protected static javax.security.auth.x500.X500Principal getSubjectPrincipal(java.security.cert.X509Certificate cert)
protected static boolean isSelfIssued(java.security.cert.X509Certificate cert)
protected static ASN1Primitive getExtensionValue(java.security.cert.X509Extension ext, java.lang.String oid) throws AnnotatedException
ext
- The extension object.oid
- The object identifier to obtain.AnnotatedException
- if the extension cannot be read.protected static javax.security.auth.x500.X500Principal getIssuerPrincipal(java.security.cert.X509CRL crl)
protected static AlgorithmIdentifier getAlgorithmIdentifier(java.security.PublicKey key) throws java.security.cert.CertPathValidatorException
java.security.cert.CertPathValidatorException
protected static final java.util.Set getQualifierSet(ASN1Sequence qualifiers) throws java.security.cert.CertPathValidatorException
java.security.cert.CertPathValidatorException
protected static PKIXPolicyNode removePolicyNode(PKIXPolicyNode validPolicyTree, java.util.List[] policyNodes, PKIXPolicyNode _node)
protected static boolean processCertD1i(int index, java.util.List[] policyNodes, ASN1ObjectIdentifier pOid, java.util.Set pq)
protected static void processCertD1ii(int index, java.util.List[] policyNodes, ASN1ObjectIdentifier _poid, java.util.Set _pq)
protected static void prepareNextCertB1(int i, java.util.List[] policyNodes, java.lang.String id_p, java.util.Map m_idp, java.security.cert.X509Certificate cert) throws AnnotatedException, java.security.cert.CertPathValidatorException
AnnotatedException
java.security.cert.CertPathValidatorException
protected static PKIXPolicyNode prepareNextCertB2(int i, java.util.List[] policyNodes, java.lang.String id_p, PKIXPolicyNode validPolicyTree)
protected static boolean isAnyPolicy(java.util.Set policySet)
protected static void addAdditionalStoreFromLocation(java.lang.String location, ExtendedPKIXParameters pkixParams)
protected static java.util.Collection findCertificates(X509CertStoreSelector certSelect, java.util.List certStores) throws AnnotatedException
certSelect
- a Selector
object that will be used to select
the certificatescertStores
- a List containing only X509Store
objects. These
are used to search for certificates.X509Certificate
or
X509AttributeCertificate
objects.
May be empty but never null
.AnnotatedException
protected static java.util.Collection findCertificates(PKIXCertStoreSelector certSelect, java.util.List certStores) throws AnnotatedException
AnnotatedException
protected static java.util.Collection findCertificates(X509AttributeCertStoreSelector certSelect, java.util.List certStores) throws AnnotatedException
AnnotatedException
protected static void addAdditionalStoresFromCRLDistributionPoint(CRLDistPoint crldp, ExtendedPKIXParameters pkixParams) throws AnnotatedException
AnnotatedException
protected static void getCRLIssuersFromDistributionPoint(DistributionPoint dp, java.util.Collection issuerPrincipals, java.security.cert.X509CRLSelector selector, ExtendedPKIXParameters pkixParams) throws AnnotatedException
selector
.
The issuerPrincipals
are a collection with a single
X500Principal
for X509Certificate
s. For
X509AttributeCertificate
s the issuer may contain more than one
X500Principal
.
dp
- The distribution point.issuerPrincipals
- The issuers of the certificate or attribute
certificate which contains the distribution point.selector
- The CRL selector.pkixParams
- The PKIX parameters containing the cert stores.AnnotatedException
- if an exception occurs while processing.java.lang.ClassCastException
- if issuerPrincipals
does not
contain only X500Principal
s.protected static void getCertStatus(java.util.Date validDate, java.security.cert.X509CRL crl, java.lang.Object cert, org.bouncycastle.x509.CertStatus certStatus) throws AnnotatedException
AnnotatedException
protected static java.util.Set getDeltaCRLs(java.util.Date currentDate, ExtendedPKIXParameters paramsPKIX, java.security.cert.X509CRL completeCRL) throws AnnotatedException
currentDate
- The date for which the delta CRLs must be valid.paramsPKIX
- The extended PKIX parameters.completeCRL
- The complete CRL the delta CRL is for.Set
of X509CRL
s with delta CRLs.AnnotatedException
- if an exception occurs while picking the delta
CRLs.protected static java.util.Set getCompleteCRLs(DistributionPoint dp, java.lang.Object cert, java.util.Date currentDate, ExtendedPKIXParameters paramsPKIX) throws AnnotatedException
dp
- The distribution point for which the complete CRLcert
- The X509Certificate
or
X509AttributeCertificate
for
which the CRL should be searched.currentDate
- The date for which the delta CRLs must be valid.paramsPKIX
- The extended PKIX parameters.Set
of X509CRL
s with complete
CRLs.AnnotatedException
- if an exception occurs while picking the CRLs
or no CRLs are found.protected static java.util.Date getValidCertDateFromValidityModel(ExtendedPKIXParameters paramsPKIX, java.security.cert.CertPath certPath, int index) throws AnnotatedException
AnnotatedException
protected static java.security.PublicKey getNextWorkingKey(java.util.List certs, int index) throws java.security.cert.CertPathValidatorException
This methods inherits DSA parameters from the indexed certificate or
previous certificates in the certificate chain to the returned
PublicKey
. The list is searched upwards, meaning the end
certificate is at position 0 and previous certificates are following.
If the indexed certificate does not contain a DSA key this method simply returns the public key. If the DSA key already contains DSA parameters the key is also only returned.
certs
- The certification path.index
- The index of the certificate which contains the public key
which should be extended with DSA parameters.index
extended with DSA parameters if applicable.AnnotatedException
- if DSA parameters cannot be inherited.java.security.cert.CertPathValidatorException
protected static void verifyX509Certificate(java.security.cert.X509Certificate cert, java.security.PublicKey publicKey, java.lang.String sigProvider) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException