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

File CertifiedKeyPair.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart7.png
64% of files have more coverage

Code metrics

0
6
5
1
81
30
5
0.83
1.2
5
1

Classes

Class Line # Actions
CertifiedKeyPair 32 6 0% 5 4
0.636363663.6%
 

Contributing tests

This file is covered by 30 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    package org.xwiki.crypto.pkix.params;
21   
22    import org.xwiki.crypto.params.cipher.asymmetric.AsymmetricKeyPair;
23    import org.xwiki.crypto.params.cipher.asymmetric.PrivateKeyParameters;
24    import org.xwiki.crypto.params.cipher.asymmetric.PublicKeyParameters;
25   
26    /**
27    * A certified key pair.
28    *
29    * @version $Id: 803b48f223826b3775f53b134177dd77a78cb7d3 $
30    * @since 5.4
31    */
 
32    public class CertifiedKeyPair
33    {
34    private final PrivateKeyParameters privateKey;
35   
36    private final CertifiedPublicKey certificate;
37   
38    /**
39    * Create a new certified key pair, associating a certificate and a private key.
40    *
41    * @param privateKey the private key.
42    * @param certificate the certificate.
43    */
 
44  47 toggle public CertifiedKeyPair(PrivateKeyParameters privateKey, CertifiedPublicKey certificate)
45    {
46  47 this.privateKey = privateKey;
47  47 this.certificate = certificate;
48    }
49   
50    /**
51    * @return the certificate.
52    */
 
53  31 toggle public CertifiedPublicKey getCertificate()
54    {
55  31 return this.certificate;
56    }
57   
58    /**
59    * @return the public key parameters.
60    */
 
61  0 toggle public PublicKeyParameters getPublicKey()
62    {
63  0 return this.certificate.getPublicKeyParameters();
64    }
65   
66    /**
67    * @return the public key parameters.
68    */
 
69  31 toggle public PrivateKeyParameters getPrivateKey()
70    {
71  31 return this.privateKey;
72    }
73   
74    /**
75    * @return a simple key pair.
76    */
 
77  0 toggle public AsymmetricKeyPair getKeyPair()
78    {
79  0 return new AsymmetricKeyPair(getPrivateKey(), getPublicKey());
80    }
81    }