📄 x509certificate.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:36:10 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class X509Certificate</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/X509Certificate.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../java/security/cert/CRL.html"><B>PREV CLASS</B></A> <A HREF="../../../java/security/cert/X509CRL.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="X509Certificate.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_classes_inherited_from_class_java.security.cert.Certificate">INNER</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.security.cert</FONT><BR>Class X509Certificate</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../../java/security/cert/Certificate.html">java.security.cert.Certificate</A> | +--<B>java.security.cert.X509Certificate</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/io/Serializable.html">Serializable</A>, <A HREF="../../../java/security/cert/X509Extension.html">X509Extension</A></DD></DL><HR><DL><DT>public abstract class <B>X509Certificate</B><DT>extends <A HREF="../../../java/security/cert/Certificate.html">Certificate</A><DT>implements <A HREF="../../../java/security/cert/X509Extension.html">X509Extension</A></DL><P><p> Abstract class for X.509 certificates. This provides a standard way to access all the attributes of an X.509 certificate. <p> 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: <pre> Certificate ::= SEQUENCE { tbsCertificate TBSCertificate, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING } </pre> <p> 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). <p> These certificates are managed and vouched for by <em>Certificate Authorities</em> (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. <p> More information can be found in RFC 2459, "Internet X.509 Public Key Infrastructure Certificate and CRL Profile" at <A HREF="http://www.ietf.org/rfc/rfc2459.txt"> http://www.ietf.org/rfc/rfc2459.txt </A>. <p> The ASN.1 definition of <code>tbsCertificate</code> is: <pre> 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 } </pre> <p> Certificates are instantiated using a certificate factory. The following is an example of how to instantiate an X.509 certificate: <pre> InputStream inStream = new FileInputStream("fileName-of-cert"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); inStream.close(); </pre><P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/security/cert/Certificate.html"><CODE>Certificate</CODE></A>, <A HREF="../../../java/security/cert/CertificateFactory.html"><CODE>CertificateFactory</CODE></A>, <A HREF="../../../java/security/cert/X509Extension.html"><CODE>X509Extension</CODE></A>, <A HREF="../../../serialized-form.html#java.security.cert.X509Certificate">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_classes_inherited_from_class_java.security.cert.Certificate"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class java.security.cert.<A HREF="../../../java/security/cert/Certificate.html">Certificate</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/security/cert/Certificate.CertificateRep.html">Certificate.CertificateRep</A></CODE></TD></TR></TABLE> <!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#X509Certificate()">X509Certificate</A></B>()</CODE><BR> Constructor for X.509 certificates.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#checkValidity()">checkValidity</A></B>()</CODE><BR> Checks that the certificate is currently valid.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#checkValidity(java.util.Date)">checkValidity</A></B>(<A HREF="../../../java/util/Date.html">Date</A> date)</CODE><BR> Checks that the given date is within the certificate's validity period.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getBasicConstraints()">getBasicConstraints</A></B>()</CODE><BR> Gets the certificate constraints path length from the critical <code>BasicConstraints</code> extension, (OID = 2.5.29.19).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/security/Principal.html">Principal</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getIssuerDN()">getIssuerDN</A></B>()</CODE><BR> Gets the <code>issuer</code> (issuer distinguished name) value from the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract boolean[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getIssuerUniqueID()">getIssuerUniqueID</A></B>()</CODE><BR> Gets the <code>issuerUniqueID</code> value from the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract boolean[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getKeyUsage()">getKeyUsage</A></B>()</CODE><BR> Gets a boolean array representing bits of the <code>KeyUsage</code> extension, (OID = 2.5.29.15).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/util/Date.html">Date</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getNotAfter()">getNotAfter</A></B>()</CODE><BR> Gets the <code>notAfter</code> date from the validity period of the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/util/Date.html">Date</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getNotBefore()">getNotBefore</A></B>()</CODE><BR> Gets the <code>notBefore</code> date from the validity period of the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getSerialNumber()">getSerialNumber</A></B>()</CODE><BR> Gets the <code>serialNumber</code> value from the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getSigAlgName()">getSigAlgName</A></B>()</CODE><BR> Gets the signature algorithm name for the certificate signature algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getSigAlgOID()">getSigAlgOID</A></B>()</CODE><BR> Gets the signature algorithm OID string from the certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getSigAlgParams()">getSigAlgParams</A></B>()</CODE><BR> Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/security/cert/X509Certificate.html#getSignature()">getSignature</A></B>()</CODE><BR> Gets the <code>signature</code> value (the raw signature bits) from
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -