Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将我的 P12 证书保存在云环境中,并且我正在从环境变量中获取 Java 中的这些证书。现在我得到一个 PFX base 64 编码的字符串和密码。我想将字符串转换回 P12 证书。有谁知道这是怎么做到的吗?
您可以将 base64 字符串解码为 a byte[],然后从中制作 a ByteArrayInputStream。然后只需使用以下密钥库方法从中读取: KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(byteArrInputStream, "password".toCharArray());
byte[]
ByteArrayInputStream
KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(byteArrInputStream, "password".toCharArray());