Click or drag to resize
Pdftools logo

HttpClientHandler Class

The handler and options for communication to remote server

This class can be used to configure HTTP and HTTPS communication.

Also see Proxy for the product wide proxy configuration.

For HTTPS (SSL/TLS) communication, the server certificate's trustworthiness is verified using the system's default trust store (CA certificate store). If the server certificate's trustworthiness cannot be determined, the connection to the server is aborted.

The default trust store is:

  • Windows:

    The Windows certificate store for "Trusted Root Certification Authorities" is used. You can manually install the root certificate of a private CA on a computer by using the CertMgr tool. The certificate store is only available if the user profile has been loaded.

  • Linux:

    The certificates available in CAfile and CApath are trusted:

    • CAfile:

      The file can contain a concatenated sequence of CA certificates in PEM format.

      The SDK searches for the file at the following locations:

      • The file of your local OpenSSL installation (if libssl.so is found), or
      • the environment variable SSL_CERT_FILE, or
      • the default location /etc/ssl/cert.pem.

    • CApath:

      A directory containing CA certificates in PEM format. The files are looked up by the CA subject name hash value, e.g. 9d66eef0.0.

      The SDK searches for the directory at the following locations:

      • The directory of your local OpenSSL installation (if libssl.so is found), or
      • the environment variable SSL_CERT_DIR, or
      • the default location /etc/ssl/certs/.

  • macOS:

    The trusted certificates from the macOS keychain are used. You can manually install the root certificate of a private CA by dragging the certificate file onto the Keychain Access app.

You can add more certificates to the trust store using AddTrustedCertificate(Stream).

Instances of this class can be used in multiple threads concurrently, as long as they are not modified concurrently.

Inheritance Hierarchy
SystemObject
  PdfTools.InternalNativeBase
    PdfTools.InternalNativeObject
      PdfToolsHttpClientHandler

Namespace: PdfTools
Assembly: PdfTools (in PdfTools.dll) Version: 1.1.0.0
Syntax
C#
public class HttpClientHandler : NativeObject

The HttpClientHandler type exposes the following members.

Constructors
 NameDescription
Public methodHttpClientHandler The default values of newly created objects are not copied from the default handler HttpClientHandler, but are as described in this documentation.
Top
Properties
 NameDescription
Public propertySslVerifyServerCertificate

Verify the server certificate for SSL/TLS

If the server certificate's trustworthiness is verified. If the verification process fails, the handshake is immediately terminated and the connection is aborted. The verification requires a trust store; otherwise, verification always fails.

Default:

Top
Methods
 NameDescription
Public methodAddTrustedCertificate

Add a certificate to the trust store

Add a certificate to the trust store of this HttpClientHandler instance. The certificates in the trust store are used to verify the certificate of the SSL/TLS server (see HttpClientHandler). You should add trusted certification authorities (Root CA) certificates to the trust store. However, you can also add server certificates (e.g. self-signed certificates) and intermediate CA certificates.
Public methodEquals
(Inherited from NativeObject)
Public methodGetHashCode
(Inherited from NativeObject)
Public methodSetClientCertificate

Set the SSL/TLS client certificate as PFX (PKCS#12) archive

The file must contain the certificate itself, all certificates of the trust chain, and the private key.
Public methodSetClientCertificateAndKey

Set the SSL/TLS client certificate and private key

The file must contain the certificate and its private key. It is also recommended to include all certificates of the trust chain.
Top
See Also