/** * Verifies that the {@link SignerInfo} (i.e., the cerificate chain) checks * out, i.e., chains up to a trusted CA, and has certificates that aren't * expired. * * @throws SignatureException if the certificate chain in the * {@link SignerInfo} does't verify. */ public void verifySignerInfo(SignerInfo signer) throws SignatureException { pathValidator.validate(signer.getCertificates()); }
@Override public Collection<X509Certificate> getTrustRoots() { try { return getSigner().getSignerInfo().getCertificates(); } catch (Exception e) { throw new RuntimeException(e); } } };
@Override public Collection<X509Certificate> getTrustRoots() { try { return getSigner().getSignerInfo().getCertificates(); } catch (Exception e) { throw new RuntimeException(e); } } };
/** * Checks whether for the given {@link SignerInfo} the certificates retrieved * from the {@link CertPathStore} match up. * * @param signerInfo the {@link SignerInfo} to get the certificates from the * {@link CertPathStore} for * @param certPathStore the {@link CertPathStore} to retrieve the certificates * from. */ private void checkCertificateExists(SignerInfo signerInfo, CertPathStore certPathStore) throws SignatureException { List<X509Certificate> retrievedCerts = certPathStore.getSignerInfo(signerInfo.getSignerId()).getCertificates(); assertEquals(signerInfo.getCertificates(), retrievedCerts); } }
/** * Checks whether for the given {@link SignerInfo} the certificates retrieved * from the {@link CertPathStore} match up. * * @param signerInfo the {@link SignerInfo} to get the certificates from the * {@link CertPathStore} for * @param certPathStore the {@link CertPathStore} to retrieve the certificates * from. */ private void checkCertificateExists(SignerInfo signerInfo, CertPathStore certPathStore) throws SignatureException { List<X509Certificate> retrievedCerts = certPathStore.getSignerInfo(signerInfo.getSignerId()).getCertificates(); assertEquals(signerInfo.getCertificates(), retrievedCerts); } }
public void testGetCertificates() throws Exception { signerInfo = new SignerInfo(HashAlgorithm.SHA256, certChain, DOMAIN); assertEquals(certChain, signerInfo.getCertificates()); }
public void testGetCertificates() throws Exception { signerInfo = new SignerInfo(HashAlgorithm.SHA256, certChain, DOMAIN); assertEquals(certChain, signerInfo.getCertificates()); }
X509Certificate cert = signer.getCertificates().get(0);