APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.validator

public final Class SimpleValidator

extends Validator
Class Inheritance
Imports
java.io.IOException, java.util.*, java.security.*, java.security.cert.*, javax.security.auth.x500.X500Principal, sun.security.x509.X509CertImpl, .KeyIdentifier, .NetscapeCertTypeExtension, sun.security.util.DerValue, .DerInputStream, .ObjectIdentifier, .KnownOIDs, sun.security.provider.certpath.AlgorithmChecker, .UntrustedChecker

A simple validator implementation. It is based on code from the JSSE X509TrustManagerImpl. This implementation is designed for compatibility with deployed certificates and previous J2SE versions. It will never support more advanced features and will be deemphasized in favor of the PKIX validator going forward.

SimpleValidator objects are immutable once they have been created. Please DO NOT add methods that can change the state of an instance once it has been created.

Author
Andreas Sterbenz

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
pack-priv static final ObjectIdentifier
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv static final String
private final Collection<X509Certificate>
trustedCerts

Set of the trusted certificates.

private final Map<X500Principal, List<X509Certificate>>
trustedX500Principals

The trusted certificates as: Map (X500Principal)subject of trusted cert -> List of X509Certificate The list is used because there may be multiple certificates with an identical subject DN.

Inherited from sun.security.validator.Validator:
CHAIN0endEntityCheckerTYPE_PKIXTYPE_SIMPLEvalidationDateVAR_CODE_SIGNINGVAR_GENERICVAR_JCE_SIGNINGVAR_TLS_CLIENTVAR_TLS_SERVERVAR_TSA_SERVERvariant

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private X509Certificate[]
buildTrustedChain(X509Certificate[] chain)

Build a trusted certificate chain.

private int
checkBasicConstraints(X509Certificate cert, Set<String> critSet, int maxPathLen)

private int
checkExtensions(X509Certificate cert, int maxPathLen)

private void
private void
pack-priv X509Certificate[]
engineValidate(X509Certificate[] chain, Collection<X509Certificate> otherCerts, List<byte[]> responseList, AlgorithmConstraints constraints, Object parameter)

Implements abstract sun.security.validator.Validator.engineValidate.

Perform simple validation of chain.

pack-priv static boolean
getNetscapeCertTypeBit(X509Certificate cert, String type)

Get the value of the specified bit in the Netscape certificate type extension.

private X509Certificate
getTrustedCertificate(X509Certificate cert)

Return a trusted certificate that matches the input certificate, or null if no such certificate can be found.

public Collection<X509Certificate>
getTrustedCertificates()

Implements abstract sun.security.validator.Validator.getTrustedCertificates.

Returns an immutable Collection of the X509Certificates this instance uses as trust anchors.

Inherited from sun.security.validator.Validator:
getInstancegetInstancegetInstancesetValidationDatevalidatevalidatevalidatevalidate

Field Detail

NSCT_CODE_SIGNING_CAback to summary
private static final String NSCT_CODE_SIGNING_CA
NSCT_SSL_CAback to summary
private static final String NSCT_SSL_CA
OBJID_NETSCAPE_CERT_TYPEback to summary
pack-priv static final ObjectIdentifier OBJID_NETSCAPE_CERT_TYPE
OID_BASIC_CONSTRAINTSback to summary
pack-priv static final String OID_BASIC_CONSTRAINTS
OID_EKU_ANY_USAGEback to summary
pack-priv static final String OID_EKU_ANY_USAGE
OID_EXTENDED_KEY_USAGEback to summary
pack-priv static final String OID_EXTENDED_KEY_USAGE
OID_KEY_USAGEback to summary
pack-priv static final String OID_KEY_USAGE
OID_NETSCAPE_CERT_TYPEback to summary
pack-priv static final String OID_NETSCAPE_CERT_TYPE
trustedCertsback to summary
private final Collection<X509Certificate> trustedCerts

Set of the trusted certificates. Present only for getTrustedCertificates().

trustedX500Principalsback to summary
private final Map<X500Principal, List<X509Certificate>> trustedX500Principals

The trusted certificates as: Map (X500Principal)subject of trusted cert -> List of X509Certificate The list is used because there may be multiple certificates with an identical subject DN.

Constructor Detail

SimpleValidatorback to summary
pack-priv SimpleValidator(String variant, Collection<X509Certificate> trustedCerts)

Method Detail

buildTrustedChainback to summary
private X509Certificate[] buildTrustedChain(X509Certificate[] chain) throws CertificateException

Build a trusted certificate chain. This method always returns a chain with a trust anchor as the final cert in the chain. If no trust anchor could be found, a CertificateException is thrown.

checkBasicConstraintsback to summary
private int checkBasicConstraints(X509Certificate cert, Set<String> critSet, int maxPathLen) throws CertificateException
checkExtensionsback to summary
private int checkExtensions(X509Certificate cert, int maxPathLen) throws CertificateException
checkKeyUsageback to summary
private void checkKeyUsage(X509Certificate cert, Set<String> critSet) throws CertificateException
checkNetscapeCertTypeback to summary
private void checkNetscapeCertType(X509Certificate cert, Set<String> critSet) throws CertificateException
engineValidateback to summary
pack-priv X509Certificate[] engineValidate(X509Certificate[] chain, Collection<X509Certificate> otherCerts, List<byte[]> responseList, AlgorithmConstraints constraints, Object parameter) throws CertificateException

Implements abstract sun.security.validator.Validator.engineValidate.

Perform simple validation of chain. The arguments otherCerts and parameter are ignored.

Annotations
@Override
getNetscapeCertTypeBitback to summary
pack-priv static boolean getNetscapeCertTypeBit(X509Certificate cert, String type)

Get the value of the specified bit in the Netscape certificate type extension. If the extension is not present at all, we return true.

getTrustedCertificateback to summary
private X509Certificate getTrustedCertificate(X509Certificate cert)

Return a trusted certificate that matches the input certificate, or null if no such certificate can be found. This method also handles cases where a CA re-issues a trust anchor with the same public key and same subject and issuer names but a new validity period, etc.

getTrustedCertificatesback to summary
public Collection<X509Certificate> getTrustedCertificates()

Implements abstract sun.security.validator.Validator.getTrustedCertificates.

Doc from sun.security.validator.Validator.getTrustedCertificates.

Returns an immutable Collection of the X509Certificates this instance uses as trust anchors.