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