📄 pin.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:07 PST 2006 --><TITLE>PIN (Java Card API and Subsets)</TITLE><META NAME="keywords" CONTENT="javacard.framework.PIN interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="PIN (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/PIN.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/framework/OwnerPIN.html" title="class in javacard.framework"><B>PREV CLASS</B></A> <A HREF="../../javacard/framework/PINException.html" title="class in javacard.framework"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javacard/framework/PIN.html" target="_top"><B>FRAMES</B></A> <A HREF="PIN.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.framework</FONT><BR>Interface PIN</H2><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../javacard/framework/OwnerPIN.html" title="class in javacard.framework">OwnerPIN</A></DD></DL><HR><DL><DT><PRE>public interface <B>PIN</B></DL></PRE><P>This interface represents a PIN. An implementation must maintain these internal values: <ul> <li>PIN value. <li>Try limit - the maximum number of times an incorrect PIN can be presented before the PIN is blocked. When the PIN is blocked, it cannot be validated even on valid PIN presentation. <li>Max PIN size - the maximum length of PIN allowed. <li>Try counter - the remaining number of times an incorrect PIN presentation is permitted before the <code>PIN</code> becomes blocked. <li>Validated flag - true if a valid PIN has been presented. This flag is reset on every card reset. </ul> This interface does not make any assumptions about where the data for the PIN value comparison is stored.<p> An owner implementation of this interface must provide a way to initialize/update the PIN value. The owner implementation of the interface must protect against attacks based on program flow prediction. In addition, even if a transaction is in progress, update of internal state such as the try counter, the validated flag, and the blocking state, shall not participate in the transaction during PIN presentation.<p> A typical card global PIN usage will combine an instance of <code>OwnerPIN</code> class and a a Proxy PIN interface which extends both the <code>PIN</code> and the <code>Shareable</code> interfaces and re-declares the methods of the PIN interface. The <code>OwnerPIN</code> instance would be manipulated only by the owner who has update privilege. All others would access the global PIN functionality via the proxy PIN interface.<P><P><DL><DT><B>See Also:</B><DD><A HREF="../../javacard/framework/OwnerPIN.html" title="class in javacard.framework"><CODE>OwnerPIN</CODE></A>, <A HREF="../../javacard/framework/Shareable.html" title="interface in javacard.framework"><CODE>Shareable</CODE></A></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> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javacard/framework/PIN.html#check(byte[], short, byte)">check</A></B>(byte[] pin, short offset, byte length)</CODE><BR> Compares <code>pin</code> against the PIN value.</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/framework/PIN.html#getTriesRemaining()">getTriesRemaining</A></B>()</CODE><BR> Returns the number of times remaining that an incorrect PIN can be presented before the <code>PIN</code> is blocked.</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/framework/PIN.html#isValidated()">isValidated</A></B>()</CODE><BR> Returns <code>true</code> if a valid PIN value has been presented since the last card reset or last call to <code>reset()</code>.</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/framework/PIN.html#reset()">reset</A></B>()</CODE><BR> If the validated flag is set, this method resets the validated flag and resets the <code>PIN</code> try counter to the value of the <code>PIN</code> try limit.</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="getTriesRemaining()"><!-- --></A><H3>getTriesRemaining</H3><PRE>byte <B>getTriesRemaining</B>()</PRE><DL><DD>Returns the number of times remaining that an incorrect PIN can be presented before the <code>PIN</code> is blocked.<P><DD><DL><DT><B>Returns:</B><DD>the number of times remaining</DL></DD></DL><HR><A NAME="check(byte[], short, byte)"><!-- --></A><H3>check</H3><PRE>boolean <B>check</B>(byte[] pin, short offset, byte length) throws <A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html" title="class in java.lang">ArrayIndexOutOfBoundsException</A>, <A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></PRE><DL><DD>Compares <code>pin</code> against the PIN value. If they match and the <code>PIN</code> is not blocked, it sets the validated flag and resets the try counter to its maximum. If it does not match, it decrements the try counter and, if the counter has reached zero, blocks the <code>PIN</code>. Even if a transaction is in progress, update of internal state - the try counter, the validated flag, and the blocking state, shall not participate in the transaction. <p> Note:<ul> <li><em>If </em><code>NullPointerException</code><em> or </em><code>ArrayIndexOutOfBoundsException</code><em> is thrown, the validated flag must be set to false, the try counter must be decremented and, the <code>PIN</code> blocked if the counter reaches zero.</em> <li><em>If </em><code>offset</code><em> or </em><code>length</code><em> parameter is negative an </em><code>ArrayIndexOutOfBoundsException</code><em> exception is thrown.</em> <li><em>If </em><code>offset+length</code><em> is greater than </em><code>pin.length</code><em>, the length of the </em><code>pin</code><em> array, an </em><code>ArrayIndexOutOfBoundsException</code><em> exception is thrown.</em> <li><em>If </em><code>pin</code><em> parameter is </em><code>null</code><em> a </em><code>NullPointerException</code><em> exception is thrown.</em></ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>pin</CODE> - the byte array containing the PIN value being checked<DD><CODE>offset</CODE> - the starting offset in the <code>pin</code> array<DD><CODE>length</CODE> - the length of <code>pin</code><DT><B>Returns:</B><DD><code>true</code> if the PIN value matches; <code>false</code> otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html" title="class in java.lang">ArrayIndexOutOfBoundsException</A></CODE> - if the check operation would cause access of data outside array bounds.<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - if <code>pin</code> is <code>null</code></DL></DD></DL><HR><A NAME="isValidated()"><!-- --></A><H3>isValidated</H3><PRE>boolean <B>isValidated</B>()</PRE><DL><DD>Returns <code>true</code> if a valid PIN value has been presented since the last card reset or last call to <code>reset()</code>.<P><DD><DL><DT><B>Returns:</B><DD><code>true</code> if validated; <code>false</code> otherwise</DL></DD></DL><HR><A NAME="reset()"><!-- --></A><H3>reset</H3><PRE>void <B>reset</B>()</PRE><DL><DD>If the validated flag is set, this method resets the validated flag and resets the <code>PIN</code> try counter to the value of the <code>PIN</code> try limit. If the validated flag is not set, this method does nothing.<P><DD><DL></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" 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_bottom_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/PIN.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/framework/OwnerPIN.html" title="class in javacard.framework"><B>PREV CLASS</B></A> <A HREF="../../javacard/framework/PINException.html" title="class in javacard.framework"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javacard/framework/PIN.html" target="_top"><B>FRAMES</B></A> <A HREF="PIN.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_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><i>Copyright © 1993-2005 Sun Microsystems, Inc. 4150 Network Circle,<br>Santa Clara, CA, 95054, U.S.A. All Rights Reserved.</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -