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.entity;
018
019/**
020 * <div class="zh"> KCV校验模式 </div> <div class="en"> KCV mode </div>
021 */
022public enum EAesCheckMode {
023
024    /**
025     * <div class="zh"> 无校验 </div> <div class="en"> No Check </div>
026     */
027    KCV_NONE((byte) 0x00),
028    /**
029     * <pre>
030     * <div class="zh">对16个字节的0x00进行AES ECB模式加密运算,得到的密文的前4个字节即为KCV值。 </div> 
031     * <div class="en">Perform AES ECB mode encryption on 16 bytes 0x00, and use first 4 bytes as KCV. </div>
032     * </pre>
033     */
034    KCV_ENCRYPT_0((byte) 0x01),
035    /**
036     * <pre>
037     * <div class="zh">首先对密钥明文进行奇校验,再对16字节长度 ―\x12\x34\x56\x78\x90\x12\x34\x56\x12\x34\x56\x78\x90\x12\x34\x56‖进行AES
038     * ECB模式的加密运算,得到的密文的前4个字节即为KCV值。 </div> 
039     * <div class="en"> Perform parity check first, then perform AES ECB mode encryption on 
040     * 16 bytes―\x12\x34\x56\x78\x90\x12\x34\x56\x12\x34\x56\x78\x90\x12\x34\x56‖, and use first 4 bytes as KCV.</div>
041     * </pre>
042     */
043    KCV_ENCRYPT_FIX_DATA((byte) 0x02),
044    /**
045     * <pre>
046     * <div class="zh"> checkMode=KCV_MAC_INPUT_DATA -传入一串数据KcvData,使用源密钥对[aucDstKeyValue(密文)+
047     * KcvData]进行指定模式的MAC运算,得到的8个字节的MAC值即为KCV值。 </div> 
048     * <div class="en">Send in data KcvData, use source key to perform specified mode of MAC 
049     * on [aucDesKeyValue(ciphertext) +KcvData], and use the 8 bytes result as KCV.</div>
050     * </pre>
051     */
052    KCV_MAC_INPUT_DATA((byte) 0x03);
053
054    private byte checkMode;
055
056    private EAesCheckMode(byte checkMode) {
057        this.checkMode = checkMode;
058    }
059
060    public byte getCheckMode() {
061        return checkMode;
062    }
063}