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

File KeyUsage.java

 

Coverage histogram

../../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
2
2
1
88
24
2
1
1
2
1

Classes

Class Line # Actions
KeyUsage 30 2 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 15 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.x509certificate.extension;
21   
22    import org.bouncycastle.asn1.x509.Extension;
23   
24    /**
25    * X.509 Certificates Key Usages.
26    *
27    * @version $Id: 0064a2e59b18f0d6a29726a8b0715de5cb4666f4 $
28    * @since 5.4
29    */
 
30    public enum KeyUsage
31    {
32    /**
33    * for SSL client certificates, S/MIME signing certificates, and object-signing certificates.
34    */
35    digitalSignature(1 << 7),
36    /**
37    * for some S/MIME signing certificates and object-signing certificates.
38    */
39    nonRepudiation(1 << 6),
40    /**
41    * or SSL server certificates and S/MIME encryption certificates.
42    */
43    keyEncipherment(1 << 5),
44    /**
45    * when the subject's public key is used to encrypt user data instead of key material.
46    */
47    dataEncipherment(1 << 4),
48    /**
49    * when the subject's public key is used for key agreement.
50    */
51    keyAgreement(1 << 3),
52    /**
53    * for all CA signing certificates.
54    */
55    keyCertSign(1 << 2),
56    /**
57    * for CA signing certificates that are used to sign CRLs.
58    */
59    cRLSign(1 << 1),
60    /**
61    * if the public key is used only for enciphering data. If this bit is set, keyAgreement should also be set.
62    */
63    encipherOnly(1),
64    /**
65    * if the public key is used only for deciphering data. If this bit is set, keyAgreement should also be set.
66    */
67    decipherOnly(1 << 15);
68   
69    /**
70    * OID of KeyUsage.
71    */
72    public static final String OID = Extension.keyUsage.getId();
73   
74    private int usage;
75   
 
76  9 toggle KeyUsage(int usage)
77    {
78  9 this.usage = usage;
79    }
80   
81    /**
82    * @return the integer value representing this usage.
83    */
 
84  255 toggle public int value()
85    {
86  255 return this.usage;
87    }
88    }