01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.crypto.asn1.misc;
17:
18: import org.apache.geronimo.crypto.asn1.*;
19:
20: /**
21: * The NetscapeCertType object.
22: * <pre>
23: * NetscapeCertType ::= BIT STRING {
24: * SSLClient (0),
25: * SSLServer (1),
26: * S/MIME (2),
27: * Object Signing (3),
28: * Reserved (4),
29: * SSL CA (5),
30: * S/MIME CA (6),
31: * Object Signing CA (7) }
32: * </pre>
33: */
34: public class NetscapeCertType extends DERBitString {
35: public static final int sslClient = (1 << 7);
36: public static final int sslServer = (1 << 6);
37: public static final int smime = (1 << 5);
38: public static final int objectSigning = (1 << 4);
39: public static final int reserved = (1 << 3);
40: public static final int sslCA = (1 << 2);
41: public static final int smimeCA = (1 << 1);
42: public static final int objectSigningCA = (1 << 0);
43:
44: /**
45: * Basic constructor.
46: *
47: * @param usage - the bitwise OR of the Key Usage flags giving the
48: * allowed uses for the key.
49: * e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
50: */
51: public NetscapeCertType(int usage) {
52: super (getBytes(usage), getPadBits(usage));
53: }
54:
55: public NetscapeCertType(DERBitString usage) {
56: super (usage.getBytes(), usage.getPadBits());
57: }
58:
59: public String toString() {
60: return "NetscapeCertType: 0x"
61: + Integer.toHexString(data[0] & 0xff);
62: }
63: }
|