- 浏览: 2491987 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
bouncycastle(8)Learn from others ECC/KeyTool
ECC (Elliptic Curves Cryptography)
It is not supported by JDK from the content of other's blog. So I do not take time to verify the codes.
Work with KeyTool in JDK
prepare the key pair first
>keytool -genkey -validity 36000 -alias www.sillycat.com -keyalg RSA -keystore /Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore
-genkey means generate the key
-validity means the valid date, 36000 means 36000 days.
-alias means the name
-keyalg algorithm
-keystore where do we store the key pair
>keytool -export -keystore /Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore -alias www.sillycat.com -file /Users/karl/work/easy/easycastle/src/main/resources/sillycat.cer -rfc
-export
-keystore identify the key store file
-alias
-file where do we store the car file.
-rfc means output to txt based on base64
sillycat.keystore holds the private key, sillycat.cer holds the public key.
The implementation will be as follow.
package com.sillycat.easycastle.encryption;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Date;
import javax.crypto.Cipher;
publicabstractclass CertificateCoder extends Coder {
/**
* (Java Key Store,JKS)KEY_STORE
*/
publicstaticfinal String KEY_STORE = "JKS";
publicstaticfinal String X509 = "X.509";
/**
* get the private key from keystore
*
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
privatestatic PrivateKey getPrivateKey(String keyStorePath, String alias,
String password) throws Exception {
KeyStore ks = getKeyStore(keyStorePath, password);
PrivateKey key = (PrivateKey) ks.getKey(alias, password.toCharArray());
return key;
}
/**
* get the public key from certificate
*
* @param certificatePath
* @return
* @throws Exception
*/
privatestatic PublicKey getPublicKey(String certificatePath)
throws Exception {
Certificate certificate = getCertificate(certificatePath);
PublicKey key = certificate.getPublicKey();
return key;
}
privatestatic Certificate getCertificate(String certificatePath)
throws Exception {
FileInputStream in = null;
Certificate certificate = null;
CertificateFactory certificateFactory = CertificateFactory
.getInstance(X509);
in = new FileInputStream(certificatePath);
certificate = certificateFactory.generateCertificate(in);
in.close();
return certificate;
}
privatestatic Certificate getCertificate(String keyStorePath,
String alias, String password) throws Exception {
KeyStore ks = getKeyStore(keyStorePath, password);
Certificate certificate = ks.getCertificate(alias);
return certificate;
}
privatestatic KeyStore getKeyStore(String keyStorePath, String password)
throws Exception {
FileInputStream is = new FileInputStream(keyStorePath);
KeyStore ks = KeyStore.getInstance(KEY_STORE);
ks.load(is, password.toCharArray());
is.close();
return ks;
}
/**
* encrypt the data using private key
*
* @param data
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstaticbyte[] encryptByPrivateKey(byte[] data, String keyStorePath,
String alias, String password) throws Exception {
// get private key
PrivateKey privateKey = getPrivateKey(keyStorePath, alias, password);
// encrypt the data
Cipher cipher = Cipher.getInstance(privateKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
return cipher.doFinal(data);
}
/**
* decrypt the data using private key
*
* @param data
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstaticbyte[] decryptByPrivateKey(byte[] data, String keyStorePath,
String alias, String password) throws Exception {
// get the private key
PrivateKey privateKey = getPrivateKey(keyStorePath, alias, password);
// decrypt the data
Cipher cipher = Cipher.getInstance(privateKey.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return cipher.doFinal(data);
}
/**
* encrypt data based on public key
* @param data
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticbyte[] encryptByPublicKey(byte[] data, String certificatePath)
throws Exception {
// get the public key
PublicKey publicKey = getPublicKey(certificatePath);
// encrypt the data
Cipher cipher = Cipher.getInstance(publicKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return cipher.doFinal(data);
}
/**
* decrypt data based on public key
* @param data
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticbyte[] decryptByPublicKey(byte[] data, String certificatePath)
throws Exception {
// get the public key
PublicKey publicKey = getPublicKey(certificatePath);
// decrypt data
Cipher cipher = Cipher.getInstance(publicKey.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, publicKey);
return cipher.doFinal(data);
}
/**
* verify Certificate
* @param certificatePath
* @return
*/
publicstaticboolean verifyCertificate(String certificatePath) {
return verifyCertificate(new Date(), certificatePath);
}
/**
* verify Certificate valid
* @param date
* @param certificatePath
* @return
*/
publicstaticboolean verifyCertificate(Date date, String certificatePath) {
boolean status = true;
try {
// get the certificate
Certificate certificate = getCertificate(certificatePath);
status = verifyCertificate(date, certificate);
} catch (Exception e) {
status = false;
}
return status;
}
privatestaticboolean verifyCertificate(Date date, Certificate certificate) {
boolean status = true;
try {
X509Certificate x509Certificate = (X509Certificate) certificate;
x509Certificate.checkValidity(date);
} catch (Exception e) {
status = false;
}
return status;
}
/**
* signature
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstatic String sign(byte[] sign, String keyStorePath, String alias,
String password) throws Exception {
X509Certificate x509Certificate = (X509Certificate) getCertificate(
keyStorePath, alias, password);
KeyStore ks = getKeyStore(keyStorePath, password);
//get private key
PrivateKey privateKey = (PrivateKey) ks.getKey(alias,
password.toCharArray());
//generate signature object
Signature signature = Signature.getInstance(x509Certificate
.getSigAlgName());
signature.initSign(privateKey);
signature.update(sign);
return encryptBASE64(signature.sign());
}
/**
* verify the signature
* @param data
* @param sign
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticboolean verify(byte[] data, String sign,
String certificatePath) throws Exception {
X509Certificate x509Certificate = (X509Certificate) getCertificate(certificatePath);
//get public key
PublicKey publicKey = x509Certificate.getPublicKey();
//generate signature
Signature signature = Signature.getInstance(x509Certificate
.getSigAlgName());
signature.initVerify(publicKey);
signature.update(data);
return signature.verify(decryptBASE64(sign));
}
/**
* verify keystore
* @param keyStorePath
* @param alias
* @param password
* @return
*/
publicstaticboolean verifyCertificate(Date date, String keyStorePath,
String alias, String password) {
boolean status = true;
try {
Certificate certificate = getCertificate(keyStorePath, alias,
password);
status = verifyCertificate(date, certificate);
} catch (Exception e) {
status = false;
}
return status;
}
/**
* verify key store
* @param keyStorePath
* @param alias
* @param password
* @return
*/
publicstaticboolean verifyCertificate(String keyStorePath, String alias,
String password) {
return verifyCertificate(new Date(), keyStorePath, alias, password);
}
}
The test case will be as follow:
package com.sillycat.easycastle.encryption;
importstatic org.junit.Assert.assertArrayEquals;
importstatic org.junit.Assert.assertEquals;
importstatic org.junit.Assert.assertTrue;
import org.junit.Test;
publicclass CertificateCoderTest {
private String password = "123456";
private String alias = "www.sillycat.com";
private String certificatePath = "/Users/karl/work/easy/easycastle/src/main/resources/sillycat.cer";
private String keyStorePath = "/Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore";
@Test
publicvoid testPublic2Private() throws Exception {
System.out.println("\npublic key encrypt——private key decrypt\n");
String inputStr = "A new world will come at the end.";
byte[] data = inputStr.getBytes();
byte[] encrypt = CertificateCoder.encryptByPublicKey(data,
certificatePath);
byte[] decrypt = CertificateCoder.decryptByPrivateKey(encrypt,
keyStorePath, alias, password);
String outputStr = new String(decrypt);
String encryptStr = new String(encrypt);
System.out.println("data: " + inputStr);
System.out.println("decryption: " + outputStr);
System.out.println("encryption: " + encryptStr);
assertArrayEquals(data, decrypt);
// verify the cer file
assertTrue(CertificateCoder.verifyCertificate(certificatePath));
}
@Test
publicvoid testPrivate2Public() throws Exception {
System.out.println("\nprivate encryption——public decryption\n");
String inputStr = "what is the status?";
byte[] data = inputStr.getBytes();
byte[] encodedData = CertificateCoder.encryptByPrivateKey(data,
keyStorePath, alias, password);
byte[] decodedData = CertificateCoder.decryptByPublicKey(encodedData,
certificatePath);
String outputStr = new String(decodedData);
String encryptStr = new String(encodedData);
System.out.println("data: " + inputStr);
System.out.println("decryption: " + outputStr);
System.out.println("encryption: " + encryptStr);
assertEquals(inputStr, outputStr);
}
@Test
publicvoid testSign() throws Exception {
System.out.println("\nprivate sign——public verify signature\n");
String data = "It is rainy out side.";
// generate the sign
String sign = CertificateCoder.sign(data.getBytes(), keyStorePath, alias,
password);
System.out.println("signature:\r" + sign);
// verification
boolean status = CertificateCoder.verify(data.getBytes(), sign,
certificatePath);
System.out.println("status:\r" + status);
assertTrue(status);
}
}
references:
http://snowolf.iteye.com/blog/383412
http://snowolf.iteye.com/blog/391931
http://snowolf.iteye.com/blog/397693
http://snowolf.iteye.com/blog/398198
ECC (Elliptic Curves Cryptography)
It is not supported by JDK from the content of other's blog. So I do not take time to verify the codes.
Work with KeyTool in JDK
prepare the key pair first
>keytool -genkey -validity 36000 -alias www.sillycat.com -keyalg RSA -keystore /Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore
-genkey means generate the key
-validity means the valid date, 36000 means 36000 days.
-alias means the name
-keyalg algorithm
-keystore where do we store the key pair
>keytool -export -keystore /Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore -alias www.sillycat.com -file /Users/karl/work/easy/easycastle/src/main/resources/sillycat.cer -rfc
-export
-keystore identify the key store file
-alias
-file where do we store the car file.
-rfc means output to txt based on base64
sillycat.keystore holds the private key, sillycat.cer holds the public key.
The implementation will be as follow.
package com.sillycat.easycastle.encryption;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Date;
import javax.crypto.Cipher;
publicabstractclass CertificateCoder extends Coder {
/**
* (Java Key Store,JKS)KEY_STORE
*/
publicstaticfinal String KEY_STORE = "JKS";
publicstaticfinal String X509 = "X.509";
/**
* get the private key from keystore
*
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
privatestatic PrivateKey getPrivateKey(String keyStorePath, String alias,
String password) throws Exception {
KeyStore ks = getKeyStore(keyStorePath, password);
PrivateKey key = (PrivateKey) ks.getKey(alias, password.toCharArray());
return key;
}
/**
* get the public key from certificate
*
* @param certificatePath
* @return
* @throws Exception
*/
privatestatic PublicKey getPublicKey(String certificatePath)
throws Exception {
Certificate certificate = getCertificate(certificatePath);
PublicKey key = certificate.getPublicKey();
return key;
}
privatestatic Certificate getCertificate(String certificatePath)
throws Exception {
FileInputStream in = null;
Certificate certificate = null;
CertificateFactory certificateFactory = CertificateFactory
.getInstance(X509);
in = new FileInputStream(certificatePath);
certificate = certificateFactory.generateCertificate(in);
in.close();
return certificate;
}
privatestatic Certificate getCertificate(String keyStorePath,
String alias, String password) throws Exception {
KeyStore ks = getKeyStore(keyStorePath, password);
Certificate certificate = ks.getCertificate(alias);
return certificate;
}
privatestatic KeyStore getKeyStore(String keyStorePath, String password)
throws Exception {
FileInputStream is = new FileInputStream(keyStorePath);
KeyStore ks = KeyStore.getInstance(KEY_STORE);
ks.load(is, password.toCharArray());
is.close();
return ks;
}
/**
* encrypt the data using private key
*
* @param data
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstaticbyte[] encryptByPrivateKey(byte[] data, String keyStorePath,
String alias, String password) throws Exception {
// get private key
PrivateKey privateKey = getPrivateKey(keyStorePath, alias, password);
// encrypt the data
Cipher cipher = Cipher.getInstance(privateKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
return cipher.doFinal(data);
}
/**
* decrypt the data using private key
*
* @param data
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstaticbyte[] decryptByPrivateKey(byte[] data, String keyStorePath,
String alias, String password) throws Exception {
// get the private key
PrivateKey privateKey = getPrivateKey(keyStorePath, alias, password);
// decrypt the data
Cipher cipher = Cipher.getInstance(privateKey.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return cipher.doFinal(data);
}
/**
* encrypt data based on public key
* @param data
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticbyte[] encryptByPublicKey(byte[] data, String certificatePath)
throws Exception {
// get the public key
PublicKey publicKey = getPublicKey(certificatePath);
// encrypt the data
Cipher cipher = Cipher.getInstance(publicKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return cipher.doFinal(data);
}
/**
* decrypt data based on public key
* @param data
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticbyte[] decryptByPublicKey(byte[] data, String certificatePath)
throws Exception {
// get the public key
PublicKey publicKey = getPublicKey(certificatePath);
// decrypt data
Cipher cipher = Cipher.getInstance(publicKey.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, publicKey);
return cipher.doFinal(data);
}
/**
* verify Certificate
* @param certificatePath
* @return
*/
publicstaticboolean verifyCertificate(String certificatePath) {
return verifyCertificate(new Date(), certificatePath);
}
/**
* verify Certificate valid
* @param date
* @param certificatePath
* @return
*/
publicstaticboolean verifyCertificate(Date date, String certificatePath) {
boolean status = true;
try {
// get the certificate
Certificate certificate = getCertificate(certificatePath);
status = verifyCertificate(date, certificate);
} catch (Exception e) {
status = false;
}
return status;
}
privatestaticboolean verifyCertificate(Date date, Certificate certificate) {
boolean status = true;
try {
X509Certificate x509Certificate = (X509Certificate) certificate;
x509Certificate.checkValidity(date);
} catch (Exception e) {
status = false;
}
return status;
}
/**
* signature
* @param keyStorePath
* @param alias
* @param password
* @return
* @throws Exception
*/
publicstatic String sign(byte[] sign, String keyStorePath, String alias,
String password) throws Exception {
X509Certificate x509Certificate = (X509Certificate) getCertificate(
keyStorePath, alias, password);
KeyStore ks = getKeyStore(keyStorePath, password);
//get private key
PrivateKey privateKey = (PrivateKey) ks.getKey(alias,
password.toCharArray());
//generate signature object
Signature signature = Signature.getInstance(x509Certificate
.getSigAlgName());
signature.initSign(privateKey);
signature.update(sign);
return encryptBASE64(signature.sign());
}
/**
* verify the signature
* @param data
* @param sign
* @param certificatePath
* @return
* @throws Exception
*/
publicstaticboolean verify(byte[] data, String sign,
String certificatePath) throws Exception {
X509Certificate x509Certificate = (X509Certificate) getCertificate(certificatePath);
//get public key
PublicKey publicKey = x509Certificate.getPublicKey();
//generate signature
Signature signature = Signature.getInstance(x509Certificate
.getSigAlgName());
signature.initVerify(publicKey);
signature.update(data);
return signature.verify(decryptBASE64(sign));
}
/**
* verify keystore
* @param keyStorePath
* @param alias
* @param password
* @return
*/
publicstaticboolean verifyCertificate(Date date, String keyStorePath,
String alias, String password) {
boolean status = true;
try {
Certificate certificate = getCertificate(keyStorePath, alias,
password);
status = verifyCertificate(date, certificate);
} catch (Exception e) {
status = false;
}
return status;
}
/**
* verify key store
* @param keyStorePath
* @param alias
* @param password
* @return
*/
publicstaticboolean verifyCertificate(String keyStorePath, String alias,
String password) {
return verifyCertificate(new Date(), keyStorePath, alias, password);
}
}
The test case will be as follow:
package com.sillycat.easycastle.encryption;
importstatic org.junit.Assert.assertArrayEquals;
importstatic org.junit.Assert.assertEquals;
importstatic org.junit.Assert.assertTrue;
import org.junit.Test;
publicclass CertificateCoderTest {
private String password = "123456";
private String alias = "www.sillycat.com";
private String certificatePath = "/Users/karl/work/easy/easycastle/src/main/resources/sillycat.cer";
private String keyStorePath = "/Users/karl/work/easy/easycastle/src/main/resources/sillycat.keystore";
@Test
publicvoid testPublic2Private() throws Exception {
System.out.println("\npublic key encrypt——private key decrypt\n");
String inputStr = "A new world will come at the end.";
byte[] data = inputStr.getBytes();
byte[] encrypt = CertificateCoder.encryptByPublicKey(data,
certificatePath);
byte[] decrypt = CertificateCoder.decryptByPrivateKey(encrypt,
keyStorePath, alias, password);
String outputStr = new String(decrypt);
String encryptStr = new String(encrypt);
System.out.println("data: " + inputStr);
System.out.println("decryption: " + outputStr);
System.out.println("encryption: " + encryptStr);
assertArrayEquals(data, decrypt);
// verify the cer file
assertTrue(CertificateCoder.verifyCertificate(certificatePath));
}
@Test
publicvoid testPrivate2Public() throws Exception {
System.out.println("\nprivate encryption——public decryption\n");
String inputStr = "what is the status?";
byte[] data = inputStr.getBytes();
byte[] encodedData = CertificateCoder.encryptByPrivateKey(data,
keyStorePath, alias, password);
byte[] decodedData = CertificateCoder.decryptByPublicKey(encodedData,
certificatePath);
String outputStr = new String(decodedData);
String encryptStr = new String(encodedData);
System.out.println("data: " + inputStr);
System.out.println("decryption: " + outputStr);
System.out.println("encryption: " + encryptStr);
assertEquals(inputStr, outputStr);
}
@Test
publicvoid testSign() throws Exception {
System.out.println("\nprivate sign——public verify signature\n");
String data = "It is rainy out side.";
// generate the sign
String sign = CertificateCoder.sign(data.getBytes(), keyStorePath, alias,
password);
System.out.println("signature:\r" + sign);
// verification
boolean status = CertificateCoder.verify(data.getBytes(), sign,
certificatePath);
System.out.println("status:\r" + status);
assertTrue(status);
}
}
references:
http://snowolf.iteye.com/blog/383412
http://snowolf.iteye.com/blog/391931
http://snowolf.iteye.com/blog/397693
http://snowolf.iteye.com/blog/398198
发表评论
-
Update Site will come soon
2021-06-02 04:10 1617I am still keep notes my tech n ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 383Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 380Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 336Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 405VPN Server 2020(2)Docker on Cen ... -
Nginx Deal with OPTIONS in HTTP Protocol
2020-02-15 01:33 304Nginx Deal with OPTIONS in HTTP ... -
PDF to HTML 2020(1)pdftohtml Linux tool or PDFBox
2020-01-29 07:37 347PDF to HTML 2020(1)pdftohtml Li ... -
Elasticsearch Cluster 2019(2)Kibana Issue or Upgrade
2020-01-12 03:25 605Elasticsearch Cluster 2019(2)Ki ... -
Spark Streaming 2020(1)Investigation
2020-01-08 07:19 235Spark Streaming 2020(1)Investig ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 260Hadoop Docker 2019 Version 3.2. ... -
MongoDB 2019(3)Security and Auth
2019-11-16 06:48 206MongoDB 2019(3)Security and Aut ... -
MongoDB 2019(1)Install 4.2.1 Single and Cluster
2019-11-11 05:07 254MongoDB 2019(1) Follow this ht ... -
Monitor Tool 2019(1)Monit Installation and Usage
2019-10-17 08:22 290Monitor Tool 2019(1)Monit Insta ... -
Ansible 2019(1)Introduction and Installation on Ubuntu and CentOS
2019-10-12 06:15 275Ansible 2019(1)Introduction and ... -
Timezone and Time on All Servers and Docker Containers
2019-10-10 11:18 294Timezone and Time on All Server ... -
Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7
2019-10-05 23:28 242Kafka Cluster 2019(6) 3 Nodes C ... -
K8S Helm(1)Understand YAML and Kubectl Pod and Deployment
2019-10-01 01:21 292K8S Helm(1)Understand YAML and ... -
Rancher and k8s 2019(5)Private Registry
2019-09-27 03:25 329Rancher and k8s 2019(5)Private ... -
Jenkins 2019 Cluster(1)Version 2.194
2019-09-12 02:53 408Jenkins 2019 Cluster(1)Version ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 339Redis Cluster 2019(3)Redis Clus ...
相关推荐
org.bouncycastle 加密算法包,csdn上很多这个包的下载都不全,我这完整包里包含了9个jar包 1.69官网最新版本
org.bouncycastle完整资源包,有需要的可以下
解决org/bouncycastle/jce/provider/bouncycastlepr错误专用。
java借助bouncycastle库实现ECC双向加密解密算法Utils工具包。
NULL 博文链接:https://hnychenl.iteye.com/blog/675625
asn1 crypto i18n jce math mozilla ocsp openssl tsp util voms x509
bouncycastle jar包
bouncy castle(轻量级密码术包)是一种用于 Java 平台的开放源码的轻量级密码术包。它支持大量的密码术算法,并提供 JCE 1.2.1 的实现。
BouncyCastle是JAVA专属库,但出来了C#的库。这个非常实用。仅仅一个dll文件
BouncyCastle的相关资源包,若生成x509证书则需要此资源包,里面包含两个,版本是1.62
从官网(http://www.bouncycastle.org/docs/pkixdocs1.4/)获取的完整页面,然后制作而成的,内容可用,制作工具可用,工具使用方式可百度
BouncyCastle 加密算法.net组件 版本10.0
主要用于加解密,我是在使用解密SM4 时接触到的,在网上代码引用了Org.BouncyCastle.Utilities.Encoders,找不到库 自己在网上找了好久找到了,没有积分的可以去http://www.bouncycastle.org/csharp/ 下载
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.6.