/* X509Certificate.java --- X.509 Certificate class Copyright (C) 1999,2003 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package java.security.cert; import java.math.BigInteger; import java.security.Principal; import java.security.PublicKey; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; import java.security.NoSuchProviderException; import java.security.SignatureException; import java.util.Date; /** * X509Certificate is the abstract class for X.509 certificates. * This provides a stanard class interface for accessing all * the attributes of X.509 certificates. * *
In June 1996, the basic X.509 v3 format was finished by * ISO/IEC and ANSI X.9. The ASN.1 DER format is below: * *
* ** Certificate ::= SEQUENCE { * tbsCertificate TBSCertificate, * signatureAlgorithm AlgorithmIdentifier, * signatureValue BIT STRING } *
These certificates are widely used in various Internet * protocols to support authentication. It is used in * Privacy Enhanced Mail (PEM), Transport Layer Security (TLS), * Secure Sockets Layer (SSL), code signing for trusted software * distribution, and Secure Electronic Transactions (SET). * *
The certificates are managed and vouched for by * Certificate Authorities (CAs). CAs are companies or * groups that create certificates by placing the data in the * X.509 certificate format and signing it with their private * key. CAs serve as trusted third parties by certifying that * the person or group specified in the certificate is who * they say they are. * *
The ASN.1 defintion for tbsCertificate is * *
* * Certificates are created with the CertificateFactory. * ** 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 shall be v2 or v3 * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, * -- If present, version shall be v2 or v3 * extensions [3] EXPLICIT Extensions OPTIONAL * -- If present, version shall be v3 * } * * Version ::= INTEGER { v1(0), v2(1), v3(2) } * * CertificateSerialNumber ::= INTEGER * * Validity ::= SEQUENCE { * notBefore Time, * notAfter Time } * * Time ::= CHOICE { * utcTime UTCTime, * generalTime GeneralizedTime } * * UniqueIdentifier ::= BIT STRING * * SubjectPublicKeyInfo ::= SEQUENCE { * algorithm AlgorithmIdentifier, * subjectPublicKey BIT STRING } * * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension * * Extension ::= SEQUENCE { * extnID OBJECT IDENTIFIER, * critical BOOLEAN DEFAULT FALSE, * extnValue OCTET STRING } *
References: * *
ExtendedKeyUsage
extension of this
* certificate, or null if there is no extension present. The returned
* value is a {@link java.util.List} strings representing the object
* identifiers of the extended key usages. This extension has the OID
* 2.5.29.37.
*
* The ASN.1 definition for this extension is: * *
* * @return The list of extension OIDs, or null if there are none * present in this certificate. * @throws CertificateParsingException If this extension cannot be * parsed from its encoded form. */ public java.util.List getExtendedKeyUsage() throws CertificateParsingException { throw new UnsupportedOperationException(); } /** * Returns the alternative names for this certificate's subject (the * owner), or null if there are none. * ** ExtendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId * * KeyPurposeId ::= OBJECT IDENTIFIER *
This is an X.509 extension with OID 2.5.29.17 and is defined by * the ASN.1 construction: * *
* ** SubjectAltNames ::= 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 * } *
The returned collection contains one or more two-element Lists,
* with the first object being an Integer representing the choice
* above (with value 0 through 8) and the second being an (a) String
* if the GeneralName
is a rfc822Name, dNSName,
* uniformResourceIdentifier, iPAddress, or registeredID, or (b) a
* byte array of the DER encoded form for any others.
*
* @return The collection of alternative names, or null if there are
* none.
* @throws CertificateParsingException If the encoded extension cannot
* be parsed.
* @since JDK 1.4
*/
public java.util.Collection getSubjectAlternativeNames()
throws CertificateParsingException
{
throw new UnsupportedOperationException();
}
/**
* Returns the alternative names for this certificate's issuer, or
* null if there are none.
*
*
This is an X.509 extension with OID 2.5.29.18, and is defined by * the ASN.1 construction: * *
* ** IssuerAltNames ::= GeneralNames *
The GeneralNames
construct and the form of the
* returned collection are the same as with {@link
* #getSubjectAlternativeNames()}.
*
* @return The collection of alternative names, or null if there are
* none.
* @throws CertificateParsingException If the encoded extension cannot
* be parsed.
* @since JDK 1.4
*/
public java.util.Collection getIssuerAlternativeNames()
throws CertificateParsingException
{
throw new UnsupportedOperationException();
}
/**
* Returns the X.500 distinguished name of this certificate's subject.
*
* @return The subject's X.500 distinguished name.
* @since JDK 1.4
*/
public javax.security.auth.x500.X500Principal getSubjectX500Principal()
{
throw new UnsupportedOperationException();
}
/**
* Returns the X.500 distinguished name of this certificate's issuer.
*
* @return The issuer's X.500 distinguished name.
* @since JDK 1.4
*/
public javax.security.auth.x500.X500Principal getIssuerX500Principal()
{
throw new UnsupportedOperationException();
}
}