der.h revision 178825
155682Smarkm/* 2178825Sdfr * Copyright (c) 1997 - 2006 Kungliga Tekniska H�gskolan 355682Smarkm * (Royal Institute of Technology, Stockholm, Sweden). 455682Smarkm * All rights reserved. 555682Smarkm * 655682Smarkm * Redistribution and use in source and binary forms, with or without 755682Smarkm * modification, are permitted provided that the following conditions 855682Smarkm * are met: 955682Smarkm * 1055682Smarkm * 1. Redistributions of source code must retain the above copyright 1155682Smarkm * notice, this list of conditions and the following disclaimer. 1255682Smarkm * 1355682Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1455682Smarkm * notice, this list of conditions and the following disclaimer in the 1555682Smarkm * documentation and/or other materials provided with the distribution. 1655682Smarkm * 1755682Smarkm * 3. Neither the name of the Institute nor the names of its contributors 1855682Smarkm * may be used to endorse or promote products derived from this software 1955682Smarkm * without specific prior written permission. 2055682Smarkm * 2155682Smarkm * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 2255682Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2355682Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2455682Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 2555682Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2655682Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2755682Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2855682Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2955682Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3055682Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3155682Smarkm * SUCH DAMAGE. 3255682Smarkm */ 3355682Smarkm 34178825Sdfr/* $Id: der.h 18437 2006-10-14 05:16:08Z lha $ */ 3555682Smarkm 3655682Smarkm#ifndef __DER_H__ 3755682Smarkm#define __DER_H__ 3855682Smarkm 39178825Sdfrtypedef enum { 40178825Sdfr ASN1_C_UNIV = 0, 41178825Sdfr ASN1_C_APPL = 1, 42178825Sdfr ASN1_C_CONTEXT = 2, 43178825Sdfr ASN1_C_PRIVATE = 3 44178825Sdfr} Der_class; 4555682Smarkm 4655682Smarkmtypedef enum {PRIM = 0, CONS = 1} Der_type; 4755682Smarkm 48178825Sdfr#define MAKE_TAG(CLASS, TYPE, TAG) (((CLASS) << 6) | ((TYPE) << 5) | (TAG)) 49178825Sdfr 5055682Smarkm/* Universal tags */ 5155682Smarkm 5255682Smarkmenum { 53178825Sdfr UT_EndOfContent = 0, 54178825Sdfr UT_Boolean = 1, 55178825Sdfr UT_Integer = 2, 56178825Sdfr UT_BitString = 3, 57178825Sdfr UT_OctetString = 4, 58178825Sdfr UT_Null = 5, 59178825Sdfr UT_OID = 6, 60178825Sdfr UT_Enumerated = 10, 61178825Sdfr UT_UTF8String = 12, 62178825Sdfr UT_Sequence = 16, 63178825Sdfr UT_Set = 17, 64178825Sdfr UT_PrintableString = 19, 65178825Sdfr UT_IA5String = 22, 66178825Sdfr UT_UTCTime = 23, 67178825Sdfr UT_GeneralizedTime = 24, 68178825Sdfr UT_UniversalString = 25, 69178825Sdfr UT_VisibleString = 26, 70178825Sdfr UT_GeneralString = 27, 71178825Sdfr UT_BMPString = 30, 72178825Sdfr /* unsupported types */ 73178825Sdfr UT_ObjectDescriptor = 7, 74178825Sdfr UT_External = 8, 75178825Sdfr UT_Real = 9, 76178825Sdfr UT_EmbeddedPDV = 11, 77178825Sdfr UT_RelativeOID = 13, 78178825Sdfr UT_NumericString = 18, 79178825Sdfr UT_TeletexString = 20, 80178825Sdfr UT_VideotexString = 21, 81178825Sdfr UT_GraphicString = 25 8255682Smarkm}; 8355682Smarkm 8455682Smarkm#define ASN1_INDEFINITE 0xdce0deed 8555682Smarkm 86178825Sdfrtypedef struct heim_der_time_t { 87178825Sdfr time_t dt_sec; 88178825Sdfr unsigned long dt_nsec; 89178825Sdfr} heim_der_time_t; 9055682Smarkm 91178825Sdfrtypedef struct heim_ber_time_t { 92178825Sdfr time_t bt_sec; 93178825Sdfr unsigned bt_nsec; 94178825Sdfr int bt_zone; 95178825Sdfr} heim_ber_time_t; 9655682Smarkm 97178825Sdfr#include <der-protos.h> 9855682Smarkm 99178825Sdfrint _heim_fix_dce(size_t reallen, size_t *len); 100178825Sdfrint _heim_der_set_sort(const void *, const void *); 101178825Sdfrint _heim_time2generalizedtime (time_t, heim_octet_string *, int); 10255682Smarkm 10355682Smarkm#endif /* __DER_H__ */ 104