|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.security.cert.X509CertSelector
, CertSelector

public class X509CertSelector


A CertSelector that selects X509Certificates that
match all specified criteria. This class is particularly useful when
selecting certificates from a CertStore to build a
PKIX-compliant certification path.
When first constructed, an X509CertSelector has no criteria
enabled and each of the get methods return a default value
(null, or -1 for the getBasicConstraints
method). Therefore, the match
method would return true for any X509Certificate.
Typically, several criteria are enabled (by calling
setIssuer
or
setKeyUsage
, for instance) and then the
X509CertSelector is passed to
CertStore.getCertificates
or some similar
method.
Several criteria can be enabled (by calling setIssuer
and setSerialNumber
,
for example) such that the match method
usually uniquely matches a single X509Certificate. We say
usually, since it is possible for two issuing CAs to have the same
distinguished name and each issue a certificate with the same serial
number. Other unique combinations include the issuer, subject,
subjectKeyIdentifier and/or the subjectPublicKey criteria.
Please refer to RFC 2459 for definitions of the X.509 certificate extensions mentioned below.
Concurrent Access
Unless otherwise specified, the methods defined in this class are not thread-safe. Multiple threads that need to access a single object concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating separate objects need not synchronize.
CertSelector
,
X509Certificate

| Constructor Summary | |
|---|---|
X509CertSelector
Creates an X509CertSelector. |
|
| Method Summary | |
|---|---|
void |
addPathToName
Adds a name to the pathToNames criterion. |
void |
addPathToName
Adds a name to the pathToNames criterion. |
void |
addSubjectAlternativeName
Adds a name to the subjectAlternativeNames criterion. |
void |
addSubjectAlternativeName
Adds a name to the subjectAlternativeNames criterion. |
Object |
clone
Returns a copy of this object. |
byte[] |
getAuthorityKeyIdentifier
Returns the authorityKeyIdentifier criterion. |
int |
getBasicConstraints
Returns the basic constraints constraint. |
X509Certificate |
getCertificate
Returns the certificateEquals criterion. |
Date |
getCertificateValid
Returns the certificateValid criterion. |
Set |
getExtendedKeyUsage
Returns the extendedKeyUsage criterion. |
X500Principal |
getIssuer
Returns the issuer criterion as an X500Principal. |
byte[] |
getIssuerAsBytes
Returns the issuer criterion as a byte array. |
String |
getIssuerAsString
Denigrated, use getIssuer() or
getIssuerAsBytes() instead. |
boolean[] |
getKeyUsage
Returns the keyUsage criterion. |
boolean |
getMatchAllSubjectAltNames
Indicates if the X509Certificate must contain all
or at least one of the subjectAlternativeNames
specified in the setSubjectAlternativeNames or addSubjectAlternativeName methods. |
byte[] |
getNameConstraints
Returns the name constraints criterion. |
Collection |
getPathToNames
Returns a copy of the pathToNames criterion. |
Set |
getPolicy
Returns the policy criterion. |
Date |
getPrivateKeyValid
Returns the privateKeyValid criterion. |
BigInteger |
getSerialNumber
Returns the serialNumber criterion. |
X500Principal |
getSubject
Returns the subject criterion as an X500Principal. |
Collection |
getSubjectAlternativeNames
Returns a copy of the subjectAlternativeNames criterion. |
byte[] |
getSubjectAsBytes
Returns the subject criterion as a byte array. |
String |
getSubjectAsString
Denigrated, use getSubject() or
getSubjectAsBytes() instead. |
byte[] |
getSubjectKeyIdentifier
Returns the subjectKeyIdentifier criterion. |
PublicKey |
getSubjectPublicKey
Returns the subjectPublicKey criterion. |
String |
getSubjectPublicKeyAlgID
Returns the subjectPublicKeyAlgID criterion. |
boolean |
match
Decides whether a Certificate should be selected. |
void |
setAuthorityKeyIdentifier
Sets the authorityKeyIdentifier criterion. |
void |
setBasicConstraints
Sets the basic constraints constraint. |
void |
setCertificate
Sets the certificateEquals criterion. |
void |
setCertificateValid
Sets the certificateValid criterion. |
void |
setExtendedKeyUsage
Sets the extendedKeyUsage criterion. |
void |
setIssuer
Sets the issuer criterion. |
void |
setIssuer
Denigrated, use setIssuer(X500Principal)
or setIssuer(byte[]) instead. |
void |
setIssuer
Sets the issuer criterion. |
void |
setKeyUsage
Sets the keyUsage criterion. |
void |
setMatchAllSubjectAltNames
Enables/disables matching all of the subjectAlternativeNames specified in the setSubjectAlternativeNames or addSubjectAlternativeName methods. |
void |
setNameConstraints
Sets the name constraints criterion. |
void |
setPathToNames
Sets the pathToNames criterion. |
void |
setPolicy
Sets the policy constraint. |
void |
setPrivateKeyValid
Sets the privateKeyValid criterion. |
void |
setSerialNumber
Sets the serialNumber criterion. |
void |
setSubject
Sets the subject criterion. |
void |
setSubject
Denigrated, use setSubject(X500Principal)
or setSubject(byte[]) instead. |
void |
setSubject
Sets the subject criterion. |
void |
setSubjectAlternativeNames
Sets the subjectAlternativeNames criterion. |
void |
setSubjectKeyIdentifier
Sets the subjectKeyIdentifier criterion. |
void |
setSubjectPublicKey
Sets the subjectPublicKey criterion. |
void |
setSubjectPublicKey
Sets the subjectPublicKey criterion. |
void |
setSubjectPublicKeyAlgID
Sets the subjectPublicKeyAlgID criterion. |
String |
toString
Return a printable representation of the CertSelector. |
Methods inherited from class java.lang.Object ![]() |
|---|
equals |
| Constructor Detail |
|---|

public X509CertSelector()
X509CertSelector. Initially, no criteria are set
so any X509Certificate will match.
| Method Detail |
|---|

public void setCertificate(X509Certificate![]()
![]()
cert)
X509Certificate must be equal to the
X509Certificate passed to the match method.
If null, then this check is not applied.
This method is particularly useful when it is necessary to match a single certificate. Although other criteria can be specified in conjunction with the certificateEquals criterion, it is usually not practical or necessary.
cert - the X509Certificate to match (or
null)getCertificate()


public void setSerialNumber(BigInteger![]()
![]()
serial)
X509Certificate. If null, any certificate
serial number will do.
serial - the certificate serial number to match
(or null)getSerialNumber()


public void setIssuer(X500Principal![]()
![]()
issuer)
X509Certificate. If null, any issuer
distinguished name will do.
issuer - a distinguished name as X500Principal
(or null)

public void setIssuer(String![]()
![]()
issuerDN) throws IOException
![]()
![]()
or