1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.DERBitString; 21 22 39 public class KeyUsage 40 extends DERBitString 41 { 42 public static final int digitalSignature = (1 << 7); 43 public static final int nonRepudiation = (1 << 6); 44 public static final int keyEncipherment = (1 << 5); 45 public static final int dataEncipherment = (1 << 4); 46 public static final int keyAgreement = (1 << 3); 47 public static final int keyCertSign = (1 << 2); 48 public static final int cRLSign = (1 << 1); 49 public static final int encipherOnly = (1 << 0); 50 public static final int decipherOnly = (1 << 15); 51 52 59 public KeyUsage( 60 int usage) 61 { 62 super(getBytes(usage), getPadBits(usage)); 63 } 64 65 public KeyUsage( 66 DERBitString usage) 67 { 68 super(usage.getBytes(), usage.getPadBits()); 69 } 70 71 public String toString() 72 { 73 if (data.length == 1) 74 { 75 return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff); 76 } 77 return "KeyUsage: 0x" + Integer.toHexString((data[1] & 0xff) << 8 | (data[0] & 0xff)); 78 } 79 } 80 | Popular Tags |