Estonian ID Card C-library
Loading...
Searching...
No Matches
DigiDocDefs.h
1#ifndef __DIGIDOC_DEFS_H__
2#define __DIGIDOC_DEFS_H__
3//==================================================
4// FILE: DigiDocDefs.h
5// PROJECT: Digi Doc
6// DESCRIPTION: Digi Doc global definitions.
7// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
8//==================================================
9// Copyright (C) AS Sertifitseerimiskeskus
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.ode
18// GNU Lesser General Public Licence is available at
19// http://www.gnu.org/copyleft/lesser.html
20//==========< HISTORY >=============================
21// 15.06.2005 Veiko Sinivee
22//==================================================
23
24
25#ifdef WIN32
26 #ifndef WIN32_LEAN_AND_MEAN
27 #define WIN32_LEAN_AND_MEAN
28 #endif
29 #include <windows.h>
30 #define WIN32_CSP
31 #ifdef _MSC_VER
32 #pragma warning( disable: 4100 4706 4204 4221 )
33 #endif
34 #ifdef digidoc_EXPORTS
35 #define EXP_OPTION __declspec(dllexport)
36 #else
37 #define EXP_OPTION __declspec(dllimport)
38 #endif
39 #define DIGIDOC_DEPRECATED __declspec(deprecated)
40#else
41 #if __GNUC__ >= 4
42 #define EXP_OPTION __attribute__ ((visibility("default")))
43 #define DIGIDOC_DEPRECATED __attribute__ ((__deprecated__))
44 #else
45 #define EXP_OPTION
46 #define DIGIDOC_DEPRECATED
47 #endif
48#endif
49
50#ifdef WIN32
51 //for _msize function
52 #define FILESEPARATOR "\\"
53 #include <malloc.h>
54 #include <direct.h>
55 #if defined(_MSC_VER) && _MSC_VER < 1900
56 #define snprintf _snprintf
57 #endif
58#else
59 #define FILESEPARATOR "/"
60 #define DIGI_DOC_LIB
61 #include <unistd.h>
62 #define _mkdir mkdir
63 #define _rmdir rmdir
64 #define _unlink unlink
65 #define _tzset tzset
66 #define _getcwd getcwd
67 #if defined(__FreeBSD__)
68 #define _timezone tzone
69 extern long int tzone; /* default for Estonia, but see initDigiDocLib() */
70 #define _daylight daylight
71 extern int daylight; /* default, but see initDigiDocLib() */
72 #else
73 #define _timezone timezone
74 #define _daylight daylight
75 #endif
76#endif
77
78#define WITH_BASE64_HASHING_HACK 1
79// VS: disabled ecdsa support for FC13 building
80//#define WITH_ECDSA 1
81
82//#define WITH_DEPRECATED_FUNCTIONS
83
84
85// old timestamp struct
86#define WITH_TIMETSTAMP_STRUCT
87
88#ifndef byte
89typedef unsigned char byte;
90#endif
91
92#define WITH_SHA256
93//==========< Digest types >=======================
94#ifdef WITH_SHA256
95#define SIGNATURE_LEN 144
96#else
97#define SIGNATURE_LEN 128
98#endif
99#define DIGEST_LEN 20
100#define DIGEST_SHA1 0
101#define DIGEST_SHA256 1
102#define DIGEST_LEN256 32
103#define CERT_DATA_LEN 4096
104#define X509_NAME_LEN 256
105#define SIGNATURE_RSA 0
106#define CONTENT_EMBEDDED "EMBEDDED"
107#define CONTENT_EMBEDDED_BASE64 "EMBEDDED_BASE64"
108#define X509_NAME_BUF_LEN 500
109
110//==========< Format types >=======================
111
112#define SK_PKCS7_1 "SK-PKCS#7-1.0"
113#define SK_XML_1_NAME "SK-XML"
114#define DIGIDOC_XML_1_1_NAME "DIGIDOC-XML"
115#define SK_XML_1_VER "1.0"
116#define DIGIDOC_XML_1_1_VER "1.1"
117#define DIGIDOC_XML_1_2_VER "1.2"
118#define DIGIDOC_XML_1_3_VER "1.3"
119#define SK_NOT_VERSION "OCSP-1.0"
120
121#define DIGEST_SHA1_NAME "sha1"
122#define DIGEST_SHA1_WRONG "sha1wrong"
123#define DIGEST_SHA256_NAME "sha256"
124#define SIGN_RSA_NAME "RSA"
125#ifdef WITH_ECDSA
126 #define SIGN_ECDSA_NAME "ECDSA"
127#endif
128#define OCSP_NONCE_NAME "OCSP Nonce"
129#define RESPID_NAME_VALUE "NAME"
130#define RESPID_KEY_VALUE "KEY HASH"
131#define OCSP_SIG_TYPE "sha1WithRSAEncryption"
132#define RESPID_NAME_TYPE 1
133#define RESPID_KEY_TYPE 2
134
135#define DIGEST_METHOD_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
136#define DIGEST_METHOD_SHA256 "http://www.w3.org/2001/04/xmlenc#sha256"
137#define NAMESPACE_XML_DSIG "http://www.w3.org/2000/09/xmldsig#"
138#define NAMESPACE_XADES_111 "http://uri.etsi.org/01903/v1.1.1#"
139#define NAMESPACE_XADES_132 "http://uri.etsi.org/01903/v1.3.2#"
140#define NAMESPACE_XADES "http://uri.etsi.org/01903#"
141
142
143//==========< Format types >=======================
144
145#define CHARSET_ISO_8859_1 "ISO-8859-1"
146#define CHARSET_UTF_8 "UTF-8"
147
148
149//==========< language codes >=======================
150#define DDOC_LANG_ENGLISH 0
151#define DDOC_LANG_ESTONIAN 1
152#define DDOC_NUM_LANGUAGES 2
153#define SUPPORTED_VERSION_COUNT 4
154
155//==========< file formats >=======================
156
157#define FILE_FORMAT_ASN1 0
158#define FILE_FORMAT_PEM 1
159//#define FILE_FORMAT_
160
161//============< OCSP paramaters >==================
162
163#define OCSP_REQUEST_SIGN_NO 1
164#define OCSP_REQUEST_SIGN_CSP 2
165#define OCSP_REQUEST_SIGN_X509 3
166#define OCSP_REQUEST_SIGN_PKCS11_WIN 4
167#define OCSP_REQUEST_SIGN_PKCS12 5
168
169//================== Cert search constants =========
170#define CERT_SEARCH_BY_STORE 1
171#define CERT_SEARCH_BY_X509 2
172#define CERT_SEARCH_BY_PKCS12 3
173
174// thes can be XOR'ed, then all criterias are used
175#define CERT_STORE_SEARCH_BY_SERIAL 0x01
176#define CERT_STORE_SEARCH_BY_SUBJECT_DN 0x02
177#define CERT_STORE_SEARCH_BY_ISSUER_DN 0x04
178#define CERT_STORE_SEARCH_BY_KEY_INFO 0x08
179
180#define FILE_BUFSIZE 1024*16
181
182#endif // __DIGIDOC_DEFS_H__