Estonian ID Card C-library
Loading...
Searching...
No Matches
DigiDocCsp.h
1#ifndef __DIGIDOCCSP_H__
2#define __DIGIDOCCSP_H__
3
4//==================================================
5// FILE: DigDocCsp.h
6// PROJECT: Digi Doc
7// DESCRIPTION: CSP Functions
8// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
9//==================================================
10// Copyright (C) AS Sertifitseerimiskeskus
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19// GNU Lesser General Public Licence is available at
20// http://www.gnu.org/copyleft/lesser.html
21//==========< HISTORY >=============================
22// 1.0 09.05.2002 Veiko Sinivee
23//==================================================
24
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define EST_EID_CSP "EstEID Card CSP"
31
32typedef struct CSProvider_st {
33 char* CSPName;
34 int rsa_full; // if FALSE RSA_SIG will be used
35 int at_sig;
37
38// general structure for a list of certificates
39typedef struct CertItem_st {
40 X509* pCert;
41 struct CertItem_st* nextItem;
42} CertItem;
43
44
45typedef struct CertSearchStore_st {
46 int searchType;
47 char* storeName; // default is "My"
48 long certSerial;
49 int numberOfSubDNCriterias;
50 char** subDNCriterias;
51 int numberOfIssDNCriterias;
52 char** issDNCriterias;
53 void* publicKeyInfo;
55
56typedef struct CertSearch_st {
57 int searchType;
58 char* x509FileName;
59 char* keyFileName;
60 char* pkcs12FileName;
61 char * pswd;
62 CertSearchStore* certSearchStore;
64
65
66//=====================================================================
67// Hashes and signes data with EstId card, returns also cert
68// which can be used in order to verify signature
69// IN dataToBeSigned - source data buffer
70// IN dataLen - how many bytes will be read from source buffer
71// OUT cert - cert buffer( corresponding private key was used to sign.), migth be NULL if this parameter is not needed.
72// OUT certLen - cert length in buffer, migth be NULL if cert parameter is not needed.
73// OUT keyBlob - public key's buffer, migth be NULL if this parameter is not needed.
74// OUT keyBlobLen - public key's length in buffer, migth be NULL if keyBlob parameter is not needed.
75// OUT hash - hash buffer, migth be NULL if this parameter is not needed.
76// OUT hashLen - hash length in buffer, migth be NULL if hash parameter is not needed.
77// OUT sign - output data buffer for hashed and signed data
78// OUT sigLen - data length in output buffer
79//=====================================================================
80int GetSignParametersWithEstIdCSP(byte * dataToBeSigned,unsigned long dataLen,
81 X509 **x509, int *needCert,
82 byte *keyBlob, unsigned long *keyBlobLen,
83 byte *hash, unsigned long *hashLen,
84 byte *sign,unsigned long *sigLen);
85
86
87
88//EXP_OPTION int calculateSigInfoSignatureWithEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo,
89// int slot, const char* passwd);
90
91
92//Added parameter iByKeyContainer by A.Amenberg 06062003
93EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer, const char* szPin);
94
95EXP_OPTION X509 * findIssuerCertificatefromMsStore(X509 *x509);
96
97
98EXP_OPTION CertSearchStore* CertSearchStore_new();
99EXP_OPTION void CertSearchStore_free(CertSearchStore* certSearchStore);
100
101EXP_OPTION CertSearch* CertSearch_new();
102EXP_OPTION void CertSearch_free(CertSearch* certSearch);
103EXP_OPTION void CertList_free(CertItem* pListStart);
104EXP_OPTION void CertSearch_setX509FileName(CertSearch* certSearch, const char* str);
105EXP_OPTION void CertSearch_setKeyFileName(CertSearch* certSearch, const char* str);
106EXP_OPTION void CertSearch_setPkcs12FileName(CertSearch* certSearch, const char* str);
107EXP_OPTION void CertSearch_setPasswd(CertSearch* certSearch, const char* str);
108
109
110//
111EXP_OPTION CSProvider * getCurrentCSProvider(BOOL tryToFindIfMissing);
112EXP_OPTION X509* findCertificate(const CertSearch * cS);
113EXP_OPTION int findAllCertificates(const CertSearchStore *sS, X509 ***certsArray, int *numberOfCerts);
114
115EXP_OPTION int Digi_readCertificateByPKCS12OnlyCertHandle(const char *pkcs12file, const char * passwd, X509 **x509);
116EXP_OPTION int Digi_getConfirmationWithCertSearch(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, char* pkcs12File, char* password,
117 char* notaryURL, char* proxyHost, char* proxyPort);
118EXP_OPTION int Digi_setNotaryCertificate(NotaryInfo* pNotary, X509* notCert);
119EXP_OPTION int Digi_verifyNotaryInfoWithCertSearch(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo);
120
121// verifies this one signature
122EXP_OPTION int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo,
123 const char* szDataFile);
124// verifies the whole document (returns on first err)
125EXP_OPTION int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile);
126EXP_OPTION int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif
Definition DigiDocCsp.h:32
Definition DigiDocCsp.h:39
Definition DigiDocCsp.h:56
Definition DigiDocCsp.h:45
Definition DigiDocObj.h:139
Definition DigiDocObj.h:154
Definition DigiDocObj.h:177