private void createPfxCert() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, IOException, CertificateException, InvalidKeySpecException, KeyStoreException {
String keyType = "RSA";//密钥算法
String certPassword = "111111";//证书密码
String commonName = "某某测试设备证书";//公司名称
String ucsCode = "ait1234567890";//公司社会信用码
String duration = "1";//证书有效期 单位为:月
KeyPair keyPair = KeyUtils.generateKeyPair(keyType.toLowerCase());
String dn = "CN="+commonName + ",OU="+ucsCode+",C=CN";
PKCS10CertificationRequest pkcs10CertificationRequest = CertUtils.generateCSR(new X500Name(dn), keyPair.getPublic(), keyPair.getPrivate());
String p10= Base64.encodeBytes(pkcs10CertificationRequest.getEncoded());
JSONObject certResult = applySemiCert(p10,commonName,ucsCode,duration);//申请证书
//log.info("certResult==="+certResult.toJSONString());
String errorCo
通过Java生成.pfx(.p12)证书文件
于 2023-02-03 16:43:24 首次发布

最低0.47元/天 解锁文章
9314





