Home » geronimo-2.2-source-release » org.apache.geronimo.crypto.asn1.misc » [javadoc | source]

    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     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    */
   17   
   18   package org.apache.geronimo.crypto.asn1.misc;
   19   
   20   import org.apache.geronimo.crypto.asn1;
   21   
   22   /**
   23    * The NetscapeCertType object.
   24    * <pre>
   25    *    NetscapeCertType ::= BIT STRING {
   26    *         SSLClient               (0),
   27    *         SSLServer               (1),
   28    *         S/MIME                  (2),
   29    *         Object Signing          (3),
   30    *         Reserved                (4),
   31    *         SSL CA                  (5),
   32    *         S/MIME CA               (6),
   33    *         Object Signing CA       (7) }
   34    * </pre>
   35    */
   36   public class NetscapeCertType
   37       extends DERBitString
   38   {
   39       public static final int        sslClient        = (1 << 7);
   40       public static final int        sslServer        = (1 << 6);
   41       public static final int        smime            = (1 << 5);
   42       public static final int        objectSigning    = (1 << 4);
   43       public static final int        reserved         = (1 << 3);
   44       public static final int        sslCA            = (1 << 2);
   45       public static final int        smimeCA          = (1 << 1);
   46       public static final int        objectSigningCA  = (1 << 0);
   47   
   48       /**
   49        * Basic constructor.
   50        *
   51        * @param usage - the bitwise OR of the Key Usage flags giving the
   52        * allowed uses for the key.
   53        * e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
   54        */
   55       public NetscapeCertType(
   56           int usage)
   57       {
   58           super(getBytes(usage), getPadBits(usage));
   59       }
   60   
   61       public NetscapeCertType(
   62           DERBitString usage)
   63       {
   64           super(usage.getBytes(), usage.getPadBits());
   65       }
   66   
   67       public String toString()
   68       {
   69           return "NetscapeCertType: 0x" + Integer.toHexString(data[0] & 0xff);
   70       }
   71   }

Home » geronimo-2.2-source-release » org.apache.geronimo.crypto.asn1.misc » [javadoc | source]