java.lang.Objectjava.security.cert.Certificate
java.security.cert.X509Certificate
All Implemented Interfaces:
X509Extension, java$io$Serializable
Abstract class for X.509 certificates. This provides a standard way to access all the attributes of an X.509 certificate.
In June of 1996, the basic X.509 v3 format was completed by ISO/IEC and ANSI X9, which is described below in ASN.1:
Certificate ::= SEQUENCE { tbsCertificate TBSCertificate, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING }
These certificates are widely used to support authentication and other functionality in Internet security systems. Common applications include Privacy Enhanced Mail (PEM), Transport Layer Security (SSL), code signing for trusted software distribution, and Secure Electronic Transactions (SET).
These certificates are managed and vouched for by Certificate Authorities (CAs). CAs are services which create certificates by placing data in the X.509 standard format and then digitally signing that data. CAs act as trusted third parties, making introductions between principals who have no direct knowledge of each other. CA certificates are either signed by themselves, or by some other CA such as a "root" CA.
More information can be found in RFC 3280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile.
The ASN.1 definition of tbsCertificate
is:
TBSCertificate ::= SEQUENCE { version [0] EXPLICIT Version DEFAULT v1, serialNumber CertificateSerialNumber, signature AlgorithmIdentifier, issuer Name, validity Validity, subject Name, subjectPublicKeyInfo SubjectPublicKeyInfo, issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, -- If present, version must be v2 or v3 subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, -- If present, version must be v2 or v3 extensions [3] EXPLICIT Extensions OPTIONAL -- If present, version must be v3 }
Certificates are instantiated using a certificate factory. The following is an example of how to instantiate an X.509 certificate:
InputStream inStream = null; try { inStream = new FileInputStream("fileName-of-cert"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); } finally { if (inStream != null) { inStream.close(); } }
Hemma
- PrafullchandraConstructor: |
---|
|
Method from java.security.cert.X509Certificate Summary: |
---|
checkValidity, checkValidity, getBasicConstraints, getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerDN, getIssuerUniqueID, getIssuerX500Principal, getKeyUsage, getNotAfter, getNotBefore, getSerialNumber, getSigAlgName, getSigAlgOID, getSigAlgParams, getSignature, getSubjectAlternativeNames, getSubjectDN, getSubjectUniqueID, getSubjectX500Principal, getTBSCertificate, getVersion |
Methods from java.security.cert.Certificate: |
---|
equals, getEncoded, getPublicKey, getType, hashCode, toString, verify, verify, writeReplace |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from java.security.cert.X509Certificate Detail: |
---|
The validity period consists of two date/time values: the first and last dates (and times) on which the certificate is valid. It is defined in ASN.1 as: validity Validity |
|
BasicConstraints extension, (OID = 2.5.29.19).
The basic constraints extension identifies whether the subject
of the certificate is a Certificate Authority (CA) and
how deep a certification path may exist through that CA. The
The ASN.1 definition for this is: BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL } |
ExtKeyUsageSyntax field of the
extended key usage extension, (OID = 2.5.29.37). It indicates
one or more purposes for which the certified public key may be
used, in addition to or in place of the basic purposes
indicated in the key usage extension field. The ASN.1
definition for this is:
ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeIdKey purposes may be defined by any organization with a need. Object identifiers used to identify key purposes shall be assigned in accordance with IANA or ITU-T Rec. X.660 | ISO/IEC/ITU 9834-1.
This method was added to version 1.4 of the Java 2 Platform Standard
Edition. In order to maintain backwards compatibility with existing
service providers, this method is not |
IssuerAltName extension, (OID = 2.5.29.18).
The ASN.1 definition of the IssuerAltName ::= GeneralNamesThe ASN.1 definition of GeneralNames is defined
in getSubjectAlternativeNames .
If this certificate does not contain an
Note that the
This method was added to version 1.4 of the Java 2 Platform Standard
Edition. In order to maintain backwards compatibility with existing
service providers, this method is not |
issuer
as an implementation specific Principal object, which should not be
relied upon by portable code.
Gets the The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is: issuer NameThe Name describes a hierarchical name composed of
attributes,
such as country name, and corresponding values, such as US.
The type of the AttributeValue component is determined by
the AttributeType ; in general it will be a
directoryString . A directoryString is usually
one of PrintableString ,
TeletexString or UniversalString . |
issuerUniqueID value from the certificate.
The issuer unique identifier is present in the certificate
to handle the possibility of reuse of issuer names over time.
RFC 3280 recommends that names not be reused and that
conforming certificates not make use of unique identifiers.
Applications conforming to that profile should be capable of
parsing unique identifiers and making comparisons.
The ASN.1 definition for this is: issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL |
X500Principal .
It is recommended that subclasses override this method. |
KeyUsage extension, (OID = 2.5.29.15).
The key usage extension defines the purpose (e.g., encipherment,
signature, certificate signing) of the key contained in the
certificate.
The ASN.1 definition for this is:
KeyUsage ::= BIT STRING { digitalSignature (0), nonRepudiation (1), keyEncipherment (2), dataEncipherment (3), keyAgreement (4), keyCertSign (5), cRLSign (6), encipherOnly (7), decipherOnly (8) }RFC 3280 recommends that when used, this be marked as a critical extension. |
notAfter date from the validity period of
the certificate. See getNotBefore
for relevant ASN.1 definitions. |
notBefore date from the validity period of
the certificate.
The relevant ASN.1 definitions are:
validity Validity |
serialNumber value from the certificate.
The serial number is an integer assigned by the certification
authority to each certificate. It must be unique for each
certificate issued by a given CA (i.e., the issuer name and
serial number identify a unique certificate).
The ASN.1 definition for this is:
serialNumber CertificateSerialNumber |
signatureAlgorithm AlgorithmIdentifier The algorithm name is determined from the |
See getSigAlgName for relevant ASN.1 definitions. |
See getSigAlgName for relevant ASN.1 definitions. |
signature value (the raw signature bits) from
the certificate.
The ASN.1 definition for this is:
signature BIT STRING |
SubjectAltName extension, (OID = 2.5.29.17).
The ASN.1 definition of the SubjectAltName ::= GeneralNames GeneralNames :: = SEQUENCE SIZE (1..MAX) OF GeneralName GeneralName ::= CHOICE { otherName [0] OtherName, rfc822Name [1] IA5String, dNSName [2] IA5String, x400Address [3] ORAddress, directoryName [4] Name, ediPartyName [5] EDIPartyName, uniformResourceIdentifier [6] IA5String, iPAddress [7] OCTET STRING, registeredID [8] OBJECT IDENTIFIER}
If this certificate does not contain a
RFC 822, DNS, and URI
names are returned as
Note that the
This method was added to version 1.4 of the Java 2 Platform Standard
Edition. In order to maintain backwards compatibility with existing
service providers, this method is not |
subject
as an implementation specific Principal object, which should not be
relied upon by portable code.
Gets the The ASN.1 definition for this is: subject Name See getIssuerDN for |
subjectUniqueID value from the certificate.
The ASN.1 definition for this is: subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL |
X500Principal . If the subject value
is empty, then the getName() method of the returned
X500Principal object returns an empty string ("").
It is recommended that subclasses override this method. |
tbsCertificate from this certificate.
This can be used to verify the signature independently. |
version (version number) value from the
certificate.
The ASN.1 definition for this is:
version [0] EXPLICIT Version DEFAULT v1 |