1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.crypto.signer.param

File CMSSignedDataGeneratorParameters.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
15
9
1
138
53
9
0.6
1.67
9
1

Classes

Class Line # Actions
CMSSignedDataGeneratorParameters 35 15 0% 9 6
0.7575%
 

Contributing tests

This file is covered by 7 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package org.xwiki.crypto.signer.param;
22   
23    import java.util.ArrayList;
24    import java.util.Collection;
25   
26    import org.xwiki.crypto.pkix.CertifyingSigner;
27    import org.xwiki.crypto.pkix.params.CertifiedPublicKey;
28   
29    /**
30    * Parameters for the generation of SignedData.
31    *
32    * @version $Id: 13b350296a0b2871720af1587e9c67d0a292fada $
33    * @since 6.0M1
34    */
 
35    public class CMSSignedDataGeneratorParameters
36    {
37    private Collection<CMSSignerInfo> signatures = new ArrayList<CMSSignerInfo>();
38   
39    private Collection<CertifyingSigner> signers = new ArrayList<CertifyingSigner>();
40   
41    private Collection<CertifiedPublicKey> certificates = new ArrayList<CertifiedPublicKey>();
42   
43    /**
44    * Add existing signature.
45    *
46    * @param signer a signer info containing an already calculated signature for the targeted data.
47    * @return this object for call chaining.
48    */
 
49  2 toggle public CMSSignedDataGeneratorParameters addSignature(CMSSignerInfo signer)
50    {
51  2 this.signatures.add(signer);
52  2 return this;
53    }
54   
55    /**
56    * Add a new signer.
57    *
58    * @param signer a certifying signer to be used to sign the content data.
59    * @return this object for call chaining.
60    */
 
61  7 toggle public CMSSignedDataGeneratorParameters addSigner(CertifyingSigner signer)
62    {
63  7 this.signers.add(signer);
64  7 return this;
65    }
66   
67    /**
68    * Add a collection of existing signatures.
69    *
70    * @param signers a collection of signer info containing an already calculated signature for the targeted data.
71    * @return this object for call chaining.
72    */
 
73  0 toggle public CMSSignedDataGeneratorParameters addSignatures(Collection<CMSSignerInfo> signers)
74    {
75  0 this.signatures.addAll(signers);
76  0 return this;
77    }
78   
79    /**
80    * Add a collection of new signers.
81    *
82    * @param signers a collection of certifying signer to be used to sign the content data.
83    * @return this object for call chaining.
84    */
 
85  0 toggle public CMSSignedDataGeneratorParameters addSigners(Collection<CertifyingSigner> signers)
86    {
87  0 this.signers.addAll(signers);
88  0 return this;
89    }
90   
91    /**
92    * Add a certificate.
93    *
94    * @param certificate a certificate.
95    * @return this object for call chaining.
96    */
 
97  7 toggle public CMSSignedDataGeneratorParameters addCertificate(CertifiedPublicKey certificate)
98    {
99  7 this.certificates.add(certificate);
100  7 return this;
101    }
102   
103    /**
104    * Add a collection of certificates.
105    *
106    * @param certificates a collection of certificates to be joined with the signed data.
107    * @return this object for call chaining.
108    */
 
109  1 toggle public CMSSignedDataGeneratorParameters addCertificates(Collection<CertifiedPublicKey> certificates)
110    {
111  1 this.certificates.addAll(certificates);
112  1 return this;
113    }
114   
115    /**
116    * @return the aggregated collection of certificates to be joined with the signed data.
117    */
 
118  9 toggle public Collection<CertifiedPublicKey> getCertificates()
119    {
120  9 return this.certificates;
121    }
122   
123    /**
124    * @return the aggregated collection of signer info containing an already calculated signature.
125    */
 
126  13 toggle public Collection<CMSSignerInfo> getSignatures()
127    {
128  13 return this.signatures;
129    }
130   
131    /**
132    * @return the aggregated collection of certifying signer to be used to sign the content data.
133    */
 
134  9 toggle public Collection<CertifyingSigner> getSigners()
135    {
136  9 return this.signers;
137    }
138    }