David Howells | 4520c6a | 2012-09-21 23:31:13 +0100 | [diff] [blame] | 1 | /* ASN.1 BER/DER/CER encoding definitions |
| 2 | * |
| 3 | * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _LINUX_ASN1_H |
| 13 | #define _LINUX_ASN1_H |
| 14 | |
| 15 | /* Class */ |
| 16 | enum asn1_class { |
| 17 | ASN1_UNIV = 0, /* Universal */ |
| 18 | ASN1_APPL = 1, /* Application */ |
| 19 | ASN1_CONT = 2, /* Context */ |
| 20 | ASN1_PRIV = 3 /* Private */ |
| 21 | }; |
| 22 | #define ASN1_CLASS_BITS 0xc0 |
| 23 | |
| 24 | |
| 25 | enum asn1_method { |
| 26 | ASN1_PRIM = 0, /* Primitive */ |
| 27 | ASN1_CONS = 1 /* Constructed */ |
| 28 | }; |
| 29 | #define ASN1_CONS_BIT 0x20 |
| 30 | |
| 31 | /* Tag */ |
| 32 | enum asn1_tag { |
| 33 | ASN1_EOC = 0, /* End Of Contents or N/A */ |
| 34 | ASN1_BOOL = 1, /* Boolean */ |
| 35 | ASN1_INT = 2, /* Integer */ |
| 36 | ASN1_BTS = 3, /* Bit String */ |
| 37 | ASN1_OTS = 4, /* Octet String */ |
| 38 | ASN1_NULL = 5, /* Null */ |
| 39 | ASN1_OID = 6, /* Object Identifier */ |
| 40 | ASN1_ODE = 7, /* Object Description */ |
| 41 | ASN1_EXT = 8, /* External */ |
| 42 | ASN1_REAL = 9, /* Real float */ |
| 43 | ASN1_ENUM = 10, /* Enumerated */ |
| 44 | ASN1_EPDV = 11, /* Embedded PDV */ |
| 45 | ASN1_UTF8STR = 12, /* UTF8 String */ |
| 46 | ASN1_RELOID = 13, /* Relative OID */ |
| 47 | /* 14 - Reserved */ |
| 48 | /* 15 - Reserved */ |
| 49 | ASN1_SEQ = 16, /* Sequence and Sequence of */ |
| 50 | ASN1_SET = 17, /* Set and Set of */ |
| 51 | ASN1_NUMSTR = 18, /* Numerical String */ |
| 52 | ASN1_PRNSTR = 19, /* Printable String */ |
| 53 | ASN1_TEXSTR = 20, /* T61 String / Teletext String */ |
| 54 | ASN1_VIDSTR = 21, /* Videotex String */ |
| 55 | ASN1_IA5STR = 22, /* IA5 String */ |
| 56 | ASN1_UNITIM = 23, /* Universal Time */ |
| 57 | ASN1_GENTIM = 24, /* General Time */ |
| 58 | ASN1_GRASTR = 25, /* Graphic String */ |
| 59 | ASN1_VISSTR = 26, /* Visible String */ |
| 60 | ASN1_GENSTR = 27, /* General String */ |
| 61 | ASN1_UNISTR = 28, /* Universal String */ |
| 62 | ASN1_CHRSTR = 29, /* Character String */ |
| 63 | ASN1_BMPSTR = 30, /* BMP String */ |
| 64 | ASN1_LONG_TAG = 31 /* Long form tag */ |
| 65 | }; |
| 66 | |
David Howells | facc0a6 | 2012-12-05 11:55:28 +1030 | [diff] [blame] | 67 | #define ASN1_INDEFINITE_LENGTH 0x80 |
| 68 | |
David Howells | 4520c6a | 2012-09-21 23:31:13 +0100 | [diff] [blame] | 69 | #endif /* _LINUX_ASN1_H */ |