1 package org.bouncycastle.dvcs;
2 
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.List;
6 
7 import org.bouncycastle.asn1.dvcs.Data;
8 import org.bouncycastle.asn1.dvcs.TargetEtcChain;
9 
10 /**
11  * Data piece of DVCS request to VPKC service (Verify Public Key Certificates).
12  * It contains VPKC-specific interface.
13  * <p>
14  * This objects are constructed internally,
15  * to build DVCS request to VPKC service use VPKCRequestBuilder.
16  * </p>
17  */
18 public class VPKCRequestData
19     extends DVCSRequestData
20 {
21     private List chains;
22 
VPKCRequestData(Data data)23     VPKCRequestData(Data data)
24         throws DVCSConstructionException
25     {
26         super(data);
27 
28         TargetEtcChain[] certs = data.getCerts();
29 
30         if (certs == null)
31         {
32             throw new DVCSConstructionException("DVCSRequest.data.certs should be specified for VPKC service");
33         }
34 
35         chains = new ArrayList(certs.length);
36 
37         for (int i = 0; i != certs.length; i++)
38         {
39             chains.add(new TargetChain(certs[i]));
40         }
41     }
42 
43     /**
44      * Get contained certs choice data..
45      *
46      * @return a list of CertChain objects.
47      */
getCerts()48     public List getCerts()
49     {
50         return Collections.unmodifiableList(chains);
51     }
52 }
53