01: package org.bouncycastle.asn1.misc;
02:
03: import org.bouncycastle.asn1.*;
04:
05: /**
06: * The NetscapeCertType object.
07: * <pre>
08: * NetscapeCertType ::= BIT STRING {
09: * SSLClient (0),
10: * SSLServer (1),
11: * S/MIME (2),
12: * Object Signing (3),
13: * Reserved (4),
14: * SSL CA (5),
15: * S/MIME CA (6),
16: * Object Signing CA (7) }
17: * </pre>
18: */
19: public class NetscapeCertType extends DERBitString {
20: public static final int sslClient = (1 << 7);
21: public static final int sslServer = (1 << 6);
22: public static final int smime = (1 << 5);
23: public static final int objectSigning = (1 << 4);
24: public static final int reserved = (1 << 3);
25: public static final int sslCA = (1 << 2);
26: public static final int smimeCA = (1 << 1);
27: public static final int objectSigningCA = (1 << 0);
28:
29: /**
30: * Basic constructor.
31: *
32: * @param usage - the bitwise OR of the Key Usage flags giving the
33: * allowed uses for the key.
34: * e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
35: */
36: public NetscapeCertType(int usage) {
37: super (getBytes(usage), getPadBits(usage));
38: }
39:
40: public NetscapeCertType(DERBitString usage) {
41: super (usage.getBytes(), usage.getPadBits());
42: }
43:
44: public String toString() {
45: return "NetscapeCertType: 0x"
46: + Integer.toHexString(data[0] & 0xff);
47: }
48: }
|