Home | History | Annotate | Download | only in asn1
      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 /**
     19 * @author Vladimir N. Molotkov
     20 * @version $Revision$
     21 */
     22 
     23 package org.apache.harmony.security.asn1;
     24 
     25 /**
     26  * ASN.1 and some other constants holder interface
     27  *
     28  * @see <a href="http://asn1.elibel.tm.fr/en/standards/index.htm">ASN.1</a>
     29  */
     30 public interface ASN1Constants {
     31     /**
     32      * Tag classes
     33      */
     34     int CLASS_UNIVERSAL = 0;
     35     int CLASS_APPLICATION = 64;
     36     int CLASS_CONTEXTSPECIFIC = 128;
     37     int CLASS_PRIVATE = 192;
     38 
     39     /**
     40      * Tag Primitive/Constructed (P/C) flag
     41      */
     42     int PC_PRIMITIVE = 0;
     43     int PC_CONSTRUCTED = 32;
     44 
     45     /**
     46      * Universal class tag assignments
     47      */
     48     int TAG_BOOLEAN = 1;
     49     int TAG_INTEGER = 2;
     50     int TAG_BITSTRING = 3;
     51     int TAG_OCTETSTRING = 4;
     52     int TAG_NULL = 5;
     53     int TAG_OID = 6;
     54     int TAG_OBJDESCRIPTOR = 7;
     55     int TAG_EXTERNAL = 8;
     56     int TAG_INSTANCEOF = TAG_EXTERNAL;
     57     int TAG_REAL = 9;
     58     int TAG_ENUM = 10;
     59     int TAG_EMBEDDEDPDV = 11;
     60     int TAG_UTF8STRING = 12;
     61     int TAG_RELATIVEOID = 13;
     62     int TAG_SEQUENCE = 16;
     63     int TAG_SEQUENCEOF = TAG_SEQUENCE;
     64     int TAG_SET = 17;
     65     int TAG_SETOF = TAG_SET;
     66     int TAG_NUMERICSTRING = 18;
     67     int TAG_PRINTABLESTRING = 19;
     68     int TAG_TELETEXSTRING = 20;
     69     int TAG_T61STRING = TAG_TELETEXSTRING;
     70     int TAG_VIDEOTEXSTRING = 21;
     71     int TAG_IA5STRING = 22;
     72     int TAG_UTCTIME = 23;
     73     int TAG_GENERALIZEDTIME = 24;
     74     int TAG_GRAPHICSTRING = 25;
     75     int TAG_VISIBLESTRING = 26;
     76     int TAG_ISO646STRING = TAG_VISIBLESTRING;
     77     int TAG_GENERALSTRING = 27;
     78     int TAG_UNIVERSALSTRING = 28;
     79     int TAG_BMPSTRING = 30;
     80 
     81     int TAG_C_BITSTRING = TAG_BITSTRING | PC_CONSTRUCTED;
     82     int TAG_C_OCTETSTRING = TAG_OCTETSTRING | PC_CONSTRUCTED;
     83     int TAG_C_UTF8STRING = TAG_UTF8STRING | PC_CONSTRUCTED;
     84     int TAG_C_SEQUENCE = TAG_SEQUENCE | PC_CONSTRUCTED;
     85     int TAG_C_SEQUENCEOF = TAG_SEQUENCEOF | PC_CONSTRUCTED;
     86     int TAG_C_SET = TAG_SET | PC_CONSTRUCTED;
     87     int TAG_C_SETOF = TAG_SETOF | PC_CONSTRUCTED;
     88     int TAG_C_UTCTIME = TAG_UTCTIME | PC_CONSTRUCTED;
     89     int TAG_C_GENERALIZEDTIME = TAG_GENERALIZEDTIME | PC_CONSTRUCTED;
     90 
     91     /**
     92      * Not from the ASN.1 specs. For implementation purposes.
     93      */
     94     int TAG_ANY = 0;
     95     int TAG_CHOICE = TAG_ANY;
     96 }
     97