Running SDK local service with HTTPS protocol

Installation settings

  1. Run Regula Downloads manager and download the required software version. Further on in this example we will be using a service version for x86 systems.
  2. During the installation you can select a required port and protocol to be used by the local service.

     

Setting up HTTPS for localhost.

The following steps are required:

If you do not have an SSL certificate yet, for testing purposes you can create a self-signed certificate for localhost using PowerShell.
 
Please follow the steps below on the computer where Regula Document Reader Local Service SDK is installed.
 
1. Create an SSL certificate for localhost 
 
Open PowerShell as Administrator and run:
 

$cert = New-SelfSignedCertificate `
  -DnsName "localhost" `
  -FriendlyName "XStore - Local Service HTTPS Certificate" `
  -CertStoreLocation "Cert:\LocalMachine\My" `
  -KeyAlgorithm RSA `
  -KeyLength 2048 `
  -KeyExportPolicy NonExportable `
  -Type SSLServerAuthentication `
  -NotAfter (Get-Date).AddYears(10)

 
AddYears(10) means that the cert is issued for 10 years.
 
The certificate will be installed in:
Certificates (Local Computer) → Personal → Certificates
For production environments, we recommend using a certificate issued by your organization's internal Certificate Authority (CA), if available.
 
 
2. Add the certificate to Trusted Root Certification Authorities
Since Windows does not trust self-signed certificates by default, you need to add the certificate to the trusted certificate store.
Run the following commands in the same PowerShell session:
 

Export-Certificate `
  -Cert $cert `
  -FilePath "$env:TEMP\localhost.cer"

Import-Certificate `
  -FilePath "$env:TEMP\localhost.cer" `
  -CertStoreLocation "Cert:\LocalMachine\Root"

Please ensure that importing a self-signed certificate into the Trusted Root store is permitted by your organization's IT security policy.
 
 
3. Configure HTTPS on port 8081
If your Local Service uses Windows HTTP.sys for HTTPS, first check whether an SSL certificate binding already exists:
 

netsh http show sslcert ipport=0.0.0.0:8081

If no binding exists, you can create one.
 
First, obtain the certificate thumbprint:
 

$cert.Thumbprint

 
This command displays the unique SHA-1 thumbprint of the certificate created in Step 1. Each newly generated certificate has its own thumbprint.
Next, generate an Application ID:
 

$appId = [guid]::NewGuid()
$appId

 
The Application ID is a GUID used to identify the application that owns the SSL binding. For a new HTTP.sys binding, you can generate a GUID rather than using one from another computer.
Now run the following command in the same PowerShell session as Administrator:
 

netsh http add sslcert `
  ipport=0.0.0.0:8081 `
  certhash=$($cert.Thumbprint) `
  appid="{$appId}" `
  certstorename=MY

The command automatically uses:
 

  1. Certificate Hash: The thumbprint of the certificate created in Step 1.
  2. Application ID: The GUID generated in this step.
  3. Port: 8081, which is the port used for the HTTPS connection in your environment.
     

If an SSL binding already exists, please do not overwrite it without checking its configuration.
 
 
4. Restart the Local Service
Once the certificate and HTTPS configuration are in place, restart Regula Document Reader Local Service SDK.
You can then check whether the service is accessible over HTTPS localhost:8081 using the demo page and Swagger interface.
 
5. Verify that the certificate is added as trusted
To confirm that the certificate was successfully added to Trusted Root Certification Authorities:
 

  1. Press Win + R, type certlm.msc, and press Enter.
  2. Navigate to Trusted Root Certification Authorities → Certificates.
  3. Find the certificate named localhost and verify that it is present.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Articles in this section

See more