asn1.h
Go to the documentation of this file.
00001 /*
00002  * ASN.1 DER parsing
00003  * Copyright (c) 2006, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef ASN1_H
00016 #define ASN1_H
00017 
00018 #define ASN1_TAG_EOC            0x00 /* not used with DER */
00019 #define ASN1_TAG_BOOLEAN        0x01
00020 #define ASN1_TAG_INTEGER        0x02
00021 #define ASN1_TAG_BITSTRING      0x03
00022 #define ASN1_TAG_OCTETSTRING    0x04
00023 #define ASN1_TAG_NULL           0x05
00024 #define ASN1_TAG_OID            0x06
00025 #define ASN1_TAG_OBJECT_DESCRIPTOR      0x07 /* not yet parsed */
00026 #define ASN1_TAG_EXTERNAL       0x08 /* not yet parsed */
00027 #define ASN1_TAG_REAL           0x09 /* not yet parsed */
00028 #define ASN1_TAG_ENUMERATED     0x0A /* not yet parsed */
00029 #define ASN1_TAG_UTF8STRING     0x0C /* not yet parsed */
00030 #define ANS1_TAG_RELATIVE_OID   0x0D
00031 #define ASN1_TAG_SEQUENCE       0x10 /* shall be constructed */
00032 #define ASN1_TAG_SET            0x11
00033 #define ASN1_TAG_NUMERICSTRING  0x12 /* not yet parsed */
00034 #define ASN1_TAG_PRINTABLESTRING        0x13
00035 #define ASN1_TAG_TG1STRING      0x14 /* not yet parsed */
00036 #define ASN1_TAG_VIDEOTEXSTRING 0x15 /* not yet parsed */
00037 #define ASN1_TAG_IA5STRING      0x16
00038 #define ASN1_TAG_UTCTIME        0x17
00039 #define ASN1_TAG_GENERALIZEDTIME        0x18 /* not yet parsed */
00040 #define ASN1_TAG_GRAPHICSTRING  0x19 /* not yet parsed */
00041 #define ASN1_TAG_VISIBLESTRING  0x1A
00042 #define ASN1_TAG_GENERALSTRING  0x1B /* not yet parsed */
00043 #define ASN1_TAG_UNIVERSALSTRING        0x1C /* not yet parsed */
00044 #define ASN1_TAG_BMPSTRING      0x1D /* not yet parsed */
00045 
00046 #define ASN1_CLASS_UNIVERSAL            0
00047 #define ASN1_CLASS_APPLICATION          1
00048 #define ASN1_CLASS_CONTEXT_SPECIFIC     2
00049 #define ASN1_CLASS_PRIVATE              3
00050 
00051 
00052 struct asn1_hdr {
00053         const u8 *payload;
00054         u8 identifier, class, constructed;
00055         unsigned int tag, length;
00056 };
00057 
00058 #define ASN1_MAX_OID_LEN 20
00059 struct asn1_oid {
00060         unsigned long oid[ASN1_MAX_OID_LEN];
00061         size_t len;
00062 };
00063 
00064 
00065 int asn1_get_next(const u8 *buf, size_t len, struct asn1_hdr *hdr);
00066 int asn1_parse_oid(const u8 *buf, size_t len, struct asn1_oid *oid);
00067 int asn1_get_oid(const u8 *buf, size_t len, struct asn1_oid *oid,
00068                  const u8 **next);
00069 void asn1_oid_to_str(struct asn1_oid *oid, char *buf, size_t len);
00070 unsigned long asn1_bit_string_to_long(const u8 *buf, size_t len);
00071 
00072 #endif /* ASN1_H */


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:19