package com.allstar.platform.web;
import java.io.FileOutputStream;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Security;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Date;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.jce.X509Principal;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.x509.X509V3CertificateGenerator;
public class ClientCert {
static {
// 系统添加BC加密算法 以后系统中调用的算法都是BC的算法
Security.addProvider(new BouncyCastleProvider());
}
private static String certPath = "d:/lee.cer";
public static void main(String[] args) {
String publicKey = "30820122300D06092A864886F70D01010105000382010F003082010A02820101009DF0958AFBB1405C6C346930574DA3BFC15DA509F4C04B67A5FAF432CD8B98B3912F56C4C4F07E892EE26A50B830A4287699567EE4F21F8325B32DCA8113A8405FC8EDE8B32BB2859232DF6CBC869B719F253DA6904BEE62C68DA6ACF90EE572802351757D90A6BF3D751025EE756A80B1E4733C3856BEB000408F6A712F8CD3A3BEFECCEE2BEC7E6DC4C8938A8C81C565BE23D2F00500F02FB5E68910261B38AD64ED5122500E3F96F0E53AB02EE02CE350E359DB869B884B9D7378A4BE1F65871D371C311AEDF6ADECB4C96CC5468F0FA7E984636ABF4A47593DD6AE8844D011AA45CBE31A15F086481C932BD956F4C7C0B8760D61CFB46A14F54B98EA895B0203010001";
String privateKey = "308204BF020100300D06092A864886F70D0101010500048204A9308204A502010002820101009DF0958AFBB1405C6C346930574DA3BFC15DA509F4C04B67A5FAF432CD8B98B3912F56C4C4F07E892EE26A50B830A4287699567EE4F21F8325B32DCA8113A8405FC8EDE8B32BB2859232DF6CBC869B719F253DA6904BEE62C68DA6ACF90EE572802351757D90A6BF3D751025EE756A80B1E4733C3856BEB000408F6A712F8CD3A3BEFECCEE2BEC7E6DC4C8938A8C81C565BE23D2F00500F02FB5E68910261B38AD64ED5122500E3F96F0E53AB02EE02CE350E359DB869B884B9D7378A4BE1F65871D371C311AEDF6ADECB4C96CC5468F0FA7E984636ABF4A47593DD6AE8844D011AA45CBE31A15F086481C932BD956F4C7C0B8760D61CFB46A14F54B98EA895B020301000102820100681035A80E705A94CAE2B9901565DD87A1F37EA391B505B9F43DE69A769E0CEDFBB2323C91FA579531E412E2BE89A60FD71CEF45CAB9D1938ACA85585135CF7D22DF740A07CBB9E392519CAEBB8501749AC461DB9665C15B29B1F9692CECE8B749C07B92AB3A1CF4129D48178607AD35C08062810229FD985F822A3C9AF91692EEE6FF91B96C5DFCD7E2460FECA75CC0F593FBEE470EB1124402C4C98B2CC706B5A3C595C4E6205B68B606C26E6DE89EAAC45C3D7D2096A6165E3DAAECD3C2220B1924567614AED88B1423675C8EEBF31CAAA2F85EE1829CA6C48563F95682E5BFBF234053FBCCDAD34B9F902E3C4EB51DBC0A45EB538D30F2844BF91272D66902818100CBF7AD9C961DFE6E03F7AF3EFB5ABBC57A780C100A6A79A899D9424BD4ED8020FA45216D08C406F71BEE0EABF6F43BC50101B10E0060F75283835F0F85E43F5A7211F98BDDB886E32EA79ECC2471BE1774D328B30F83679D25B90C8120CCC6EE5D05AF88D2219413DC9EFFF191F34671B124EE7D77917BEA9337EB99FBA52BE702818100C63B03FEBBEA01AB24912AEFD757CD74B40835306296D284D6A9199F4EAA307D1D7C3402B9462ED13D50F199CC03BB5A0B665D7986FC30C27ECB2A30EA42CC705591A7D13A941B9F53F6BCCAA8B46D0F34A2F19D8AFAFFA2F938C6418A5FBC02
生成RSA密钥,证书
最新推荐文章于 2023-04-19 14:26:42 发布
这篇博客详细介绍了如何生成RSA加密算法的密钥对,并探讨了证书的创建过程,主要面向Java开发者,同时也涉及数据库和JSON相关知识。
摘要由CSDN通过智能技术生成