fladam...@gmail.com
unread,Jun 25, 2018, 11:10:28 AM6/25/18You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi All,
with Delphi I have a snippet of code that loads secure certificate for accessing to a Soap Web Service;
I need to port this code to C++, but I have some trobles.
This is the C++ code:
void __fastcall TForm1::HTTPRIO1HTTPWebNode1BeforePost(THTTPReqResp * const HTTPReqResp,
Pointer Data)
{
//Cert : ICertificate2; //Delphi
//CertContext : ICertContext; //Delphi
//cPassword : string; //Delphi
//cFileName_p12: string;//Delphi
//PCertContext : PCCERT_CONTEXT;//Delphi
int TimeOut;
String cFileName_p12, FNomeCertificato, cPassword;
ICertificate2 *Cert;
ICertContext *CertContext;
PCCERT_CONTEXT *PcertContext;
CoCertificate *Coc;
TimeOut = 5000;
InternetSetOption(Data, INTERNET_OPTION_RECEIVE_TIMEOUT, &TimeOut, sizeof(TimeOut));
cFileName_p12 = ExtractFilePath(Application->ExeName) + FNomeCertificato;
Cert:=CoCertificate.Create;
Cert->Load(cFileName_p12.c_str(), cPassword.c_str(), CAPICOM_KEY_STORAGE_FLAG::CAPICOM_KEY_STORAGE_DEFAULT, CAPICOM_KEY_LOCATION::CAPICOM_CURRENT_USER_KEY);
CertContext = Cert as ICertContext;
CertContext->Get_CertContext(integer(PCertContext));
//usa il certificato nella comunicazione SSL
if InternetSetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT, PCertContext, Sizeof(CERT_CONTEXT)) = false then
MessageDlg('SI E'' VERIFICATO UN ERRORE NELLA GESTIONE DEL CERTIFICATO PER LA CONNESSIONE', mterror, [mbok],0);
}
The istruction:
Cert:=CoCertificate.Create; in Delphi, I'm not able to traslay in C++.
Can you help me to solve it?
Thanks,
Flavio
p.s: It is based on Campicom.dll (that I have imported as TLB)