Methods Summary |
---|
public void | addIssuer(javax.security.auth.x500.X500Principal issuer)Adds an issuer to the criterion for the issuer distinguished names.
The CRL issuer must match at least one of the specified distinguished
names.
if (issuer == null) {
throw new NullPointerException(Messages.getString("security.61")); //$NON-NLS-1$
}
if (issuerNames == null) {
issuerNames = new ArrayList<String>();
}
String name = issuer.getName(X500Principal.CANONICAL);
if (!issuerNames.contains(name)) {
issuerNames.add(name);
}
if (issuerPrincipals == null) {
issuerPrincipals = new ArrayList<X500Principal>(issuerNames.size());
}
// extend the list of issuer Principals
int size = issuerNames.size() - 1;
for (int i=issuerPrincipals.size(); i<size; i++) {
issuerPrincipals.add(new X500Principal(issuerNames.get(i)));
}
issuerPrincipals.add(issuer);
|
public void | addIssuerName(java.lang.String iss_name)Do not use:, use {@link #addIssuer(X500Principal)} or
{@link #addIssuerName(byte[])} instead. It can fail to match some CRLs
because of a loss of encoding information in a RFC 2253 string.
Adds an issuer to the criterion for the issuer distinguished names. The
CRK issuer must match at least one of the specified distinguished names.
if (issuerNames == null) {
issuerNames = new ArrayList<String>();
}
if (iss_name == null) {
iss_name = ""; //$NON-NLS-1$
}
String name = new Name(iss_name).getName(X500Principal.CANONICAL);
if (!issuerNames.contains(name)) {
issuerNames.add(name);
}
|
public void | addIssuerName(byte[] iss_name)Adds an issuer to the criterion for the issuer distinguished names.
The CRL issuer must match at least one of the specified distinguished
names.
if (iss_name == null) {
throw new NullPointerException(Messages.getString("security.63")); //$NON-NLS-1$
}
if (issuerNames == null) {
issuerNames = new ArrayList<String>();
}
String name = new Name(iss_name).getName(X500Principal.CANONICAL);
if (!issuerNames.contains(name)) {
issuerNames.add(name);
}
|
public java.lang.Object | clone()Clones this {@code X509CRL} instance.
X509CRLSelector result = new X509CRLSelector();
if (issuerNames != null) {
result.issuerNames = new ArrayList<String>(issuerNames);
}
result.minCRL = minCRL;
result.maxCRL = maxCRL;
result.dateAndTime = dateAndTime;
result.certificateChecking = certificateChecking;
return result;
|
public java.security.cert.X509Certificate | getCertificateChecking()Returns the certificate hint to find CRLs. It's not a criterion but may
help finding relevant CRLs.
return certificateChecking;
|
public java.util.Date | getDateAndTime()Returns the criterion for the CRL update period.
The CRL's {@code thisUpdate} value must be equal or before the returned
date and the {@code nextUpdate} value must be after the returned date.
if (dateAndTime == -1) {
return null;
}
return new Date(dateAndTime);
|
public java.util.Collection | getIssuerNames()Returns the criterion for the issuer distinguished names.
The CRL issuer must match at least one of the distinguished names.
if (issuerNames == null) {
return null;
}
return Collections.unmodifiableCollection((ArrayList<?>) issuerNames);
|
public java.util.Collection | getIssuers()Returns the criterion for the issuer distinguished names.
The CRL issuer must match at least one of the distinguished names.
if (issuerNames == null) {
return null;
}
if (issuerPrincipals == null) {
issuerPrincipals = new ArrayList<X500Principal>(issuerNames.size());
}
int size = issuerNames.size();
// extend the list of issuer Principals
for (int i=issuerPrincipals.size(); i<size; i++) {
issuerPrincipals.add(new X500Principal(issuerNames.get(i)));
}
return Collections.unmodifiableCollection(issuerPrincipals);
|
public java.math.BigInteger | getMaxCRL()Returns the criterion for the maximum CRL number.
The CRL must have a number extension with a value less than or equal to
the returned value.
return maxCRL;
|
public java.math.BigInteger | getMinCRL()Returns the criterion for the minimum CRL number.
The CRL must have a number extension with a value greater than or equal
to the returned value.
return minCRL;
|
public boolean | match(java.security.cert.CRL crl)Returns whether the specified CRL matches all the criteria collected in
this instance.
if (!(crl instanceof X509CRL)) {
return false;
}
X509CRL crlist = (X509CRL) crl;
if ((issuerNames != null) &&
// the search speed depends on the class of issuerNames
!(issuerNames.contains(
crlist.getIssuerX500Principal().getName(
X500Principal.CANONICAL)))) {
return false;
}
if ((minCRL != null) || (maxCRL != null)) {
try {
// As specified in rfc 3280 (http://www.ietf.org/rfc/rfc3280.txt)
// CRL Number Extension's OID is 2.5.29.20 .
byte[] bytes = crlist.getExtensionValue("2.5.29.20"); //$NON-NLS-1$
bytes = (byte[]) ASN1OctetString.getInstance().decode(bytes);
BigInteger crlNumber = new BigInteger((byte[])
ASN1Integer.getInstance().decode(bytes));
if ((minCRL != null) && (crlNumber.compareTo(minCRL) < 0)) {
return false;
}
if ((maxCRL != null) && (crlNumber.compareTo(maxCRL) > 0)) {
return false;
}
} catch (IOException e) {
return false;
}
}
if (dateAndTime != -1) {
Date thisUp = crlist.getThisUpdate();
Date nextUp = crlist.getNextUpdate();
if ((thisUp == null) || (nextUp == null)) {
return false;
}
if ((dateAndTime < thisUp.getTime())
|| (dateAndTime > nextUp.getTime())) {
return false;
}
}
return true;
|
public void | setCertificateChecking(java.security.cert.X509Certificate cert)Sets a certificate hint to find CRLs. It's not a criterion but may help
finding relevant CRLs.
this.certificateChecking = cert;
|
public void | setDateAndTime(java.util.Date dateAndTime)Sets the criterion for the CRL update period.
The CRL's {@code thisUpdate} value must be equal or before the specified
date and the {@code nextUpdate} value must be after the specified date.
if (dateAndTime == null) {
this.dateAndTime = -1;
return;
}
this.dateAndTime = dateAndTime.getTime();
|
public void | setIssuerNames(java.util.Collection names)Do not use: use {@link #setIssuers(Collection)} or one of
{@link #addIssuerName} instead. Sets the criterion for the issuer
distinguished names.
The CRL issuer must match at least one of the specified distinguished
names.
The specified parameter {@code names} is a collection with an entry for
each name to be included in the criterion. The name is specified as a
{@code String} or a byte array specifying the name (in RFC 2253 or ASN.1
DER encoded form)
if (names == null) {
issuerNames = null;
issuerPrincipals = null;
return;
}
if (names.size() == 0) {
return;
}
issuerNames = new ArrayList<String>(names.size());
for (Object name: names) {
if (name instanceof String) {
issuerNames.add(
new Name((String) name).getName(
X500Principal.CANONICAL));
} else if (name instanceof byte[]) {
issuerNames.add(
new Name((byte[]) name).getName(
X500Principal.CANONICAL));
} else {
throw new IOException(
Messages.getString("security.62")); //$NON-NLS-1$
}
}
|
public void | setIssuers(java.util.Collection issuers)Sets the criterion for the issuer distinguished names.
The CRL issuer must match at least one of the specified distinguished
names.
if (issuers == null) {
issuerNames = null;
issuerPrincipals = null;
return;
}
issuerNames = new ArrayList<String>(issuers.size());
issuerPrincipals = new ArrayList<X500Principal>(issuers);
for (X500Principal issuer: issuers) {
issuerNames.add(issuer.getName(X500Principal.CANONICAL));
}
|
public void | setMaxCRLNumber(java.math.BigInteger maxCRL)Sets the criterion for the maximum CRL number.
The CRL must have a number extension with a value less than or equal to
the specified parameter.
this.maxCRL = maxCRL;
|
public void | setMinCRLNumber(java.math.BigInteger minCRL)Sets the criterion for the minimum CRL number.
The CRL must have a number extension with a value greater than or equal
to the specified parameter.
this.minCRL = minCRL;
|
public java.lang.String | toString()Returns a string representation of this {@code X509CRLSelector} instance.
StringBuffer result = new StringBuffer();
result.append("X509CRLSelector:\n["); //$NON-NLS-1$
if (issuerNames != null) {
result.append("\n IssuerNames:\n ["); //$NON-NLS-1$
int size = issuerNames.size();
for (int i=0; i<size; i++) {
result.append("\n " //$NON-NLS-1$
+ issuerNames.get(i));
}
result.append("\n ]"); //$NON-NLS-1$
}
if (minCRL != null) {
result.append("\n minCRL: " + minCRL); //$NON-NLS-1$
}
if (maxCRL != null) {
result.append("\n maxCRL: " + maxCRL); //$NON-NLS-1$
}
if (dateAndTime != -1) {
result.append("\n dateAndTime: " + (new Date(dateAndTime))); //$NON-NLS-1$
}
if (certificateChecking != null) {
result.append("\n certificateChecking: " + certificateChecking); //$NON-NLS-1$
}
result.append("\n]"); //$NON-NLS-1$
return result.toString();
|