📄 signature.html
字号:
<BR> Initialize this object for signing.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#initVerify(java.security.cert.Certificate)">initVerify</A></B>(<A HREF="../../java/security/cert/Certificate.html">Certificate</A> certificate)</CODE><BR> Initializes this object for verification, using the public key from the given certificate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#initVerify(java.security.PublicKey)">initVerify</A></B>(<A HREF="../../java/security/PublicKey.html">PublicKey</A> publicKey)</CODE><BR> Initializes this object for verification.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#setParameter(java.security.spec.AlgorithmParameterSpec)">setParameter</A></B>(<A HREF="../../java/security/spec/AlgorithmParameterSpec.html">AlgorithmParameterSpec</A> params)</CODE><BR> Initializes this signature engine with the specified parameter set.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#setParameter(java.lang.String, java.lang.Object)">setParameter</A></B>(<A HREF="../../java/lang/String.html">String</A> param, <A HREF="../../java/lang/Object.html">Object</A> value)</CODE><BR> <B>Deprecated.</B> <I>Use <A HREF="../../java/security/Signature.html#setParameter(java.security.spec.AlgorithmParameterSpec)"><CODE>setParameter</CODE></A>.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#sign()">sign</A></B>()</CODE><BR> Returns the signature bytes of all the data updated.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#sign(byte[], int, int)">sign</A></B>(byte[] outbuf, int offset, int len)</CODE><BR> Finishes the signature operation and stores the resulting signature bytes in the provided buffer <code>outbuf</code>, starting at <code>offset</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#toString()">toString</A></B>()</CODE><BR> Returns a string representation of this signature object, providing information that includes the state of the object and the name of the algorithm used.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#update(byte)">update</A></B>(byte b)</CODE><BR> Updates the data to be signed or verified by a byte.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#update(byte[])">update</A></B>(byte[] data)</CODE><BR> Updates the data to be signed or verified, using the specified array of bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#update(byte[], int, int)">update</A></B>(byte[] data, int off, int len)</CODE><BR> Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/security/Signature.html#verify(byte[])">verify</A></B>(byte[] signature)</CODE><BR> Verifies the passed-in signature.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.security.SignatureSpi"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.security.<A HREF="../../java/security/SignatureSpi.html">SignatureSpi</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/security/SignatureSpi.html#engineGetParameter(java.lang.String)">engineGetParameter</A>, <A HREF="../../java/security/SignatureSpi.html#engineInitSign(java.security.PrivateKey)">engineInitSign</A>, <A HREF="../../java/security/SignatureSpi.html#engineInitSign(java.security.PrivateKey, java.security.SecureRandom)">engineInitSign</A>, <A HREF="../../java/security/SignatureSpi.html#engineInitVerify(java.security.PublicKey)">engineInitVerify</A>, <A HREF="../../java/security/SignatureSpi.html#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">engineSetParameter</A>, <A HREF="../../java/security/SignatureSpi.html#engineSetParameter(java.lang.String, java.lang.Object)">engineSetParameter</A>, <A HREF="../../java/security/SignatureSpi.html#engineSign()">engineSign</A>, <A HREF="../../java/security/SignatureSpi.html#engineSign(byte[], int, int)">engineSign</A>, <A HREF="../../java/security/SignatureSpi.html#engineUpdate(byte)">engineUpdate</A>, <A HREF="../../java/security/SignatureSpi.html#engineUpdate(byte[], int, int)">engineUpdate</A>, <A HREF="../../java/security/SignatureSpi.html#engineVerify(byte[])">engineVerify</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="UNINITIALIZED"><!-- --></A><H3>UNINITIALIZED</H3><PRE>protected static final int <B>UNINITIALIZED</B></PRE><DL><DD>Possible <A HREF="../../java/security/Signature.html#state"><CODE>state</CODE></A> value, signifying that this signature object has not yet been initialized.</DL><HR><A NAME="SIGN"><!-- --></A><H3>SIGN</H3><PRE>protected static final int <B>SIGN</B></PRE><DL><DD>Possible <A HREF="../../java/security/Signature.html#state"><CODE>state</CODE></A> value, signifying that this signature object has been initialized for signing.</DL><HR><A NAME="VERIFY"><!-- --></A><H3>VERIFY</H3><PRE>protected static final int <B>VERIFY</B></PRE><DL><DD>Possible <A HREF="../../java/security/Signature.html#state"><CODE>state</CODE></A> value, signifying that this signature object has been initialized for verification.</DL><HR><A NAME="state"><!-- --></A><H3>state</H3><PRE>protected int <B>state</B></PRE><DL><DD>Current state of this signature object.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Signature(java.lang.String)"><!-- --></A><H3>Signature</H3><PRE>protected <B>Signature</B>(<A HREF="../../java/lang/String.html">String</A> algorithm)</PRE><DL><DD>Creates a Signature object for the specified algorithm.<DD><DL><DT><B>Parameters:</B><DD><CODE>algorithm</CODE> - the standard string name of the algorithm. See Appendix A in the <a href= "../../../guide/security/CryptoSpec.html#AppA"> Java Cryptography Architecture API Specification & Reference </a> for information about standard algorithm names.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getInstance(java.lang.String)"><!-- --></A><H3>getInstance</H3><PRE>public static <A HREF="../../java/security/Signature.html">Signature</A> <B>getInstance</B>(<A HREF="../../java/lang/String.html">String</A> algorithm) throws <A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A></PRE><DL><DD>Generates a Signature object that implements the specified digest algorithm. If the default provider package provides an implementation of the requested digest algorithm, an instance of Signature containing that implementation is returned. If the algorithm is not available in the default package, other packages are searched.<DD><DL><DT><B>Parameters:</B><DD><CODE>algorithm</CODE> - the standard name of the algorithm requested. See Appendix A in the <a href= "../../../guide/security/CryptoSpec.html#AppA"> Java Cryptography Architecture API Specification & Reference </a> for information about standard algorithm names.<DT><B>Returns:</B><DD>the new Signature object.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A></CODE> - if the algorithm is not available in the environment.</DL></DD></DL><HR><A NAME="getInstance(java.lang.String, java.lang.String)"><!-- --></A><H3>getInstance</H3><PRE>public static <A HREF="../../java/security/Signature.html">Signature</A> <B>getInstance</B>(<A HREF="../../java/lang/String.html">String</A> algorithm, <A HREF="../../java/lang/String.html">String</A> provider) throws <A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A>, <A HREF="../../java/security/NoSuchProviderException.html">NoSuchProviderException</A></PRE><DL><DD>Generates a Signature object implementing the specified algorithm, as supplied from the specified provider, if such an algorithm is available from the provider.<DD><DL><DT><B>Parameters:</B><DD><CODE>algorithm</CODE> - the name of the algorithm requested. See Appendix A in the <a href= "../../../guide/security/CryptoSpec.html#AppA"> Java Cryptography Architecture API Specification & Reference </a> for information about standard algorithm names.<DD><CODE>provider</CODE> - the name of the provider.<DT><B>Returns:</B><DD>the new Signature object.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</A></CODE> - if the algorithm is not available in the package supplied by the requested provider.<DD><CODE><A HREF="../../java/security/NoSuchProviderException.html">NoSuchProviderException</A></CODE> - if the provider is not available in the environment.<DT><B>See Also: </B><DD><A HREF="../../java/security/Provider.html"><CODE>Provider</CODE></A></DL></DD></DL><HR><A NAME="getProvider()"><!-- --></A><H3>getProvider</H3><PRE>public final <A HREF="../../java/security/Provider.html">Provider</A> <B>getProvider</B>()</PRE><DL><DD>Returns the provider of this signature object.<DD><DL><DT><B>Returns:</B><DD>the provider of this signature object</DL></DD></DL><HR><A NAME="initVerify(java.security.PublicKey)"><!-- --></A><H3>initVerify</H3><PRE>public final void <B>initVerify</B>(<A HREF="../../java/security/PublicKey.html">PublicKey</A> publicKey) throws <A HREF="../../java/security/InvalidKeyException.html">InvalidKeyException</A></PRE><DL><DD>Initializes this object for verification. If this method is called again with a different argument, it negates the effect of this call.<DD><DL><DT><B>Parameters:</B><DD><CODE>publicKey</CODE> - the public key of the identity whose signature is going to be verified.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/InvalidKeyException.html">InvalidKeyException</A></CODE> - if the key is invalid.</DL></DD></DL><HR><A NAME="initVerify(java.security.cert.Certificate)"><!-- --></A><H3>initVerify</H3><PRE>public final void <B>initVerify</B>(<A HREF="../../java/security/cert/Certificate.html">Certificate</A> certificate) throws <A HREF="../../java/security/InvalidKeyException.html">InvalidKeyException</A></PRE><DL><DD>Initializes this object for verification, using the public key from the given certificate. <p>If the certificate is of type X.509 and has a <i>key usage</i> extension field marked as critical, and the value of the <i>key usage</i> extension field implies that the public key in the certificate and its corresponding private key are not supposed to be used for digital signatures, an <code>InvalidKeyException</code> is thrown.<DD><DL><DT><B>Parameters:</B><DD><CODE>certificate</CODE> - the certificate of the identity whose signature is going to be verified.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/security/InvalidKeyException.html">InvalidKeyException</A></CODE> - if the public key in the certificate is not encoded properly or does not include required parameter information or cannot be used for digital signature purposes.</DL></DD></DL><HR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -