私は証明書ストアを作成しましたが、このクラスの別の関数の別の証明書を追加します。 caCert
とintermediateCert
と、クラス1でCertStoreをX509Certificate []配列に変換します。JAVA
メイクチェーン:
List<X509Certificate> certList = new ArrayList<X509Certificate>();
certList.add(0, interCert);
certList.add(1, caCert);
Store<X509Certificate> certs = new JcaCertStore(certList);
certStore = new JcaCertStoreBuilder().addCertificates(certs).build();
私はクラス2で、新しいビルドのユーザー証明書を追加したい:
certStore = new JcaCertStoreBuilder().addCertificate(certHolder).build();
私KeyStore
に新しいキーを保存するにはI証明書の配列(X509Certificate[])
が必要です。 privatekeyentryを動作させるために、certStoreファイルを配列に変換するにはどうすればよいですか?
PrivateKeyEntry privKeyEntry = new PrivateKeyEntry(pair.getPrivate(), chain);
store.setEntry(alias, privKeyEntry, new KeyStore.PasswordProtection(storePassword));
bouncycastleを使用していますか? –
はい、私はbouncycastleを使用します。 – nolags