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 */ 016package com.pax.dal; 017 018import com.pax.dal.entity.TAEncryptedResult; 019import com.pax.dal.exceptions.P2PEException; 020 021/** 022 * <div class="zh">端到端加密模块。</div> 023 * <div class="en">Point-to-Point Encryption module.</div> 024 * @since V3.22.00 025 */ 026public interface IP2PE { 027 /** 028 * <div class="zh">Trans-Armor加密初始化。</div> <div class="en">Trans-Armor encryption initialization.</div> 029 * 030 * @param keyIndex <div class="zh">RSA公钥索引。范围:1~10。</div> <div class="en">RSA public key index. Range: 1~10.</div> 031 * @param pubKey <div class="zh">公钥信息。包括区域公钥 + 用US_PVK签名得到的签名信息。</div> <div class="en">Public key information. Including regional public key + information obtained by signing with US_PVK.</div> 032 * @param merchantID <div class="zh">和账号数据一起加密的商户ID。</div> <div class="en">Merchant ID encrypted with account data.</div> 033 * @throws P2PEException P2PEException 034 * @since V3.22.00 035 */ 036 void taInitContext(int keyIndex, byte[] pubKey, String merchantID) throws P2PEException; 037 038 /** 039 * <div class="zh">用RSA公钥对明文账号数据和商户ID进行加密。</div> <div class="en">Use the RSA public key to encrypt the plaintext account data and merchant ID.</div> 040 * 041 * @param keyIndex <div class="zh">RSA公钥索引。范围:1~10。</div> <div class="en">RSA public key index. Range: 1~10.</div> 042 * @param plainData <div class="zh">明文数据。如果是通过new String().getBytes()得到明文,需要在字符串后面加上"\0"。</div> <div class="en">Plain text data. If you get the plaintext through new String().getBytes(), you need to add "\0" after the string.</div> 043 * @return {@link TAEncryptedResult} 044 * @throws P2PEException P2PEException 045 * @since V3.22.00 046 */ 047 TAEncryptedResult taEncryptData(int keyIndex, byte[] plainData) throws P2PEException; 048 049 /** 050 * <div class="zh">结束Trans-Armor加密。</div> <div class="en">End Trans-Armor encryption.</div> 051 * 052 * @param keyIndex <div class="zh">RSA公钥索引。范围:1~10。</div> <div class="en">RSA public key index. Range: 1~10.</div> 053 * @throws P2PEException P2PEException 054 * @since V3.22.00 055 */ 056 void taDestroyContext(int keyIndex) throws P2PEException; 057 058}