//Pkcs1ToPkcs8 public static byte[] formatPkcs1ToPkcs8(String rawKey) throws Exception { String validKey = rawKey; if (!org.springframework.util.StringUtils.isEmpty(validKey)) { //将BASE64编码的私钥字符串进行解码 byte[] encodeByte = Base64.decodeBase64(validKey); AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PKCSObjectIdentifiers.pkcs8ShroudedKeyBag); ASN1Object asn1Object = ASN1ObjectIdentifier.fromByteArray(encodeByte); PrivateKeyInfo privKeyInfo = new PrivateKeyInfo(algorithmIdentifier, asn1Object); byte[] pkcs8Bytes = privKeyInfo.getEncoded(); return Base64.encodeBase64(pkcs8Bytes); } return null; } <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>1.60</version> </dependency> 后面的操作就一样了
企业微信 会话内容存档 RSA 解密问题能不能提供一个解密的 Java 版 demo? 怎么解密都不对~~~~~~~
2020-09-11