添加中移指令接口
This commit is contained in:
@@ -13,7 +13,7 @@ import java.io.InputStream;
|
||||
* Created by Cheney on 2017/11/11.
|
||||
* 程序调用接口
|
||||
*/
|
||||
public interface SydApi extends SydRawApi, SydCertApi, SydCryptionApi, SydGenApi, SydSVApi, SydHAApi, SydQNUCApi, SydPledge, SydPINOpt, SydManufactureApi {
|
||||
public interface SydApi extends SydRawApi, SydCertApi, SydCryptionApi, SydGenApi, SydSVApi, SydHAApi, SydQNUCApi, SydPledge, SydPINOpt, SydManufactureApi, SydZYOption {
|
||||
|
||||
byte ALG_AES = 0x30;
|
||||
byte ALG_SM4 = 0x31;
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.sunyard.entity;
|
||||
|
||||
import com.sunyard.util.MyUtil;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Auther: wp
|
||||
* @Date: 2021/6/1 20:11
|
||||
* @Description:
|
||||
*/
|
||||
//导出密钥分散结构体
|
||||
public class Struct {
|
||||
String ucKeyIdex; //导出密钥索引
|
||||
int iKeyDivNum; //导出密钥分散级数
|
||||
List<byte[]> ucKeyDivData; //导出密钥分散数据
|
||||
int[] iKeyDivAlg; //导出密钥分散算法
|
||||
List<byte[]> ucKeyDivIv; //导出密钥IV
|
||||
int iCheckValueType; //导出密钥校验值生成类型
|
||||
|
||||
public int getiCheckValueType() {
|
||||
return iCheckValueType;
|
||||
}
|
||||
|
||||
public void setiCheckValueType(int iCheckValueType) {
|
||||
this.iCheckValueType = iCheckValueType;
|
||||
}
|
||||
|
||||
public Struct() {
|
||||
}
|
||||
|
||||
public Struct(String ucKeyIdex, int iKeyDivNum, List<byte[]> ucKeyDivData, int[] iKeyDivAlg, List<byte[]> ucKeyDivIv, int iCheckValueType) {
|
||||
this.setUcKeyIdex(ucKeyIdex);
|
||||
this.iKeyDivNum = iKeyDivNum;
|
||||
this.setUcKeyDivData(ucKeyDivData);
|
||||
this.iKeyDivAlg = iKeyDivAlg;
|
||||
this.setUcKeyDivIv(ucKeyDivIv);
|
||||
this.iCheckValueType=iCheckValueType;
|
||||
}
|
||||
|
||||
public String getUcKeyIdex() {
|
||||
return ucKeyIdex;
|
||||
}
|
||||
|
||||
public void setUcKeyIdex(String ucKeyIdex) {
|
||||
|
||||
String gId = "00000000" + ucKeyIdex;
|
||||
gId = gId.substring(gId.length() - 8);
|
||||
ucKeyIdex="0000000000000000000"+gId;
|
||||
|
||||
// byte[] b= new byte[27];
|
||||
// System.arraycopy(ucKeyIdex,0,b,0,ucKeyIdex.length);
|
||||
this.ucKeyIdex = ucKeyIdex;
|
||||
}
|
||||
|
||||
public int getiKeyDivNum() {
|
||||
return iKeyDivNum;
|
||||
}
|
||||
|
||||
public void setiKeyDivNum(int iKeyDivNum) {
|
||||
this.iKeyDivNum = iKeyDivNum;
|
||||
}
|
||||
|
||||
public List<byte[]> getUcKeyDivData() {
|
||||
return ucKeyDivData;
|
||||
}
|
||||
|
||||
public void setUcKeyDivData(List<byte[]> ucKeyDivData) {
|
||||
// byte[] b= new byte[48];
|
||||
// System.arraycopy(ucKeyDivData,0,b,0,ucKeyDivData.length);
|
||||
this.ucKeyDivData = ucKeyDivData;
|
||||
}
|
||||
|
||||
public List<byte[]> getUcKeyDivIv() {
|
||||
return ucKeyDivIv;
|
||||
}
|
||||
|
||||
public void setUcKeyDivIv(List<byte[]> ucKeyDivIv) {
|
||||
this.ucKeyDivIv = ucKeyDivIv;
|
||||
}
|
||||
|
||||
public int[] getiKeyDivAlg() {
|
||||
return iKeyDivAlg;
|
||||
}
|
||||
|
||||
public void setiKeyDivAlg(int[] iKeyDivAlg) {
|
||||
this.iKeyDivAlg = iKeyDivAlg;
|
||||
}
|
||||
|
||||
public byte[] getByte() {
|
||||
ByteBuffer byteBuffer = ByteBuffer.allocate(144);
|
||||
//导出密钥索引
|
||||
byteBuffer.put(ucKeyIdex.getBytes());
|
||||
byteBuffer.put((byte) 0x0);
|
||||
|
||||
//分散级数,补充到4字节
|
||||
byte[] bytes = MyUtil.int2ReverseByteArray(iKeyDivNum);
|
||||
byte[] b1= new byte[4];
|
||||
System.arraycopy(bytes,0,b1,0,bytes.length);
|
||||
byteBuffer.put(b1);
|
||||
|
||||
//导出密钥分散数据
|
||||
byte[] byteData= new byte[48];
|
||||
int destPos=0;
|
||||
for (byte[] b:ucKeyDivData ){
|
||||
System.arraycopy(b,0,byteData,destPos,b.length);
|
||||
destPos+=b.length;
|
||||
}
|
||||
byteBuffer.put(byteData);
|
||||
|
||||
//填充分散算法,每一个补充到4字节
|
||||
for (int i = 0; i < 3; i++) {
|
||||
byte[] bytes1;
|
||||
if(i<iKeyDivAlg.length){
|
||||
bytes1 = MyUtil.int2ReverseByteArray(MyUtil.transAlg(iKeyDivAlg[i]));
|
||||
}else{
|
||||
bytes1=new byte[4];
|
||||
}
|
||||
byte[] b2= new byte[4];
|
||||
System.arraycopy(bytes1,0,b2,0,bytes1.length);
|
||||
byteBuffer.put(b2);
|
||||
}
|
||||
|
||||
//导出密钥IV
|
||||
byte[] byteIv= new byte[48];
|
||||
int destIvPos=0;
|
||||
for (byte[] b:ucKeyDivIv ){
|
||||
System.arraycopy(b,0,byteIv,destIvPos,b.length);
|
||||
destPos+=b.length;
|
||||
}
|
||||
byteBuffer.put(byteIv);
|
||||
|
||||
//密钥校验值生成类型,补充到4字节
|
||||
byte[] bytes1 = MyUtil.int2ReverseByteArray(iCheckValueType);
|
||||
byte[] b2= new byte[4];
|
||||
System.arraycopy(bytes1,0,b2,0,bytes1.length);
|
||||
byteBuffer.put(b2);
|
||||
|
||||
return MyUtil.bytebuffer2ByteArray(byteBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -371,6 +371,6 @@ interface SydSYMApi {
|
||||
public String SYMDecrytByKeyIndex(String key,String intPutData);
|
||||
|
||||
//通过索引读取对称秘钥
|
||||
String readKey(String index);
|
||||
RetWrap readKey(String index);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
package com.sunyard.inf;
|
||||
|
||||
import com.sunyard.RetWrap;
|
||||
import com.sunyard.entity.Struct;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Auther: wp
|
||||
* @Date: 2021/6/1 19:59
|
||||
* @Description: 中移电子指令接口
|
||||
*/
|
||||
public interface SydZYOption {
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为外部密钥
|
||||
* @param algFlag 算法类型支持算法:3DES、AES、SM1、SM4
|
||||
* @param iv IV 数据域,当算法标识为3DES-CBC、DES-CBC 时,该域为8B。
|
||||
* 当算法标识为AES-CBC、SM1-CBC、SM4-CBC 时,该域为16B。
|
||||
* @param divNum 密钥分散级数 ,0~3
|
||||
* @param divData 分散因子
|
||||
* @param divAlgFlag 分散算法标识
|
||||
* @param divIv 分散算法的初始向量
|
||||
* @param inputData 输入数据
|
||||
* @return byte[] 数据
|
||||
* @author wp
|
||||
* @Description:(A0)对称加密接口
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] SYMEncryt(int storageType, String key, int algFlag, byte[] iv, int divNum, List<byte[]> divData, int[] divAlgFlag, List<byte[]> divIv, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为外部密钥
|
||||
* @param algFlag 算法类型支持算法:3DES、AES、SM1、SM4
|
||||
* @param iv IV 数据域,当算法标识为3DES-CBC、DES-CBC 时,该域为8B。
|
||||
* 当算法标识为AES-CBC、SM1-CBC、SM4-CBC 时,该域为16B。
|
||||
* @param divNum 密钥分散级数 ,0~3
|
||||
* @param divData 分散因子
|
||||
* @param divAlgFlag 分散算法标识
|
||||
* @param divIv 分散算法的初始向量
|
||||
* @param inputData 输入数据
|
||||
* @return byte[] 数据
|
||||
* @author wp
|
||||
* @Description:(A1)对称解密接口
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] SYMDecryt(int storageType, String key, int algFlag, byte[] iv, int divNum, List<byte[]> divData, int[] divAlgFlag, List<byte[]> divIv, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为外部密钥
|
||||
* @param algFlag 当存储类型为0时:仅支持3DES-ECB(07)、3DES-CBC(08)
|
||||
* 当存储类型为1时:仅支持3DES-ECB、3DES-CBC、HMAC-SHA256(14)
|
||||
* @param iv 仅当算法为3DES-CBC模式下有此域
|
||||
* @param divNum 密钥分散级数 ,0~3
|
||||
* @param divData 分散因子
|
||||
* @param divAlgFlag 分散算法标识
|
||||
* @param divIv 分散算法的初始向量
|
||||
* @param inputData 输入数据
|
||||
* @param macDataLen 需要的MAC数据长度
|
||||
* @return byte[] 输出的MAC数据
|
||||
* @author wp
|
||||
* @Description:(A2)产生MAC接口
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] genMAC(int storageType, String key, int algFlag, byte[] iv, int divNum, List<byte[]> divData, int[] divAlgFlag, List<byte[]> divIv, byte[] inputData, int macDataLen);
|
||||
|
||||
/**
|
||||
* @param keyIndex 密钥索引
|
||||
* @param iv 仅当算法为3DES-CBC模式下有此域
|
||||
* @param divNum 密钥分散级数 ,0~3
|
||||
* @param divData 分散因子
|
||||
* @param divAlgFlag 分散算法标识
|
||||
* @param divIv 分散算法的初始向量
|
||||
* @param inputData 输入数据
|
||||
* @return byte[] 输出的MacAndNextIv数据16字节,前8字节为MAC,后8字节为下一次IV
|
||||
* @author wp
|
||||
* @Description: (A3)尾端3DES-CBC算法计算MAC及下一次IV(内部密钥
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] genMacAndNextIv(String keyIndex, byte[] iv, int divNum, List<byte[]> divData, int[] divAlgFlag, List<byte[]> divIv, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型,0-存储在内部 1-存储在外部
|
||||
* @param algFlag 算法类型:仅支持RSA、SM2
|
||||
* @param keyLength 密钥长度:RSA密钥长度:1024、2048 SM2密钥长度:256
|
||||
* @param keyIndex 密钥索引
|
||||
* @return com.sunyard.RetWrap publicKey:公钥, privateKey-私钥
|
||||
* @author wp
|
||||
* @Description: (A4)生成非对称密钥
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
RetWrap genSYMkey(int storageType, int algFlag, int keyLength, String keyIndex);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param algFlag 算法类型:仅支持RSA、SM2
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为签名私钥
|
||||
* @param inputData 数据
|
||||
* @return byte[] 签名数据
|
||||
* @author wp
|
||||
* @Description: (A5)签名接口
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] signData(int storageType, int algFlag, String key, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param algFlag 算法类型:仅支持RSA、SM2
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为验签公钥
|
||||
* @param orgData 原数据
|
||||
* @param signData 签名数据
|
||||
* @return java.lang.Boolean
|
||||
* @author wp
|
||||
* @Description: (A6)验签接口——(自定义)
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
Boolean verifySignData(int storageType, int algFlag, String key, byte[] orgData, byte[] signData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param algFlag 算法类型:仅支持RSA、SM2
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为公钥
|
||||
* @param inputData 明文
|
||||
* @return byte[] 密文
|
||||
* @author wp
|
||||
* @Description: (A7)非对称加密接口——(自定义)
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] ASYMEnData(int storageType, int algFlag, String key, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param algFlag 算法类型:仅支持RSA、SM2
|
||||
* @param key 使用内部密钥时,该值传后八位密钥索引;使用外部密钥时,该值为私钥
|
||||
* @param cipherText 密文
|
||||
* @return byte[] 明文
|
||||
* @author wp
|
||||
* @Description: (A8)非对称解密接口
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] ASYMDeData(int storageType, int algFlag, String key, byte[] cipherText);
|
||||
|
||||
/**
|
||||
* @author wp
|
||||
* @Description:
|
||||
* @date 2021/6/1
|
||||
* @param protectedKeyIndex 保护密钥的索引
|
||||
* @param algFlag 保护密钥算法
|
||||
* @param iv IV 数据域
|
||||
* @param protectedKeyDivNum 保护密钥分散级数
|
||||
* @param protectedKeyDivData 分散因子
|
||||
* @param protectedKeyDivAlgFlag 分散算法标识
|
||||
* @param protectedKeyDivIv 分散算法的初始向量
|
||||
* @param exportKeyNum 导出的密钥索引个数
|
||||
* @param structList 导出的密钥结构体集合
|
||||
* @return com.sunyard.RetWrap
|
||||
*/
|
||||
RetWrap exportKeyAndCalc(String protectedKeyIndex, int algFlag, byte[] iv, int protectedKeyDivNum, List<byte[]> protectedKeyDivData, int[] protectedKeyDivAlgFlag, List<byte[]> protectedKeyDivIv, int exportKeyNum, List<? extends Struct> structList);
|
||||
|
||||
/**
|
||||
* @param keyIndex 密钥索引
|
||||
* @param divNum 密钥分散级数 ,0~3
|
||||
* @param divData 分散因子
|
||||
* @param divAlgFlag 分散算法标识
|
||||
* @param divIv 分散算法的初始向量
|
||||
* @param clientRandom 客户端随机数
|
||||
* @param serverRandom 服务端随机数
|
||||
* @return byte[] 会话密钥
|
||||
* @author wp
|
||||
* @Description: (B1)HTTPS密钥协商
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] consultKey(String keyIndex, int divNum, List<byte[]> divData, int[] divAlgFlag, List<byte[]> divIv,
|
||||
byte[] clientRandom, byte[] serverRandom);
|
||||
|
||||
/**
|
||||
* @param key 外部密钥
|
||||
* @param seed 种子
|
||||
* @param outLen 输出数据长度
|
||||
* @return byte[] pHash
|
||||
* @author wp
|
||||
* @Description:(B2)HTTPS PHash算法(外部密钥)
|
||||
* @date 2021/5/31
|
||||
*/
|
||||
byte[] pHash(String key, String seed, int outLen);
|
||||
|
||||
/**
|
||||
* @param decryptKeyIndex 存储类型 0-使用内部密钥,1-使用外部密钥
|
||||
* @param decryptAlgFlag 解密算法类型
|
||||
* @param decryptIv 解密初始向量
|
||||
* @param decryptKeyDivNum 解密密钥分散级数
|
||||
* @param decryptKeyDivData 解密分散因子
|
||||
* @param decryptKeyDivAlgFlag 解密分散算法标识
|
||||
* @param decryptKeyDivIv 解密分散算法的初始向量
|
||||
* @param encryptKeyIndex 加密密钥索引
|
||||
* @param encryptAlgFlag 加密密钥算法
|
||||
* @param encryptIv 加密密钥IV
|
||||
* @param encryptKeyDivNum 加密密钥分散级数
|
||||
* @param encryptKeyDivData 加密分散因子
|
||||
* @param encryptKeyDivAlgFlag 加密分散算法标识
|
||||
* @param encryptKeyDivIv 加密分散算法的初始向量
|
||||
* @param inputData 输入数据
|
||||
* @return byte[] 加密后的数据
|
||||
* @author wp
|
||||
* @Description: (B3)内部密钥1解密并使用内部密钥2加密
|
||||
* @date 2021/6/1
|
||||
*/
|
||||
byte[] decrytAndEn(String decryptKeyIndex, int decryptAlgFlag, byte[] decryptIv, int decryptKeyDivNum, List<byte[]> decryptKeyDivData, int[] decryptKeyDivAlgFlag, List<byte[]> decryptKeyDivIv,
|
||||
String encryptKeyIndex, int encryptAlgFlag, byte[] encryptIv, int encryptKeyDivNum, List<byte[]> encryptKeyDivData, int[] encryptKeyDivAlgFlag, List<byte[]> encryptKeyDivIv,
|
||||
byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param storageType 存储类型 0-使用内部密钥 1-使用外部密钥
|
||||
* @param key 使用内部密钥时为解密私钥索引,使用外部密钥时为解密私钥
|
||||
* @param decryptAlgFlag 解密算法类型
|
||||
* @param inputData 待转加密的数据
|
||||
* @param prefixIgnoreCount 使用解密后、加密前,需要对数据的前指定直接做截断(接口不做处理,提供给客户需要)
|
||||
* @param suffixIgnoreCount 使用解密后、加密前,需要对数据的后指定直接做截断(接口不做处理,提供给客户需要)
|
||||
* @return byte[] 使用加密机主密钥加密的对称密钥
|
||||
* @author wp
|
||||
* @Description:(B4)非对称密钥解密并输出主密钥加密对称密钥密文
|
||||
* @date 2021/6/1
|
||||
*/
|
||||
byte[] ASYMDecryptAndEn(int storageType, String key, int decryptAlgFlag, byte[] inputData, int prefixIgnoreCount, int suffixIgnoreCount);
|
||||
|
||||
/**
|
||||
* @param decryptKey 解密密钥
|
||||
* @param decryptAlgFlag 解密算法类型
|
||||
* @param decryptIv IV 数据域
|
||||
* @param inputData 待转加密的数据
|
||||
* @return byte[] 密码机主密钥加密的密钥密文
|
||||
* @author wp
|
||||
* @Description: (B5)外部对称密钥解密并输出主密钥加密对称密钥密文
|
||||
* @date 2021/6/1
|
||||
*/
|
||||
byte[] SYMDecryptAndEn(String decryptKey, int decryptAlgFlag, byte[] decryptIv, byte[] inputData);
|
||||
|
||||
/**
|
||||
* @param encryptKeyIndex enKeyIndex
|
||||
* @param encryptAlgFlag 加密算法类型
|
||||
* @param encryptIv 加密算法IV
|
||||
* @param encryptKeyDivNum 加密密钥分散级数
|
||||
* @param encryptKeyDivData 加密分散因子
|
||||
* @param encryptKeyDivAlgFlag 加密分散算法标识
|
||||
* @param encryptKeyDivIv 加密分散算法的初始向量
|
||||
* @param inputData 待加密机主密钥解密的数据
|
||||
* @return byte[] 离散密钥加密的数据密文
|
||||
* @author wp
|
||||
* @Description:(B6)主密钥解密并输出内部密钥加密的对称密钥密文
|
||||
* @date 2021/6/1
|
||||
*/
|
||||
byte[] decryptByMainAndSYMEn(String encryptKeyIndex, int encryptAlgFlag, byte[] encryptIv, int encryptKeyDivNum,
|
||||
List<byte[]> encryptKeyDivData, int[] encryptKeyDivAlgFlag, List<byte[]> encryptKeyDivIv, byte[] inputData);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.sunyard.util;
|
||||
|
||||
import com.sunyard.proto.Util;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @Auther: wp
|
||||
* @Date: 2021/6/1 17:02
|
||||
* @Description:
|
||||
*/
|
||||
public class MyUtil {
|
||||
/**
|
||||
* byteBuffer 转 byte数组
|
||||
*
|
||||
* @param buffer
|
||||
* @return
|
||||
*/
|
||||
public static byte[] bytebuffer2ByteArray(ByteBuffer buffer) {
|
||||
//重置 limit 和postion 值
|
||||
buffer.flip();
|
||||
//获取buffer中有效大小
|
||||
int len = buffer.limit() - buffer.position();
|
||||
|
||||
byte[] bytes = new byte[len];
|
||||
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
bytes[i] = buffer.get();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param num
|
||||
* @return byte[]
|
||||
* @author wp
|
||||
* @Description: 将int 专成指定格式的hex,"0*000000" 返回byte[]
|
||||
* @date 2021/6/1
|
||||
*/
|
||||
public static byte[] int2ReverseByteArray(int num) {
|
||||
// StringBuffer stringBuffer = new StringBuffer();
|
||||
// while (num != 0) {
|
||||
// int a = num % 10;
|
||||
// stringBuffer.append(a);
|
||||
// num /= 10;
|
||||
// }
|
||||
//
|
||||
// return (stringBuffer.toString()).getBytes();
|
||||
String gId = "00" + num;
|
||||
gId = gId.substring(gId.length() - 2) + "0000";
|
||||
return Util.hexString2Bytes(gId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param alg
|
||||
* @return int
|
||||
* @author wp
|
||||
* @Description: 算法标识映射
|
||||
* @date 2021/6/7
|
||||
*/
|
||||
public static int transAlg(int alg) {
|
||||
int res;
|
||||
switch (alg) {
|
||||
case 11: //SM1-ECB
|
||||
res = 1;
|
||||
break;
|
||||
case 12: //SM1-CBC
|
||||
res = 2;
|
||||
break;
|
||||
case 21: //SM4-ECB
|
||||
res = 3;
|
||||
break;
|
||||
case 22: //SM4-CBC
|
||||
res = 4;
|
||||
break;
|
||||
case 31: //DES-ECB
|
||||
res = 5;
|
||||
break;
|
||||
case 32: //DES-CBC
|
||||
res = 6;
|
||||
break;
|
||||
case 41: //3DES-ECB
|
||||
res = 7;
|
||||
break;
|
||||
case 42: //3DES-CBC
|
||||
res = 8;
|
||||
break;
|
||||
case 51: //AES-ECB
|
||||
res = 9;
|
||||
break;
|
||||
case 52: //AES-CBC
|
||||
res = 10;
|
||||
break;
|
||||
case 101: //RSA
|
||||
res = 11;
|
||||
break;
|
||||
case 102: //SM2
|
||||
res = 12;
|
||||
break;
|
||||
case 111: //HMAC-SHA1
|
||||
res = 13;
|
||||
break;
|
||||
case 112: //HMAC-SHA256
|
||||
res = 14;
|
||||
break;
|
||||
default:
|
||||
res = 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user