资源简介
jce-doubleca-sample.2019.10.15.zip
代码片段和文件信息
/**
*
*/
package com.doubleca.sample.pki.jce;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStore.Entry;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.SignatureException;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Enumeration;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import com.doubleca.b146.c16.util.encoders.base64;
import doubleca.security.provider.DoubleCA;
import doubleca.security.provider.jdk7.sm4.SM4KeySpec;
/**
* @author
*
*/
public class Test
{
private static final String SIGNATURE_KEY_ALGORITHM = “SM2“;
private static final String SIGNATURE_ALGORITHM = “SM3withSM2“;
private static final int SIGNATURE_KEY_SIZE = 256;
private static final String DIGEST_ALGORITHM = “SM3“;
private static final String CIPHER_SM4_KEY_ALGORITHM = “SM4“;
// private static final String CIPHER_SM4_ALGORITHM = “SM4/ECB/PKCS5Padding“;
private static final String CIPHER_SM4_ALGORITHM = “SM4/CBC/PKCS5Padding“;
// private static final String CIPHER_SM4_ALGORITHM = “SM4/ECB/NOPadding“;
// private static final String CIPHER_SM4_ALGORITHM = “SM4/CBC/NOPadding“;
private static final String CIPHER_SM2_ALGORITHM = “SM2/NONE/NOPadding“;
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
/**
* 说明:JDK7版本及以上,JDK需要使用无限制的策略文件 UnlimitedJCEPolicy
* 否则,SM2密钥长度为256位,JCE无法调用成功
*/
try
{
Security.addProvider(new DoubleCA());
System.out.println(““);
System.out.println(“TestSM2KeyPairGenerator“);
KeyPair key = TestSM2KeyPairGenerator();
System.out.println(““);
System.out.println(“TestSM2KeyFactory“);
TestSM2KeyFactory(key.getPublic().getEncoded() key.getPrivate().getEncoded());
System.out.println(““);
System.out.println(“TestSM3Digest“);
TestSM3Digest();
System.out.println(““);
System.out.println(“TestSM4Cipher“);
SecretKey sm4key = TestSM4Cipher();
System.out.println(““);
System.out.println(“TestSM2AsymmetricCipher“);
TestSM2AsymmetricCipher(key);
System.out.println(““);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-05 20:12 jce-doubleca-sample\
文件 376 2019-10-15 17:05 jce-doubleca-sample\.classpath
文件 395 2018-03-05 11:28 jce-doubleca-sample\.project
目录 0 2019-09-12 10:52 jce-doubleca-sample\.settings\
文件 598 2018-03-05 11:28 jce-doubleca-sample\.settings\org.eclipse.jdt.core.prefs
文件 81 2019-09-12 10:52 jce-doubleca-sample\.settings\org.hibernate.eclipse.console.prefs
目录 0 2019-10-15 17:07 jce-doubleca-sample\bin\
目录 0 2019-10-15 17:05 jce-doubleca-sample\lib\
文件 1306164 2019-10-15 17:05 jce-doubleca-sample\lib\doubleca-jce-1.1.1-SNAPSHOT.jar
目录 0 2018-03-06 23:24 jce-doubleca-sample\resources\
文件 3429 2018-03-05 21:29 jce-doubleca-sample\resources\1E7A9FA952485DBD8452B1B7BDBB8DF4.dcks
文件 590 2018-03-05 21:33 jce-doubleca-sample\resources\sm2cert.cer
文件 1377 2018-03-06 23:24 jce-doubleca-sample\resources\SM2SigningCert.dcks
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\com\
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\com\doubleca\
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\com\doubleca\sample\
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\com\doubleca\sample\pki\
目录 0 2018-03-05 20:12 jce-doubleca-sample\src\com\doubleca\sample\pki\jce\
文件 13049 2019-10-15 17:07 jce-doubleca-sample\src\com\doubleca\sample\pki\jce\Test.java
相关资源
- OFFICE密码破解AdvancedOfficePasswordRecove
- GB_T25070-2019信息安全技术网络安全等级
- 资源.zip
- code.tar.gz
- 博大打印机监控中心.zip
- 66409758bill-recognition.rar
- u014704659_7237895.EXE
- STUDIO_5000_CRACK.rar
- u014554378_9515282.zip
- 北理复试专业综合2009---2013.docx
- club.zip
- 产品心经.pdf
- 塞班手机破解教程工具.zip
- Global-Terrorism-Index-Report-2014.pdf
- 模式分类第二版课后习题答案.rar
- Baccarat.rar
- u014072827_9932443.zip
- ACOUSTICS_1_General_Program_Organization.pdf
- ProjectManagementthemanagerialprocess_5th.pdf
- MISSILEDATCOM.zip
- u013735695_10605802.zip
- u013548513_9645643.zip
- duanxinqunfa.zip
- 革新科技EDA_SOPC实验指导书.pdf
- kwl61n.zip
- f6e613c71e6c329f833fa14a078e09bb.rar
- GBT33577-2017智能运输系统车辆前向碰撞
- 毕业论文-燃气管进销存系统.docx
- 《ComputerNetworksATop-DownApproach》(Foro
- zip(3)
评论
共有 条评论