1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.api.asn1.ber.tlv; 21 22 23 /** 24 * Enum for ASN.1 UNIVERSAL class tags. The tags values are constructed using 25 * the SNACC representation for tags without the primitive/constructed bit. This 26 * is done because several bit, octet and character string types can be encoded 27 * as primitives or as constructed types to chunk the value out. 28 * <p> 29 * These tags can have one of the following values: 30 * </p> 31 * <table border="1" cellspacing="1" width="60%" summary="ASN.1 tags"> 32 * <tr> 33 * <th>Id</th> 34 * <th>Usage</th> 35 * </tr> 36 * <tr> 37 * <td>[UNIVERSAL 0]</td> 38 * <td>reserved for BER</td> 39 * </tr> 40 * <tr> 41 * <td>[UNIVERSAL 1]</td> 42 * <td>BOOLEAN</td> 43 * </tr> 44 * <tr> 45 * <td>[UNIVERSAL 2]</td> 46 * <td>INTEGER</td> 47 * </tr> 48 * <tr> 49 * <td>[UNIVERSAL 3]</td> 50 * <td>BIT STRING</td> 51 * </tr> 52 * <tr> 53 * <td>[UNIVERSAL 4]</td> 54 * <td>OCTET STRING</td> 55 * </tr> 56 * <tr> 57 * <td>[UNIVERSAL 5]</td> 58 * <td>NULL</td> 59 * </tr> 60 * <tr> 61 * <td>[UNIVERSAL 6]</td> 62 * <td>OBJECT IDENTIFIER</td> 63 * </tr> 64 * <tr> 65 * <td>[UNIVERSAL 7]</td> 66 * <td>ObjectDescriptor</td> 67 * </tr> 68 * <tr> 69 * <td>[UNIVERSAL 8]</td> 70 * <td>EXTERNAL, INSTANCE OF</td> 71 * </tr> 72 * <tr> 73 * <td>[UNIVERSAL 9]</td> 74 * <td>REAL</td> 75 * </tr> 76 * <tr> 77 * <td>[UNIVERSAL 10]</td> 78 * <td>ENUMERATED</td> 79 * </tr> 80 * <tr> 81 * <td>[UNIVERSAL 11]</td> 82 * <td>EMBEDDED PDV</td> 83 * </tr> 84 * <tr> 85 * <td>[UNIVERSAL 12]</td> 86 * <td>UTF8String</td> 87 * </tr> 88 * <tr> 89 * <td>[UNIVERSAL 13]</td> 90 * <td>RELATIVE-OID</td> 91 * </tr> 92 * <tr> 93 * <td>[UNIVERSAL 14]</td> 94 * <td>reserved for future use</td> 95 * </tr> 96 * <tr> 97 * <td>[UNIVERSAL 15]</td> 98 * <td>reserved for future use</td> 99 * </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 */ 168 public 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 }