Tips and Frequently Asked Questions
Using client-certificates with Sparkle in Windows
You can send client-certificates when performing HTTP requests using Sparkle, from Windows. The following code snippet shows how to do it. Two comments about the code:
a) You have to declare TInternalHTTPClient in the same unit you use the code below, preferable in the implementation section
b) This code snippet shows also how to retrieve the certificate from Windows store. It’s there as an example but you can and should replace with your own code to retrieve the certificate. That part of the code is not Sparkle-related and you should be familiar with the Windows API that handles certificates. The relevant Sparkle code is highlighted in bold.
TInternalHTTPClient = class(THttpClient) end; var httpClient: THttpClient; httpEngine: TWinHttpEngine; httpRequest: THttpRequest; httpResponse: THttpResponse; Store: HCERTSTORE; Cert: PCERT_CONTEXT; begin httpClient := THttpClient.Create; // Open the ''Personal'' SSL certificate store for the local machine and locate the required client-side certificate Cert := nil; Store := CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, PChar(''MY'')); if (Store <> nil) then Cert := CertFindCertificateInStore(Store, X509_ASN_ENCODING, 0, CERT_FIND_SUBJECT_STR, PChar(''mycertsubject''), nil); // If a valid certificate was found then OK to create and send the HTTP request if (Cert <> nil) then begin // Setup HTTP request properties httpRequest := httpClient.CreateRequest; ... // Use ''BeforeWinHttpSendRequest'' event to set any HTTP request properties such as client-side SSL certificate httpEngine := TWinHttpEngine(TInternalHTTPClient(httpClient).Engine); httpEngine.BeforeWinHttpSendRequest := procedure (Req: HINTERNET) begin WinHttpCheck(WinHttpSetOption(Req, WINHTTP_OPTION_CLIENT_CERT_CONTEXT, Cert, SizeOf(CERT_CONTEXT))); end; // Execute HTTP request httpResponse := httpClient.Send(httpRequest); end;
Pricing
Single Developer License
Small Team License
Site License
TMS BIZ Essential
€ 395
€
120
yearly renewal
license for 1 developer
TMS BIZ Standard
€ 495
€
150
yearly renewal
license for 1 developer
MOST POPULAR
TMS BIZ Premium
€ 595
€
180
yearly renewal
license for 1 developer
BEST VALUE
All prices excl. VAT. Renewal price is subject to change and only valid up to 30 days after license has expired. After renewal period a discount price is offered to renew the license.