155682Smarkm/* 2233294Sstas * Copyright (c) 1997 - 2006 Kungliga Tekniska H��gskolan 3233294Sstas * (Royal Institute of Technology, Stockholm, Sweden). 4233294Sstas * All rights reserved. 555682Smarkm * 6233294Sstas * Redistribution and use in source and binary forms, with or without 7233294Sstas * modification, are permitted provided that the following conditions 8233294Sstas * are met: 955682Smarkm * 10233294Sstas * 1. Redistributions of source code must retain the above copyright 11233294Sstas * notice, this list of conditions and the following disclaimer. 1255682Smarkm * 13233294Sstas * 2. Redistributions in binary form must reproduce the above copyright 14233294Sstas * notice, this list of conditions and the following disclaimer in the 15233294Sstas * documentation and/or other materials provided with the distribution. 1655682Smarkm * 17233294Sstas * 3. Neither the name of the Institute nor the names of its contributors 18233294Sstas * may be used to endorse or promote products derived from this software 19233294Sstas * without specific prior written permission. 2055682Smarkm * 21233294Sstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22233294Sstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23233294Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24233294Sstas * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25233294Sstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26233294Sstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27233294Sstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28233294Sstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29233294Sstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30233294Sstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31233294Sstas * SUCH DAMAGE. 3255682Smarkm */ 3355682Smarkm 34233294Sstas/* $Id$ */ 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, 55233294Sstas 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 97233294Sstasstruct asn1_template; 98233294Sstas 99178825Sdfr#include <der-protos.h> 10055682Smarkm 101178825Sdfrint _heim_fix_dce(size_t reallen, size_t *len); 102178825Sdfrint _heim_der_set_sort(const void *, const void *); 103178825Sdfrint _heim_time2generalizedtime (time_t, heim_octet_string *, int); 10455682Smarkm 10555682Smarkm#endif /* __DER_H__ */ 106