001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.asn1.ber.tlv; 021 022 023/** 024 * Enum for ASN.1 UNIVERSAL class tags. The tags values are constructed using 025 * the SNACC representation for tags without the primitive/constructed bit. This 026 * is done because several bit, octet and character string types can be encoded 027 * as primitives or as constructed types to chunk the value out. 028 * <p> 029 * These tags can have one of the following values: 030 * </p> 031 * <table border="1" cellspacing="1" width="60%" summary="ASN.1 tags"> 032 * <tr> 033 * <th>Id</th> 034 * <th>Usage</th> 035 * </tr> 036 * <tr> 037 * <td>[UNIVERSAL 0]</td> 038 * <td>reserved for BER</td> 039 * </tr> 040 * <tr> 041 * <td>[UNIVERSAL 1]</td> 042 * <td>BOOLEAN</td> 043 * </tr> 044 * <tr> 045 * <td>[UNIVERSAL 2]</td> 046 * <td>INTEGER</td> 047 * </tr> 048 * <tr> 049 * <td>[UNIVERSAL 3]</td> 050 * <td>BIT STRING</td> 051 * </tr> 052 * <tr> 053 * <td>[UNIVERSAL 4]</td> 054 * <td>OCTET STRING</td> 055 * </tr> 056 * <tr> 057 * <td>[UNIVERSAL 5]</td> 058 * <td>NULL</td> 059 * </tr> 060 * <tr> 061 * <td>[UNIVERSAL 6]</td> 062 * <td>OBJECT IDENTIFIER</td> 063 * </tr> 064 * <tr> 065 * <td>[UNIVERSAL 7]</td> 066 * <td>ObjectDescriptor</td> 067 * </tr> 068 * <tr> 069 * <td>[UNIVERSAL 8]</td> 070 * <td>EXTERNAL, INSTANCE OF</td> 071 * </tr> 072 * <tr> 073 * <td>[UNIVERSAL 9]</td> 074 * <td>REAL</td> 075 * </tr> 076 * <tr> 077 * <td>[UNIVERSAL 10]</td> 078 * <td>ENUMERATED</td> 079 * </tr> 080 * <tr> 081 * <td>[UNIVERSAL 11]</td> 082 * <td>EMBEDDED PDV</td> 083 * </tr> 084 * <tr> 085 * <td>[UNIVERSAL 12]</td> 086 * <td>UTF8String</td> 087 * </tr> 088 * <tr> 089 * <td>[UNIVERSAL 13]</td> 090 * <td>RELATIVE-OID</td> 091 * </tr> 092 * <tr> 093 * <td>[UNIVERSAL 14]</td> 094 * <td>reserved for future use</td> 095 * </tr> 096 * <tr> 097 * <td>[UNIVERSAL 15]</td> 098 * <td>reserved for future use</td> 099 * </tr> 100 * <tr> 101 * <td>[UNIVERSAL 16]</td> 102 * <td>SEQUENCE, SEQUENCE OF</td> 103 * </tr> 104 * <tr> 105 * <td>[UNIVERSAL 17]</td> 106 * <td>SET, SET OF</td> 107 * </tr> 108 * <tr> 109 * <td>[UNIVERSAL 18]</td> 110 * <td>NumericString</td> 111 * </tr> 112 * <tr> 113 * <td>[UNIVERSAL 19]</td> 114 * <td>PrintableString</td> 115 * </tr> 116 * <tr> 117 * <td>[UNIVERSAL 20]</td> 118 * <td>TeletexString, T61String</td> 119 * </tr> 120 * <tr> 121 * <td>[UNIVERSAL 21]</td> 122 * <td>VideotexString</td> 123 * </tr> 124 * <tr> 125 * <td>[UNIVERSAL 22]</td> 126 * <td>IA5String</td> 127 * </tr> 128 * <tr> 129 * <td>[UNIVERSAL 23]</td> 130 * <td>UTCTime</td> 131 * </tr> 132 * <tr> 133 * <td>[UNIVERSAL 24]</td> 134 * <td>GeneralizedTime</td> 135 * </tr> 136 * <tr> 137 * <td>[UNIVERSAL 25]</td> 138 * <td>GraphicString</td> 139 * </tr> 140 * <tr> 141 * <td>[UNIVERSAL 26]</td> 142 * <td>VisibleString, ISO646String</td> 143 * </tr> 144 * <tr> 145 * <td>[UNIVERSAL 27]</td> 146 * <td>GeneralString</td> 147 * </tr> 148 * <tr> 149 * <td>[UNIVERSAL 28]</td> 150 * <td>UniversalString</td> 151 * </tr> 152 * <tr> 153 * <td>[UNIVERSAL 29]</td> 154 * <td>CHARACTER STRING</td> 155 * </tr> 156 * <tr> 157 * <td>[UNIVERSAL 30]</td> 158 * <td>BMPString</td> 159 * </tr> 160 * <tr> 161 * <td>[UNIVERSAL 31]</td> 162 * <td>reserved for future use</td> 163 * </tr> 164 * </table> 165 * 166 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 167 */ 168public enum UniversalTag 169{ 170 /** value for the tag */ 171 RESERVED_0(( byte ) 0), 172 173 /** value for the tag */ 174 BOOLEAN(( byte ) 1), 175 176 /** value for the tag */ 177 INTEGER(( byte ) 2), 178 179 /** value for the tag */ 180 BIT_STRING(( byte ) 3), 181 182 /** value for the tag */ 183 OCTET_STRING(( byte ) 4), 184 185 /** value for the tag */ 186 NULL(( byte ) 5), 187 188 /** value for the tag */ 189 OBJECT_IDENTIFIER(( byte ) 6), 190 191 /** value for the tag */ 192 OBJECT_DESCRIPTOR(( byte ) 7), 193 194 /** value for the tag */ 195 EXTERNAL_INSTANCE_OF(( byte ) 8), 196 197 /** value for the tag */ 198 REAL(( byte ) 9), 199 200 /** value for the tag */ 201 ENUMERATED(( byte ) 0x0A), 202 203 /** value for the tag */ 204 EMBEDDED_PDV(( byte ) 0x0B), 205 206 /** value for the tag */ 207 UTF8_STRING(( byte ) 0x0C), 208 209 /** value for the tag */ 210 RELATIVE_OID(( byte ) 0x0D), 211 212 /** value for the tag */ 213 RESERVED_14(( byte ) 0x0E), 214 215 /** value for the tag */ 216 RESERVED_15(( byte ) 0x0F), 217 218 /** value for the tag */ 219 SEQUENCE_SEQUENCE_OF(( byte ) 0x10), 220 221 /** value for the tag */ 222 SET_SET_OF(( byte ) 0x11), 223 224 /** value for the tag */ 225 NUMERIC_STRING(( byte ) 0x12), 226 227 /** value for the tag */ 228 PRINTABLE_STRING(( byte ) 0x13), 229 230 /** value for the tag */ 231 TELETEX_STRING(( byte ) 0x14), 232 233 /** value for the tag */ 234 VIDEOTEX_STRING(( byte ) 0x15), 235 236 /** value for the tag */ 237 IA5_STRING(( byte ) 0x16), 238 239 /** value for the tag */ 240 UTC_TIME(( byte ) 0x17), 241 242 /** value for the tag */ 243 GENERALIZED_TIME(( byte ) 0x18), 244 245 /** value for the tag */ 246 GRAPHIC_STRING(( byte ) 0x19), 247 248 /** value for the tag */ 249 VISIBLE_STRING(( byte ) 0x1A), 250 251 /** value for the tag */ 252 GENERAL_STRING(( byte ) 0x1B), 253 254 /** value for the tag */ 255 UNIVERSAL_STRING(( byte ) 0x1C), 256 257 /** value for the tag */ 258 CHARACTER_STRING(( byte ) 0x1D), 259 260 /** value for the tag */ 261 BMP_STRING(( byte ) 0x1E), 262 263 /** value for the tag */ 264 RESERVED_31(( byte ) 0x1F), 265 266 /** SEQUENCE TAG */ 267 SEQUENCE(( byte ) 0x30), 268 269 /** SET TAG */ 270 SET(( byte ) 0x31); 271 272 /** The internal value */ 273 private byte value; 274 275 276 /** 277 * Creates a new instance of UniversalTag. 278 * 279 * @param value The tag value 280 */ 281 UniversalTag( byte value ) 282 { 283 this.value = value; 284 } 285 286 287 /** 288 * @return The UniversalTag value 289 */ 290 public byte getValue() 291 { 292 return value; 293 } 294}