1 package org.bouncycastle.asn1.x509;
2
3 import org.bouncycastle.asn1.*;
4
5
21 public class KeyUsage
22 extends DERBitString
23 {
24 public static final int digitalSignature = (1 << 7);
25 public static final int nonRepudiation = (1 << 6);
26 public static final int keyEncipherment = (1 << 5);
27 public static final int dataEncipherment = (1 << 4);
28 public static final int keyAgreement = (1 << 3);
29 public static final int keyCertSign = (1 << 2);
30 public static final int cRLSign = (1 << 1);
31 public static final int encipherOnly = (1 << 0);
32 public static final int decipherOnly = (1 << 15);
33
34
41 public KeyUsage(
42 int usage)
43 {
44 super(getBytes(usage), getPadBits(usage));
45 }
46
47 public KeyUsage(
48 DERBitString usage)
49 {
50 super(usage.getBytes(), usage.getPadBits());
51 }
52
53 public String toString()
54 {
55 return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff);
56 }
57 }
58