⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 applet.html

📁 JAVA CARD 开发包规格说明,版本为2.2.2
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#install(byte[], short, byte)">install</A></B>(byte[]&nbsp;bArray,        short&nbsp;bOffset,        byte&nbsp;bLength)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To create an instance of the <code>Applet</code> subclass, the Java Card runtime environment will call this static method first.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#process(javacard.framework.APDU)">process</A></B>(<A HREF="../../javacard/framework/APDU.html" title="class in javacard.framework">APDU</A>&nbsp;apdu)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called by the Java Card runtime environment to process an incoming APDU command.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#register()">register</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method is used by the applet to register <code>this</code> applet instance with the Java Card runtime environment and to assign the Java Card platform name of the applet as its instance AID bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#register(byte[], short, byte)">register</A></B>(byte[]&nbsp;bArray,         short&nbsp;bOffset,         byte&nbsp;bLength)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method is used by the applet to register <code>this</code> applet instance with the Java Card runtime environment and assign the specified AID bytes as its instance AID bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#select()">select</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called by the Java Card runtime environment to inform this applet that it has been selected when no applet from the same package is active on any other logical channel.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/Applet.html#selectingApplet()">selectingApplet</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method is used by the applet <code>process()</code> method to distinguish the SELECT APDU command which selected <code>this</code> applet, from all other SELECT APDU commands which may relate to file or internal applet state selection.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE></TD></TR></TABLE>&nbsp;<P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_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>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="Applet()"><!-- --></A><H3>Applet</H3><PRE>protected <B>Applet</B>()</PRE><DL><DD>Only this class's <code>install()</code> method should create the applet object.<P></DL><!-- ============ 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="install(byte[], short, byte)"><!-- --></A><H3>install</H3><PRE>public static void <B>install</B>(byte[]&nbsp;bArray,                           short&nbsp;bOffset,                           byte&nbsp;bLength)                    throws <A HREF="../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></PRE><DL><DD>To create an instance of the <code>Applet</code> subclass, the Java Card runtime environment will call this static method first. <p>The applet should perform any necessary initializations and must call one of the <code>register()</code> methods. Only one Applet instance can be successfully registered from within this install. The installation is considered successful when the call to <code>register()</code> completes without an exception. The installation is deemed unsuccessful if the <code>install</code> method does not call a <code>register()</code> method, or if an exception is thrown from within the <code>install</code> method prior to the call to a <code>register()</code> method, or if every call to the <code>register()</code> method results in an exception. If the installation is unsuccessful, the Java Card runtime environment must perform all the necessary clean up when it receives control. Successful installation makes the applet instance capable of being selected via a SELECT APDU command.<p> Installation parameters are supplied in the byte array parameter and must be in a format using length-value (LV) pairs as defined below: <pre> bArray[bOffset] = length(Li) of instance AID, bArray[bOffset+1..bOffset+Li] = instance AID bytes, bArray[bOffset+Li+1]= length(Lc) of control info, bArray[bOffset+Li+2..bOffset+Li+Lc+1] = control info, bArray[bOffset+Li+Lc+2] = length(La) of applet data, bArray[bOffset+Li+Lc+3..bOffset+Li+Lc+La+2] = applet data  </pre> In the above format, any of the lengths: Li, Lc or La may be zero. The control information is implementation dependent.  <p> The <code>bArray</code> object is a global array. If the applet desires to preserve any of this data, it should copy the data into its own object. <p><code>bArray</code> is zeroed by the Java Card runtime environment after the return from the <code>install()</code> method.<p> References to the <code>bArray</code> object cannot be stored in class variables or instance variables or array components. See <em>Runtime Environment Specification for the Java Card Platform</em>, section 6.2.2 for details.<p> The implementation of this method provided by <code>Applet</code> class throws an <code>ISOException</code> with reason code = <code>ISO7816.SW_FUNC_NOT_SUPPORTED</code>. <p>Note:<ul> <li><em>Exceptions thrown by this method after successful installation are caught by the Java Card runtime environment and processed by the Installer.</em> </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>bArray</CODE> - the array containing installation parameters<DD><CODE>bOffset</CODE> - the starting offset in bArray<DD><CODE>bLength</CODE> - the length in bytes of the parameter data in bArray The maximum value of bLength is 127.<DT><B>Throws:</B><DD><CODE><A HREF="../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></CODE> - if the install method failed</DL></DD></DL><HR><A NAME="process(javacard.framework.APDU)"><!-- --></A><H3>process</H3><PRE>public abstract void <B>process</B>(<A HREF="../../javacard/framework/APDU.html" title="class in javacard.framework">APDU</A>&nbsp;apdu)                      throws <A HREF="../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></PRE><DL><DD>Called by the Java Card runtime environment to process an incoming APDU command. An applet is expected to perform the action requested and return response data if any to the terminal.<p> Upon normal return from this method the Java Card runtime environment sends the ISO 7816-4 defined success status (90 00) in APDU response. If this method throws an <code>ISOException</code> the Java Card runtime environment sends the associated reason code as the response status instead.<p> The Java Card runtime environment zeroes out the APDU buffer before receiving a new APDU command from the CAD. The five header bytes (or optionally the 7 extended header bytes) of the APDU command are available in APDU buffer at the time this method is called.<p> The <code>APDU</code> object parameter is a temporary Java Card runtime environment Entry Point Object. A temporary Java Card runtime environment Entry Point Object can be accessed from any applet context. References to these temporary objects cannot be stored in class variables or instance variables or array components.<p> Notes:<ul> <li><em>APDU buffer[5..] should not be written prior to invoking the </em><code>APDU.setIncomingAndReceive()</code><em> method if incoming data is expected. Altering the APDU buffer[5..] could corrupt incoming data.</em> </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>apdu</CODE> - the incoming <code>APDU</code> object<DT><B>Throws:</B><DD><CODE><A HREF="../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></CODE> - with the response bytes per ISO 7816-4<DT><B>See Also:</B><DD><A HREF="../../javacard/framework/APDU.html" title="class in javacard.framework"><CODE>APDU</CODE></A></DL></DD></DL><HR><A NAME="select()"><!-- --></A><H3>select</H3><PRE>public boolean <B>select</B>()</PRE><DL><DD>Called by the Java Card runtime environment to inform this applet that it has been selected when no applet from the same package is active on any other logical channel. <p>It is called when a SELECT APDU command or MANAGE CHANNEL OPEN APDU command is received and before the applet is selected. SELECT APDU commands use instance AID bytes for applet selection. See <em>Runtime Environment Specification for the Java Card Platform</em>, section 4.5 for details.<p> A subclass of <code>Applet</code> should override this method if it should perform any initialization that may be required to process APDU commands that may follow. This method returns a boolean to indicate that it is ready to accept incoming APDU commands via its <code>process()</code> method. If this method returns false, it indicates to the Java Card runtime environment that this Applet declines to be selected. <p>Note:<ul> <li><em>The <CODE>javacard.framework.MultiSelectable.select(</CODE>) method is not called if this method is invoked.</em> </ul> <p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -