• 大小: 5.11M
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-09-17
  • 语言: 其他
  • 标签: 其他  

资源简介

DoubleCA-GMSSL-Sample.PPLIC.2019.02.19.zip

资源截图

代码片段和文件信息

/**
 * 
 */
package com.doubleca.security.gmssl.sample;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;

import doubleca.security.gmssl.provider.DoubleCASSE;
import doubleca.security.provider.DoubleCA;

/**
 * @author Home
 *
 */
public class GmSSLClientSample
{
/**
 * 
 */
private static DoubleCASSE dcsse = new DoubleCASSE();
/**
 * 用终端授权请求编码去http://www.pplic.com申请授权数据
 */
private static void generateLicRequest()
{
StringBuffer licRequest = new StringBuffer();
int result = dcsse.generateLicRequest(licRequest);
if (result == 0x70000000)
{
System.out.println(“终端授权请求编码:“);
System.out.println(licRequest.toString());
}
else
{
System.out.println(“终端授权请求编码出错,错误编号:0x“ + Integer.toHexString(result));
}
}
/**
 * 用授权数据初始化dcsse
 */
private static void initLic()
{
// 获得的本机授权数据,在http://www.pplic.com授权平台获取
String licData = “ASeraPDybn/wwAABTGQnuKT71OrK0gnV/OSwjRcgHXJAtseX+Tu2kqOJCnT4r4b9/FUYOKXfJ3nsjDarus6mo+WPax6Z4W8ONonjro7Ql0WxJgIM234bdV2xBvv8pUkD/dffwZfkQ/HfjXsz4QH2+TQ0eWcUr4f2hnfNDxczJ+g88pWVUuCbcxTLWdCWW547Bp2TJ5FQt28zWxSTXqoJxXavYMffp1PnvBL9DOjKLFhqRdLVVsoiIVTsikGEgHeKrUsjmft01PqSd9ErqWEXsGpslzVzuVBjGtyQh6Arz3Ksy1wyipor+7y4KrsTuD9qxvfEjKdHm58p0BacfOHXfLe8XUKDLADIddfDyMIgAXAiUG8Zh+oRw0qDIuIgVgaRGcQ0SEWpXQbl2wCXye2B9Oa2Pr+9+/OWS4LbxWIiDOEbTA4kQT/lklQ3sfBZZJkXPJtmMQx0HgNcsrX6tkoiZC1G0c4mSkbq6k8R5dIS6KcEycS2SekKCqmNmC1yd9QC2iAXIG/pcTaGWuTzPWbU+6lfu0MMm4zL9po1wBORzpVqxsTh6hhe0URpxqPdNQOWHRp7PxaCRhJrZAh7/DiwulJwu7I42zbXdkncmwHHj07DCyJiUJScXz4tVaC/BgRV93ySirRh9gTjV61DM97pS43adyOA2U4cGNO7nm5b7JLKInE4ukuislJZHDB/5hiDRE/H48KPZNB/EsEZVcEgIXaAaRwf1jOG6pvM9qS6Pg==“;
dcsse.setLicData(licData);
System.out.println(“授权有效期:“ + dcsse.getLicEndTime().toLocaleString());
}
/**
 * 
 * @throws KeyStoreException
 * @throws NoSuchAlgorithmException
 * @throws CertificateException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws UnrecoverableKeyException
 * @throws KeyManagementException
 * @throws NoSuchProviderException
 */
private static void clientGmSSL() throws KeyStoreException NoSuchAlgorithmException CertificateException FileNotFoundException IOException UnrecoverableKeyException KeyManagementException NoSuchProviderException
{
Secur

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-02-19 15:55  DoubleCA-GMSSL-Sample\
     文件         522  2019-02-19 15:57  DoubleCA-GMSSL-Sample\.classpath
     文件         397  2019-02-17 21:41  DoubleCA-GMSSL-Sample\.project
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\.settings\
     文件         598  2019-02-17 21:42  DoubleCA-GMSSL-Sample\.settings\org.eclipse.jdt.core.prefs
     目录           0  2019-02-19 16:24  DoubleCA-GMSSL-Sample\bin\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\libs\
     文件      887373  2018-04-10 09:06  DoubleCA-GMSSL-Sample\libs\doubleca-jce-0.9.4-SNAPSHOT.jar
     文件      249207  2019-02-19 14:50  DoubleCA-GMSSL-Sample\libs\doubleca-sse-0.9.1-SNAPSHOT.jar
     文件     4345729  2019-02-17 04:06  DoubleCA-GMSSL-Sample\libs\pp-auth-1.0.0-SNAPSHOT.jar
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\resources\
     文件        3414  2019-02-17 22:57  DoubleCA-GMSSL-Sample\resources\CLIENT.dcks
     文件        3413  2019-02-17 22:57  DoubleCA-GMSSL-Sample\resources\SERVER.dcks
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\com\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\com\doubleca\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\com\doubleca\security\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\com\doubleca\security\gmssl\
     目录           0  2019-02-19 15:54  DoubleCA-GMSSL-Sample\src\com\doubleca\security\gmssl\sample\
     文件        5695  2019-02-19 16:10  DoubleCA-GMSSL-Sample\src\com\doubleca\security\gmssl\sample\GmSSLClientSample.java
     文件        6274  2019-02-19 16:23  DoubleCA-GMSSL-Sample\src\com\doubleca\security\gmssl\sample\GmSSLServerSample.java

评论

共有 条评论