/*1* Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8*9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11*12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* 3. Neither the name of the Institute nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233/* $Id$ */3435#ifndef __DER_H__36#define __DER_H__3738typedef enum {39ASN1_C_UNIV = 0,40ASN1_C_APPL = 1,41ASN1_C_CONTEXT = 2,42ASN1_C_PRIVATE = 343} Der_class;4445typedef enum {PRIM = 0, CONS = 1} Der_type;4647#define MAKE_TAG(CLASS, TYPE, TAG) (((CLASS) << 6) | ((TYPE) << 5) | (TAG))4849/* Universal tags */5051enum {52UT_EndOfContent = 0,53UT_Boolean = 1,54UT_Integer = 2,55UT_BitString = 3,56UT_OctetString = 4,57UT_Null = 5,58UT_OID = 6,59UT_Enumerated = 10,60UT_UTF8String = 12,61UT_Sequence = 16,62UT_Set = 17,63UT_PrintableString = 19,64UT_IA5String = 22,65UT_UTCTime = 23,66UT_GeneralizedTime = 24,67UT_UniversalString = 25,68UT_VisibleString = 26,69UT_GeneralString = 27,70UT_BMPString = 30,71/* unsupported types */72UT_ObjectDescriptor = 7,73UT_External = 8,74UT_Real = 9,75UT_EmbeddedPDV = 11,76UT_RelativeOID = 13,77UT_NumericString = 18,78UT_TeletexString = 20,79UT_VideotexString = 21,80UT_GraphicString = 2581};8283#define ASN1_INDEFINITE 0xdce0deed8485typedef struct heim_der_time_t {86time_t dt_sec;87unsigned long dt_nsec;88} heim_der_time_t;8990typedef struct heim_ber_time_t {91time_t bt_sec;92unsigned bt_nsec;93int bt_zone;94} heim_ber_time_t;9596struct asn1_template;9798#include <der-protos.h>99100int _heim_fix_dce(size_t reallen, size_t *len);101int _heim_der_set_sort(const void *, const void *);102int _heim_time2generalizedtime (time_t, heim_octet_string *, int);103104#endif /* __DER_H__ */105106107