001 /*
002 * ===========================================================================================
003 * = COPYRIGHT
004 *          PAX Computer Technology (Shenzhen) Co., Ltd. PROPRIETARY INFORMATION
005 *   This software is supplied under the terms of a license agreement or nondisclosure
006 *   agreement with PAX Computer Technology (Shenzhen) Co., Ltd. and may not be copied or
007 *   disclosed except in accordance with the terms in that agreement.
008 *     Copyright (C) 2017-2023 PAX Computer Technology (Shenzhen) Co., Ltd. All rights reserved.
009 * Description: // Detail description about the function of this module,
010 *             // interfaces with the other modules, and dependencies.
011 * Revision History:
012 * Date                         Author                        Action
013 * 2017/04/01                   PAX                     Create/Add/Modify/Delete
014 * ===========================================================================================
015 */
016 
017package com.pax.dal.memorycard;
018
019import com.pax.dal.entity.QInfo;
020import com.pax.dal.exceptions.AT88SC153DevException;
021
022public interface ICardAT88SC153 extends IMemoryCard {
023
024    /**
025     * <div class="zh"> 重置 AT88SC153. </div> <div class="en"> Reset AT88SC153. </div>
026     * 
027     * @return <div class="zh"> 重置返回,4字节 </div> <div class="en"> data of reset, 4 bytes </div>
028     * @throws AT88SC153DevException
029     */
030    public byte[] open() throws AT88SC153DevException;
031
032    /**
033     * <div class="zh"> 关闭 AT88SC153. </div> <div class="en"> close AT88SC153. </div>
034     * 
035     * @throws AT88SC153DevException
036     */
037    public void close() throws AT88SC153DevException;
038
039    /**
040     * <div class="zh"> 读取EEPROM,当区号为3时,读取配置区块 </div> <div class="en"> Read EEPROM.When zoneNum=3,read Configuration
041     * Zone. </div>
042     * 
043     * @param zoneNum
044     *            <div class="zh"> 要读取的区号 </div> <div class="en"> the number of zone to be read </div>
045     * @param bAddr
046     *            <div class="zh"> 开始地址 </div> <div class="en"> begin address </div>
047     * @param nums
048     *            <div class="zh"> 要读取的数据长度 </div> <div class="en"> the length of the data to be read </div>
049     * @return <div class="zh"> 读取的数据 </div> <div class="en"> the read data </div>
050     * @throws AT88SC153DevException
051     */
052    public byte[] readEEPROM(byte zoneNum, int bAddr, int nums) throws AT88SC153DevException;
053
054    /**
055     * <div class="zh"> 写EEPROM </div> <div class="en"> Write EEPROM. </div>
056     * 
057     * @param zoneNum
058     *            <div class="zh"> 要读取的区号 </div> <div class="en"> the number of zone to be read </div>
059     * @param bAddr
060     *            <div class="zh"> 开始地址 </div> <div class="en"> begin address </div>
061     * @param dataBlock
062     *            <div class="zh"> 要写的数据 </div> <div class="en"> the data to be Written </div>
063     * @throws AT88SC153DevException
064     */
065    public void progEEPROM(byte zoneNum, int bAddr, byte[] dataBlock) throws AT88SC153DevException;
066
067    /**
068     * <div class="zh"> 验证密码 </div> <div class="en"> Verify password. </div>
069     * 
070     * @param index
071     *            <div class="zh"> 密码索引 </div> <div class="en"> the index of password </div>
072     * @param rwp
073     *            <div class="zh"> 1: 读取操作密码 0: 写操作密码 </div> <div class="en"> 1: read operation password 0: write
074     *            operation password </div>
075     * @param password
076     *            <div class="zh"> 密码,3字节 </div> <div class="en"> password, 3 bytes </div>
077     * @throws AT88SC153DevException
078     */
079    public void verifySC(int index, int rwp, byte[] password) throws AT88SC153DevException;
080
081    /**
082     * <div class="zh"> 初始化授权 </div> <div class="en"> Initialize authorization. </div>
083     * 
084     * @param randNumber
085     *            <div class="zh"> 随机数,8字节 </div> <div class="en"> random numbers, 8 bytes </div>
086     * @throws AT88SC153DevException
087     */
088    public void initAuth(byte[] randNumber) throws AT88SC153DevException;
089
090    /**
091     * <div class="zh"> 验证授权 </div> <div class="en"> Verify authorization. </div>
092     * 
093     * @param challenge
094     *            <div class="zh"> 授权信息,8字节 </div> <div class="en"> authentication info, 8 bytes </div>
095     * @throws AT88SC153DevException
096     */
097    public void verifyAuth(byte[] challenge) throws AT88SC153DevException;
098
099    /**
100     * <div class="zh"> 读熔丝字节。 </div> <div class="en"> Read fuse byte. </div>
101     * 
102     * @return <div class="zh"> 1字节熔丝数据 </div> <div class="en"> a byte fuse data </div>
103     * @throws AT88SC153DevException
104     */
105    public byte readFuse() throws AT88SC153DevException;
106
107    /**
108     * <div class="zh"> 写入熔丝字节。 </div> <div class="en"> Write fuse byte. </div>
109     * 
110     * @param fsVal
111     *            <div class="zh"> 要写入的字节 </div> <div class="en"> the byte to be written </div>
112     * @throws AT88SC153DevException
113     */
114    public void progFuse(byte fsVal) throws AT88SC153DevException;
115
116    /**
117     * <div class="zh"> ATMEL ELVA算法 </div> <div class="en"> ATMEL ELVA algorithm </div>
118     * 
119     * @param Ci
120     *            <div class="zh"> 随机数,由卡生成,8字节 </div> <div class="en"> random numbers,generated by card, 8 bytes </div>
121     * @param Gc
122     *            <div class="zh"> 密码子,8字节 </div> <div class="en"> password seed, 8bytes </div>
123     * @param Q0
124     *            <div class="zh"> 随机数,由终端产生,8字节 </div> <div class="en"> random numbers,generated by terminal, 8 bytes
125     *            </div>
126     * @return <div class="zh"> QInfo 有两个成员: byte[] Q1, byte[] Q2 </div> <div class="en"> QInfo has two members: byte[]
127     *         Q1, byte[] Q2 </div>
128     * @throws AT88SC153DevException
129     */
130    public QInfo cryptoF2_153(byte[] Ci, byte[] Gc, byte[] Q0) throws AT88SC153DevException;
131
132}