1 package org.bouncycastle.asn1.x509;
3 import org.bouncycastle.asn1.*;
7 * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
9 * KeyUsage ::= BIT STRING {
10 * digitalSignature (0),
12 * keyEncipherment (2),
13 * dataEncipherment (3),
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);
37 * @param usage - the bitwise OR of the Key Usage flags giving the
38 * allowed uses for the key.
39 * e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment)
44 super(getBytes(usage), getPadBits(usage));
50 super(usage.getBytes(), usage.getPadBits());
53 public String toString()
55 return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff);