📄 signaturemessagerecovery.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_02) on Wed Mar 22 19:19:11 PST 2006 --><TITLE>SignatureMessageRecovery (Java Card API and Subsets)</TITLE><META NAME="keywords" CONTENT="javacard.security.SignatureMessageRecovery interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="SignatureMessageRecovery (Java Card API and Subsets)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <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/SignatureMessageRecovery.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-all.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 Card </b><br><font size="-1">v2.2.2</font></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javacard/security/Signature.html" title="class in javacard.security"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javacard/security/SignatureMessageRecovery.html" target="_top"><B>FRAMES</B></A> <A HREF="SignatureMessageRecovery.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javacard.security</FONT><BR>Interface SignatureMessageRecovery</H2><HR><DL><DT><PRE>public interface <B>SignatureMessageRecovery</B></DL></PRE><P>A subclass of the abstract <code>Signature</code> class must implement this <code>SignatureMessageRecovery</code> interface to provide message recovery functionality. An instance implementing this interface is returned by the <A HREF="../../javacard/security/Signature.html#getInstance(byte, boolean)"><CODE>Signature.getInstance(byte, boolean)</CODE></A> method when algorithm type with suffix <code>*_MR</code> is specified. e.g.<A HREF="../../javacard/security/Signature.html#ALG_RSA_SHA_ISO9796_MR"><CODE>Signature.ALG_RSA_SHA_ISO9796_MR</CODE></A>.<p> This interface provides specialized versions of some of the methods defined in the <code>Signature</code> class to provide message recovery functions. An alternate version of the <code>sign()</code> and <code>verify()</code> methods is supported here along with a new <code>beginVerify</code> method to allow the message encoded in the signature to be recovered. <p>For signing a message with message recovery functionality, the user must cast the <code>Signature</code> object to this interface, initialize the object for signing with a private key using the <CODE>init()</CODE> method, and issue 0 or more <CODE>update()</CODE> method calls and then finally call the <CODE>sign()</CODE> method to obtain the signature. <p>For recovering the encoded message and verifying functionality, the user must cast the <code>Signature</code> object to this interface, initialize the object for verifying with a public key using the <CODE>init()</CODE> method, first recover the message using the <CODE>beginVerify()</CODE> method and then issue 0 or more <CODE>update()</CODE> method calls and then finally call the <CODE>verify()</CODE> method to verify the signature. <p>Note:<br>A <CODE>Signature</CODE> object implementing this interface must throw <CODE>CryptoException</CODE> with <CODE>CryptoException.ILLEGAL_USE</CODE> reason code when one of the following methods applicable only to a <CODE>Signature</CODE> object which does not include message recovery functionality, is called:<ul> <li><em>init(Key, byte, byte[], short, short)</em> <li><em>sign(byte[], short, short, byte[], short)</em> <li><em>verify(byte[], short, short, byte[], short, short)</em> </ul><P><P><DL><DT><B>Since:</B></DT> <DD>2.2.2</DD></DL><HR><P><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> short</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/security/SignatureMessageRecovery.html#beginVerify(byte[], short, short)">beginVerify</A></B>(byte[] sigAndRecDataBuff, short buffOffset, short sigLength)</CODE><BR> This method begins the verification sequence by recovering the message encoded within the signature itself and initializing the internal hash function.</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="../../javacard/security/SignatureMessageRecovery.html#getAlgorithm()">getAlgorithm</A></B>()</CODE><BR> Gets the Signature algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> short</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/security/SignatureMessageRecovery.html#getLength()">getLength</A></B>()</CODE><BR> Returns the byte length of the signature data.</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="../../javacard/security/SignatureMessageRecovery.html#init(javacard.security.Key, byte)">init</A></B>(<A HREF="../../javacard/security/Key.html" title="interface in javacard.security">Key</A> theKey, byte theMode)</CODE><BR> Initializes the <code>Signature</code> object with the appropriate <code>Key</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> short</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/security/SignatureMessageRecovery.html#sign(byte[], short, short, byte[], short, short[], short)">sign</A></B>(byte[] inBuff, short inOffset, short inLength, byte[] sigBuff, short sigOffset, short[] recMsgLen, short recMsgLenOffset)</CODE><BR> Generates the signature of all/last input data.</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="../../javacard/security/SignatureMessageRecovery.html#update(byte[], short, short)">update</A></B>(byte[] inBuff, short inOffset, short inLength)</CODE><BR> Accumulates a signature of the input data.</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="../../javacard/security/SignatureMessageRecovery.html#verify(byte[], short, short)">verify</A></B>(byte[] inBuff, short inOffset, short inLength)</CODE><BR> Verifies the signature of all/last input data against the passed in signature.</TD></TR></TABLE> <P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="init(javacard.security.Key, byte)"><!-- --></A><H3>init</H3><PRE>void <B>init</B>(<A HREF="../../javacard/security/Key.html" title="interface in javacard.security">Key</A> theKey, byte theMode) throws <A HREF="../../javacard/security/CryptoException.html" title="class in javacard.security">CryptoException</A></PRE><DL><DD>Initializes the <code>Signature</code> object with the appropriate <code>Key</code>. This method should be used for algorithms which do not need initialization parameters or use default parameter values. <p><code>init()</code> must be used to update the <code>Signature</code> object with a new key. If the <code>Key</code> object is modified after invoking the <code>init()</code> method, the behavior of the <code>update()</code>, <code>sign()</code>, and <code>verify()</code> methods is unspecified.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>theKey</CODE> - the key object to use for signing or verifying<DD><CODE>theMode</CODE> - one of <code>MODE_SIGN</code> or <code>MODE_VERIFY</code><DT><B>Throws:</B><DD><CODE><A HREF="../../javacard/security/CryptoException.html" title="class in javacard.security">CryptoException</A></CODE> - with the following reason codes:<ul> <li><code>CryptoException.ILLEGAL_VALUE</code> if <code>theMode</code> option is an undefined value or if the <code>Key</code> is inconsistent with <code>theMode</code> or with the <code>Signature</code> implementation. <li><code>CryptoException.UNINITIALIZED_KEY</code> if <code>theKey</code> instance is uninitialized. </ul></DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -