VPKCRequestData(Data data) throws DVCSConstructionException { super(data); TargetEtcChain[] certs = data.getCerts(); if (certs == null) { throw new DVCSConstructionException("DVCSRequest.data.certs should be specified for VPKC service"); } chains = new ArrayList(certs.length); for (int i = 0; i != certs.length; i++) { chains.add(new TargetChain(certs[i])); } }
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()); }
/** * Build DVCS request to VPKC service. * * @throws DVCSException */ public DVCSRequest build() throws DVCSException { Data data = new Data((TargetEtcChain[])chains.toArray(new TargetEtcChain[chains.size()])); return createDVCRequest(data); }
/** * Build DVCS request to VPKC service. * * @return a new DVCSRequest based on the state of this builder. * @throws DVCSException if an issue occurs during construction. */ public DVCSRequest build() throws DVCSException { Data data = new Data((TargetEtcChain[])chains.toArray(new TargetEtcChain[chains.size()])); return createDVCRequest(data); }
public TargetChain(TargetEtcChain certs) { this.certs = certs; }
public TargetEtcChain toASN1Structure() { return certs; }
/** * 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))); }