Windows KSP och PKCS#11 med PKI Proxy¶
This document explains the usage of PKI Proxy with HSM 2. PKI Proxy enables the usage of HSM 2 through the native Microsoft Windows APIs. For this purpose, PKI Proxy includes a KSP (Key Storage Provider) that enables its use via the CNG (Cryptography API: Next Generation) interface. Additionally it provides PKCS#11 access to the HSM 2, but this should only be used if your setup requires it for example if you need the additional authentication features of PKI Proxy, or if you need to access it from a remote machine running an application that only supports PKCS#11. In all other cases use the PKCS#11 driver from the OpenSC project directly.
The deployment of HSM 2 with PKI Proxy looks like this.
The HSM 2 is connected via its USB interface to the PKI Proxy server. PKI Proxy uses the OpenSC PKCS#11 driver to connect to the HSM 2 and access its keys and certificates. Clients to the PKI Proxy use the REST API of the PKI Proxy server to access the keys and certificates. Applications on the client can either use the native Windows API or a PKCS#11 driver. PKI Proxy server and client can be executed on the same computer.
Möjliga användningsfall för denna inställning är:
Code signing
Document signing
Tips
Mer information finns även i den officiella dokumentationen PKI Proxy.
Förutsättningar¶
HSM 2
Initialized
Provisioned with keys and certificates
Windows machine
OpenSC PKCS#11 driver installed (only required on the PKI Proxy Server).
PKI Proxy - Server¶
The PKI Proxy server shares the keys and certificates from a HSM 2 for different users.
Installation¶
Download the PKI Proxy 2024 installer from the /n software website.
Öppna installationsprogrammet och följ installationsguiden.
Öppna PKI Proxy från Start-menyn. Om du installerade den på standardplatsen kan du också köra den med följande kommando från dialogrutan Run eller PowerShell.
C:\Program Files\PKI Proxy 2024\PKIProxy.exeObservera
PKI Proxy minimeras till systemfältet, även om huvudfönstret är stängt.
Service Configuration¶
I instruktionerna nedan konfigureras PKI Proxy.
Open the PKI Proxy main window.
Change to the Settings tab.
Make sure the checkbox Enable TLS is checked and an appropriate certificate is used.
Change to the Users tab.
Skapa en ny användare genom att klicka på knappen New…. Välj en autentiseringstyp som stöds av alla klienter.
Klicka på knappen Starta i huvudfönstrets menyrad för att starta PKI Proxy-tjänsten.
Publish Certificates from the HSM 2¶
In the following we configure which certificates from the HSM 2 are made available through PKI Proxy.
Kontrollera att huvudfönstret för PKI Proxy är öppet.
Change to the Certificates tab.
Klicka på knappen New…. Då öppnas fönstret Share Certificate.
Klicka på knappen Select Certificate or Key… i ramen Certificate i fönstret. Då öppnas fönstret Select a Private Key.
Gå till fliken Security Key.
Click the Browse… button and select the OpenSC PKCS#11 driver library file. The text field PKCS#11 Library now shows the path to the library file.
From the dropdown menu Security Key (PKCS#11) choose the slot which contains the certificate. The listed slots depend on your configuration of the HSM 2.
I textfältet ” PIN” anger du PIN-koden för din HSM 2.
Click the Open button.
The text list below Certificates now shows a list of the available certificates and generic keys on the HSM 2. Select the certificate or generic key you want to share with PKI Proxy.
Klicka på knappen OK för att bekräfta valet. Du kommer då tillbaka till fönstret Share Certificate. Fönstret kommer nu att visa detaljerna för det valda certifikatet.
Klicka på knappen Add… i rutan Access and Permissions i fönstret. Då öppnas fönstret Select user.
Välj en befintlig användare i rullgardinsmenyn eller skapa en ny genom att välja Create New User…. Klicka på knappen OK för att bekräfta valet. Om du väljer att skapa en ny användare kommer fönstret New User att visas efteråt.
Tillbaka i fönstret Share Certificate ska du också se till att endast tillåta de åtgärder som krävs för certifikatet eller den generiska nyckeln. Detta kan ändras med hjälp av kryssrutorna längst ned i Access and Permissions -ramen.
Klicka på knappen OK för att publicera certifikatet. Du kommer då tillbaka till huvudfönstret i PKI Proxy.
I textlistan under Certificate Management visas nu det publicerade certifikatet.
PKI Proxy - Klient¶
PKI Proxy-klientverktygen tillhandahåller olika sätt att komma åt de delade nycklarna och certifikaten från en PKI Proxy-server.
Tips
PKI Proxy-servern innehåller klientverktygen. Därför kan den maskin som kör servern också vara en klient för sig själv.
Installation¶
Ladda ner PKI Proxy 2024 - Client Tools från /n software website.
Öppna installationsprogrammet och följ installationsguiden.
KSP (Key Storage Provider)¶
PKI Proxy tillhandahåller en KSP för gränssnitt mot PKI Proxy-servern. KSP gör det möjligt att använda inbyggda Windows API:er med applikationer via CNG-gränssnittet (Cryptography API: Next Generation). Mer information finns i dokumentationen PKI Proxy.
PKCS#11¶
PKI Proxy tillhandahåller en PKCS#11-modul för gränssnitt mot PKI Proxy-servern. Mer information finns i dokumentationen PKI Proxy.