📄 keystore.html
字号:
aliases</H3><PRE>public final <A HREF="../../java/util/Enumeration.html">Enumeration</A> <B>aliases</B>() throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Lists all the alias names of this keystore.<DD><DL><DT><B>Returns:</B><DD>enumeration of the alias names<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="containsAlias(java.lang.String)"><!-- --></A><H3>containsAlias</H3><PRE>public final boolean <B>containsAlias</B>(<A HREF="../../java/lang/String.html">String</A> alias) throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Checks if the given alias exists in this keystore.<DD><DL><DT><B>Parameters:</B><DD><CODE>alias</CODE> - the alias name<DT><B>Returns:</B><DD>true if the alias exists, false otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public final int <B>size</B>() throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Retrieves the number of entries in this keystore.<DD><DL><DT><B>Returns:</B><DD>the number of entries in this keystore<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="isKeyEntry(java.lang.String)"><!-- --></A><H3>isKeyEntry</H3><PRE>public final boolean <B>isKeyEntry</B>(<A HREF="../../java/lang/String.html">String</A> alias) throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Returns true if the entry identified by the given alias is a <i>key entry</i>, and false otherwise.<DD><DL><DT><B>Parameters:</B><DD><CODE>alias</CODE> - the alias for the keystore entry to be checked<DT><B>Returns:</B><DD>true if the entry identified by the given alias is a <i>key entry</i>, false otherwise.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="isCertificateEntry(java.lang.String)"><!-- --></A><H3>isCertificateEntry</H3><PRE>public final boolean <B>isCertificateEntry</B>(<A HREF="../../java/lang/String.html">String</A> alias) throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Returns true if the entry identified by the given alias is a <i>trusted certificate entry</i>, and false otherwise.<DD><DL><DT><B>Parameters:</B><DD><CODE>alias</CODE> - the alias for the keystore entry to be checked<DT><B>Returns:</B><DD>true if the entry identified by the given alias is a <i>trusted certificate entry</i>, false otherwise.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="getCertificateAlias(java.security.cert.Certificate)"><!-- --></A><H3>getCertificateAlias</H3><PRE>public final <A HREF="../../java/lang/String.html">String</A> <B>getCertificateAlias</B>(<A HREF="../../java/security/cert/Certificate.html">Certificate</A> cert) throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></PRE><DL><DD>Returns the (alias) name of the first keystore entry whose certificate matches the given certificate. <p>This method attempts to match the given certificate with each keystore entry. If the entry being considered is a <i>trusted certificate entry</i>, the given certificate is compared to that entry's certificate. If the entry being considered is a <i>key entry</i>, the given certificate is compared to the first element of that entry's certificate chain (if a chain exists).<DD><DL><DT><B>Parameters:</B><DD><CODE>cert</CODE> - the certificate to match with.<DT><B>Returns:</B><DD>the (alias) name of the first entry with matching certificate, or null if no such entry exists in this keystore.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).</DL></DD></DL><HR><A NAME="store(java.io.OutputStream, char[])"><!-- --></A><H3>store</H3><PRE>public final void <B>store</B>(<A HREF="../../java/io/OutputStream.html">OutputStream</A> stream, char[] password) throws <A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A>, <A HREF="../../java/io/IOException.html">IOException</A>, <A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A>, <A HREF="../../java/security/cert/CertificateException.html">CertificateException</A></PRE><DL><DD>Stores this keystore to the given output stream, and protects its integrity with the given password.<DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the output stream to which this keystore is written.<DD><CODE>password</CODE> - the password to generate the keystore integrity check<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/KeyStoreException.html">KeyStoreException</A></CODE> - if the keystore has not been initialized (loaded).<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if there was an I/O problem with data<DD><CODE><A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A></CODE> - if the appropriate data integrity algorithm could not be found<DD><CODE><A HREF="../../java/security/cert/CertificateException.html">CertificateException</A></CODE> - if any of the certificates included in the keystore data could not be stored</DL></DD></DL><HR><A NAME="load(java.io.InputStream, char[])"><!-- --></A><H3>load</H3><PRE>public final void <B>load</B>(<A HREF="../../java/io/InputStream.html">InputStream</A> stream, char[] password) throws <A HREF="../../java/io/IOException.html">IOException</A>, <A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A>, <A HREF="../../java/security/cert/CertificateException.html">CertificateException</A></PRE><DL><DD>Loads this KeyStore from the given input stream. <p>If a password is given, it is used to check the integrity of the keystore data. Otherwise, the integrity of the keystore is not checked. <p>In order to create an empty keystore, or if the keystore cannot be initialized from a stream (e.g., because it is stored on a hardware token device), you pass <code>null</code> as the <code>stream</code> argument. <p> Note that if this KeyStore has already been loaded, it is reinitialized and loaded again from the given input stream.<DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the input stream from which the keystore is loaded, or null if an empty keystore is to be created.<DD><CODE>password</CODE> - the (optional) password used to check the integrity of the keystore.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if there is an I/O or format problem with the keystore data<DD><CODE><A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A></CODE> - if the algorithm used to check the integrity of the keystore cannot be found<DD><CODE><A HREF="../../java/security/cert/CertificateException.html">CertificateException</A></CODE> - if any of the certificates in the keystore could not be loaded</DL></DD></DL><HR><A NAME="getDefaultType()"><!-- --></A><H3>getDefaultType</H3><PRE>public static final <A HREF="../../java/lang/String.html">String</A> <B>getDefaultType</B>()</PRE><DL><DD>Returns the default keystore type as specified in the Java security properties file, or the string "jks" (acronym for "Java keystore") if no such property exists. The Java security properties file is located in the file named <JAVA_HOME>/lib/security/java.security, where <JAVA_HOME> refers to the directory where the SDK was installed. <p>The default keystore type can be used by applications that do not want to use a hard-coded keystore type when calling one of the <code>getInstance</code> methods, and want to provide a default keystore type in case a user does not specify its own. <p>The default keystore type can be changed by setting the value of the "keystore.type" security property (in the Java security properties file) to the desired keystore type.<DD><DL><DT><B>Returns:</B><DD>the default keystore type as specified in the Java security properties file, or the string "jks" if no such property exists.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_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/KeyStore.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/KeyPairGeneratorSpi.html"><B>PREV CLASS</B></A> <A HREF="../../java/security/KeyStoreSpi.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="KeyStore.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | 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><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -