Page 1 of 1

Use external Certificate on USB with HTTP Requests

Posted: Tue 17 Nov 2020 17:19
by dian
Hi,
i have an certificate attached to my computer (usb dongle) which is used for authentication.
When access a website using browser, everything works as expected and receive the data.

Trying to use SecureBridge components to perform the same request using TScHttpWebRequest and provide Certificate data.
When I try to get read data in certificate, I'm able to do that using TScCryptoAPIStorage. I can read issuer, subject and raw data of certificate from USB Card.
My question is how to use this data read from USB Certificate together with HTTP Web request performed by TScHttpWebRequest component.

Thanks.

Re: Use external Certificate on USB with HTTP Requests

Posted: Thu 19 Nov 2020 15:42
by ViktorV
To be able to use certificates imported into the TScCryptoAPIStorage instance with the TScHttpWebRequest component, you should set the TScHttpWebRequest.Storage property to a value equal to the name of the TScCryptoAPIStorage instance.

Re: Use external Certificate on USB with HTTP Requests

Posted: Fri 20 Nov 2020 20:42
by dian
Thanks, i did that, but still don't have success.
Is there a something which i have to do trough the code?

Re: Use external Certificate on USB with HTTP Requests

Posted: Tue 24 Nov 2020 14:33
by ViktorV
Please make sure that the CryptoAPI storage, which you assign to TScHttpWebRequest, contains the CA certificate. To get the list of certificates, use the TScCryptoAPIStorage.Certificates.GetCertificateNames method. If the storage has the CA certificate, you can use the event handler TScHttpWebRequest.SSLOptions.OnServerCertificateValidation to find out what certificate is sent by the server and why it doesn't meet your requirements.