public void testVPKCRequest() throws Exception { SignedDVCSMessageGenerator gen = getSignedDVCSMessageGenerator(); VPKCRequestBuilder reqBuilder = new VPKCRequestBuilder(); reqBuilder.addTargetChain(new JcaX509CertificateHolder(signCert)); CMSSignedData reqMsg = gen.build(reqBuilder.build()); assertTrue(reqMsg.verifySignatures(new SignerInformationVerifierProvider() { public SignerInformationVerifier get(SignerId sid) throws OperatorCreationException { return new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(signCert); } })); DVCSRequest request = new DVCSRequest(reqMsg); VPKCRequestData reqData = (VPKCRequestData)request.getData(); assertEquals(new TargetEtcChain(new CertEtcToken(CertEtcToken.TAG_CERTIFICATE, new JcaX509CertificateHolder(signCert).toASN1Structure())), ((TargetChain)reqData.getCerts().get(0)).toASN1Structure()); }
/** * Adds a TargetChain representing a X.509 certificate to the request. * * @param cert the certificate to be added */ public void addTargetChain(X509CertificateHolder cert) { chains.add(new TargetEtcChain(new CertEtcToken(CertEtcToken.TAG_CERTIFICATE, cert.toASN1Structure()))); }
/** * Adds a TargetChain representing a single X.509 Extension to the request * * @param extension the extension to be added. */ public void addTargetChain(Extension extension) { chains.add(new TargetEtcChain(new CertEtcToken(extension))); }