Eneboo - Documentación para desarrolladores
|
00001 #ifndef __DIGIDOC_MSSP_GW_H__ 00002 #define __DIGIDOC_MSSP_GW_H__ 00003 //================================================== 00004 // FILE: DigiDocMsspGw.h 00005 // PROJECT: Digi Doc 00006 // DESCRIPTION: Digi Doc functions for MSSP_GW client 00007 // AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia 00008 //================================================== 00009 // Copyright (C) AS Sertifitseerimiskeskus 00010 // This library is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU Lesser General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 2.1 of the License, or (at your option) any later version. 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // GNU Lesser General Public Licence is available at 00019 // http://www.gnu.org/copyleft/lesser.html 00020 //==========< HISTORY >============================= 00021 // 25.09.2005 Veiko Sinivee 00022 // Creation 00023 //================================================== 00024 00025 #include <libdigidoc/DigiDocDefs.h> 00026 #include <libdigidoc/mssp/stdsoap2.h> 00027 #include <libdigidoc/mssp/MsspErrors.h> 00028 #include <libdigidoc/DigiDocMem.h> 00029 #include <openssl/x509.h> 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 typedef struct MSSP_st 00036 { 00037 struct soap soap; 00038 const char *endpoint; 00039 time_t lApTxnId; 00040 unsigned long lMsspTxnId; 00041 int nStatusCode; 00042 } MSSP; 00043 00044 //-------------------------------------------------- 00045 // Initializes MSSP connection 00046 // pMssp - pointer to MSSP context structure 00047 // returns ERR_OK on success 00048 //-------------------------------------------------- 00049 EXP_OPTION int ddocMsspConnect(MSSP** pMssp); 00050 00051 //-------------------------------------------------- 00052 // Reconnects to MSSP service if necessary 00053 // pMssp - pointer to MSSP context structure 00054 // returns ERR_OK on success 00055 //-------------------------------------------------- 00056 EXP_OPTION int ddocMsspReconnect(MSSP* pMssp); 00057 00058 //-------------------------------------------------- 00059 // Cleanup MSSP connection. Free memory 00060 // pMssp - pointer to MSSP context structure 00061 // returns ERR_OK on success 00062 //-------------------------------------------------- 00063 EXP_OPTION int ddocMsspDisconnect(MSSP* pMssp); 00064 00065 //-------------------------------------------------- 00066 // Cleanup MSSP connection but don't disconnect 00067 // pMssp - pointer to MSSP context structure 00068 // returns ERR_OK on success 00069 //-------------------------------------------------- 00070 EXP_OPTION int ddocMsspCleanup(MSSP* pMssp); 00071 00072 //-------------------------------------------------- 00073 // Sends an MSSP request to sign this data 00074 // pMssp - pointer to MSSP context structure 00075 // szPhoneNo - phone number on which to sign 00076 // pHash - pointer to binary hash to sign 00077 // nHashLen - length of hash data 00078 // szDesc - description what user is signing (file name) 00079 // returns error code or SOAP_OK 00080 //-------------------------------------------------- 00081 EXP_OPTION int ddocMsspSignatureReq(MSSP* pMssp, const char* szPhoneNo, 00082 const char* pHash, int nHashLen, const char* szDesc); 00083 00084 //-------------------------------------------------- 00085 // Sends an MSSP request to find the status of signature 00086 // operation and possibly it's value 00087 // pMssp - pointer to MSSP context structure 00088 // pMbufSignature - memory buffer to store signature value 00089 // returns error code or SOAP_OK 00090 //-------------------------------------------------- 00091 EXP_OPTION int ddocMsspStatusReq(MSSP* pMssp, DigiDocMemBuf* pMbufSignature); 00092 00093 //-------------------------------------------------- 00094 // Reads the signers certificate based on the signers 00095 // phone number. 00096 // szPhoneNo - phone number 00097 // szCertUrl - full url where to get cert. Use NULL for default url 00098 // ppCert - address to store the certificate 00099 // bAuthCert - 1=auth cert, 0=sign cert 00100 // returns error coder or ERR_OK 00101 //-------------------------------------------------- 00102 EXP_OPTION int ddocMsspReadCertificate(const char* szPhoneNo, const char* szCertUrl, 00103 X509 **ppCert, int bAuthCert); 00104 00105 //-------------------------------------------------- 00106 // Rerieves SOAP fault string 00107 // pMssp - pointer to MSSP context structure 00108 // returns SOAP fault string or NULL 00109 //-------------------------------------------------- 00110 EXP_OPTION char* ddocGetSoapFaultString(MSSP* pMssp); 00111 00112 //-------------------------------------------------- 00113 // Rerieves SOAP fault code 00114 // pMssp - pointer to MSSP context structure 00115 // returns SOAP fault code or NULL 00116 //-------------------------------------------------- 00117 EXP_OPTION char* ddocGetSoapFaultCode(MSSP* pMssp); 00118 00119 //-------------------------------------------------- 00120 // Rerieves SOAP fault detail 00121 // pMssp - pointer to MSSP context structure 00122 // returns SOAP fault detail or NULL 00123 //-------------------------------------------------- 00124 EXP_OPTION char* ddocGetSoapFaultDetail(MSSP* pMssp); 00125 00126 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif // __DIGIDOC_MSSP_GW_H__ 00133