Java 探索有弹性的城堡商店对象
我的问题严格地说是关于 我使用的BC代码有一些小的变化Java 探索有弹性的城堡商店对象,java,cryptography,bouncycastle,Java,Cryptography,Bouncycastle,我的问题严格地说是关于 我使用的BC代码有一些小的变化 Store certStore = s.getCertificates(); SignerInformationStore signers = s.getSignerInfos(); Collection c = signers.getSigners(); Iterator it = c.iterator(); while (
Store certStore = s.getCertificates();
SignerInformationStore signers = s.getSignerInfos();
Collection c = signers.getSigners();
Iterator it = c.iterator();
while (it.hasNext())
{
SignerInformation signer = (SignerInformation)it.next();
Collection certCollection = certStore.getMatches(signer.getSID());
Iterator certIt = certCollection.iterator();
X509CertificateHolder cert = (X509CertificateHolder)certIt.next();
if (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert)))
{
verified++;
}
}
我的目的是从“certStore”中提取所有证书(签名者+发行者),并根据特定的密钥库验证它们
但要从certStore提取证书,只有“certStore.getMatches”
签名者显然只提取签名者,并在“certStore.getMatches”中使用,只提取签名者的证书(一个或多个)
我必须控制每个证书、其CRL和日期,而不仅仅是签名者。获取所有证书的第一步是使用空选择器
ArrayList<X509CertificateHolder> listCertDatFirm = new ArrayList(store.getMatches(null));
arraylistlistcertdatfirm=newarraylist(store.getMatches(null));
然后你有一组证书;重新循环可以重建正确的链