Eneboo - Documentación para desarrolladores
src/libdigidoc/DigiDocCsp.h
Ir a la documentación de este archivo.
00001 #ifndef __DIGIDOCCSP_H__
00002 #define __DIGIDOCCSP_H__
00003 
00004 //==================================================
00005 // FILE:        DigDocCsp.h
00006 // PROJECT: Digi Doc
00007 // DESCRIPTION: CSP Functions 
00008 // AUTHOR:  Veiko Sinivee, S|E|B IT Partner Estonia
00009 //==================================================
00010 // Copyright (C) AS Sertifitseerimiskeskus
00011 // This library is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU Lesser General Public
00013 // License as published by the Free Software Foundation; either
00014 // version 2.1 of the License, or (at your option) any later version.
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 // GNU Lesser General Public Licence is available at
00020 // http://www.gnu.org/copyleft/lesser.html
00021 //==========< HISTORY >=============================
00022 // 1.0  09.05.2002      Veiko Sinivee   
00023 //==================================================
00024 
00025 
00026 #ifdef  __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 #define EST_EID_CSP "EstEID Card CSP"
00031 
00032 typedef struct CSProvider_st {
00033         char* CSPName;
00034         int rsa_full; // if FALSE RSA_SIG will be used 
00035         int at_sig; 
00036 } CSProvider;
00037 
00038 // general structure for a list of certificates
00039 typedef struct CertItem_st {
00040         X509* pCert;
00041         struct CertItem_st* nextItem;
00042 } CertItem;
00043 
00044 
00045 typedef struct CertSearchStore_st {
00046         int searchType;
00047         char* storeName; // default is "My"
00048         long certSerial;
00049         int numberOfSubDNCriterias;
00050         char** subDNCriterias;
00051         int numberOfIssDNCriterias;
00052         char** issDNCriterias;
00053         void* publicKeyInfo;
00054 } CertSearchStore;
00055 
00056 typedef struct CertSearch_st {
00057         int searchType;
00058         char* x509FileName;
00059         char* keyFileName; 
00060         char* pkcs12FileName;
00061         char * pswd;
00062         CertSearchStore* certSearchStore;
00063 } CertSearch;
00064   
00065 
00066 //=====================================================================
00067 // Hashes and signes data with EstId card, returns also cert
00068 // which can be used in order to verify signature
00069 // IN dataToBeSigned - source data buffer
00070 // IN dataLen - how many bytes will be read from source buffer
00071 // OUT cert - cert buffer( corresponding private key was used to sign.), migth be NULL if this parameter is not needed.
00072 // OUT certLen - cert length in buffer, migth be NULL if cert parameter is not needed.
00073 // OUT keyBlob - public key's buffer, migth be NULL if this parameter is not needed.
00074 // OUT keyBlobLen - public key's length in buffer, migth be NULL if keyBlob parameter is not needed.
00075 // OUT hash - hash buffer, migth be NULL if this parameter is not needed.
00076 // OUT hashLen - hash length in buffer, migth be NULL if hash parameter is not needed.
00077 // OUT sign - output data buffer for hashed and signed data
00078 // OUT sigLen - data length in output buffer
00079 //=====================================================================
00080 int GetSignParametersWithEstIdCSP(byte * dataToBeSigned,unsigned long dataLen,
00081                                                                           X509 **x509, int *needCert, 
00082                                                                           byte *keyBlob, unsigned long *keyBlobLen,
00083                                                                           byte *hash, unsigned long *hashLen,
00084                                                                           byte *sign,unsigned long *sigLen);
00085 
00086 
00087 
00088 EXP_OPTION int calculateSigInfoSignatureWithEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, 
00089                     int slot, const char* passwd);
00090 //Added parameter iByKeyContainer by A.Amenberg 06062003
00091 EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer);
00092 
00093 EXP_OPTION X509 * findIssuerCertificatefromMsStore(X509 *x509);
00094 
00095 
00096 EXP_OPTION CertSearchStore* CertSearchStore_new();
00097 EXP_OPTION void CertSearchStore_free(CertSearchStore* certSearchStore);
00098 
00099 EXP_OPTION CertSearch* CertSearch_new();
00100 EXP_OPTION void CertSearch_free(CertSearch* certSearch);
00101 EXP_OPTION void CertList_free(CertItem* pListStart);
00102 EXP_OPTION void CertSearch_setX509FileName(CertSearch* certSearch, const char* str);
00103 EXP_OPTION void CertSearch_setKeyFileName(CertSearch* certSearch, const char* str);
00104 EXP_OPTION void CertSearch_setPkcs12FileName(CertSearch* certSearch, const char* str);
00105 EXP_OPTION void CertSearch_setPasswd(CertSearch* certSearch, const char* str);
00106 
00107 
00108 //
00109 EXP_OPTION CSProvider * getCurrentCSProvider(BOOL tryToFindIfMissing);
00110 EXP_OPTION X509* findCertificate(const CertSearch * cS);
00111 EXP_OPTION int findAllCertificates(const CertSearchStore *sS, X509 ***certsArray, int *numberOfCerts);
00112 
00113 EXP_OPTION int Digi_readCertificateByPKCS12OnlyCertHandle(const char *pkcs12file, const char * passwd, X509 **x509);
00114 EXP_OPTION int Digi_getConfirmationWithCertSearch(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, char* pkcs12File, char* password,
00115                             char* notaryURL, char* proxyHost, char* proxyPort);
00116 EXP_OPTION int Digi_setNotaryCertificate(NotaryInfo* pNotary, X509* notCert);
00117 EXP_OPTION int Digi_verifyNotaryInfoWithCertSearch(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo);
00118 
00119 // verifies this one signature
00120 EXP_OPTION int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, 
00121                                                 const char* szDataFile, FilePath* pPaths, int nPaths);
00122 // verifies the whole document (returns on first err)
00123 EXP_OPTION int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile, 
00124                                                         FilePath* pPaths, int nPaths);
00125 EXP_OPTION int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile, FilePath* pPaths, int nPaths);
00126 
00127 #ifdef  __cplusplus
00128 }
00129 #endif
00130 
00131 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'