public boolean verify(PublicKey publicKey) throws Exception { SMIMESigned signed = new SMIMESigned(body); SignerInformationStore signers = signed.getSignerInfos(); SignerInformation signer = (SignerInformation) signers.getSigners().iterator().next(); return (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(publicKey))); }
SignerInformationStore signers = signedMessage.getSignerInfos(); Iterator<SignerInformation> it = signers.getSigners().iterator();
public void validate(X509Certificate certificate) throws OxalisSecurityException, PeppolSecurityException { try { SignerInformationVerifier verifier = new JcaSimpleSignerInfoVerifierBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(certificate.getPublicKey()); for (SignerInformation signerInformation : smimeSigned.getSignerInfos().getSigners()) { if (signerInformation.verify(verifier)) { signer = certificate; digest = signerInformation.getContentDigest(); return; } } } catch (CMSException e) { throw new OxalisSecurityException(e.getMessage(), e); } catch (OperatorCreationException e) { throw new OxalisSecurityException("Unable to create SignerInformationVerifier.", e); } throw new PeppolSecurityException("Unable to verify signature."); }
public void validate(X509Certificate certificate) throws OxalisSecurityException, PeppolSecurityException { try { SignerInformationVerifier verifier = new JcaSimpleSignerInfoVerifierBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(certificate.getPublicKey()); for (SignerInformation signerInformation : smimeSigned.getSignerInfos().getSigners()) { if (signerInformation.verify(verifier)) { signer = certificate; digest = signerInformation.getContentDigest(); return; } } } catch (CMSException e) { throw new OxalisSecurityException(e.getMessage(), e); } catch (OperatorCreationException e) { throw new OxalisSecurityException("Unable to create SignerInformationVerifier.", e); } throw new PeppolSecurityException("Unable to verify signature."); }
.addCRLs(signed.getCRLs()) .build(); SignerInformationStore siginfo = signed.getSignerInfos(); Collection<SignerInformation> sigCol = siginfo.getSigners(); List<SMIMESignerInfo> result = new ArrayList<>(sigCol.size());