Windows KSP og 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.

Connection between HSM 2 and PKI Proxy Server, Client and exposed client interfaces.

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.

Mulige brugsscenarier for denne opsætning er:

  • Code signing

  • Document signing

Tip

Se også den officielle PKI Proxy-dokumentation for mere information.

Forudsætninger

  • 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

  1. Download the PKI Proxy 2024 installer from the /n software website.

  2. Åbn installationsprogrammet, og følg installationsguiden.

  3. Åbn PKI Proxy fra Start-menuen. Hvis du har installeret den på standardplaceringen, kan du også køre den med følgende kommando fra dialogen Run eller PowerShell.

    C:\Program Files\PKI Proxy 2024\PKIProxy.exe
    

    Bemærk

    PKI Proxy minimeres til systembakken, selv om hovedvinduet er lukket.

Service Configuration

Instruktionerne nedenfor konfigurerer PKI Proxy.

  1. Open the PKI Proxy main window.

  2. Change to the Settings tab.

  3. Make sure the checkbox Enable TLS is checked and an appropriate certificate is used.

  4. Change to the Users tab.

  5. Opret en ny bruger ved at klikke på knappen New…. Vælg en godkendelsestype, som understøttes af alle klienter.

  6. Klik på knappen Start i hovedvinduets menulinje for at starte PKI Proxy-tjenesten.

Publish Certificates from the HSM 2

In the following we configure which certificates from the HSM 2 are made available through PKI Proxy.

  1. Sørg for, at hovedvinduet i PKI Proxy er åbent.

  2. Change to the Certificates tab.

  3. Klik på knappen New…. Dette åbner vinduet Share Certificate.

  4. Klik på knappen Select Certificate or Key… i rammen Certificate i vinduet. Dette åbner vinduet Select a Private Key.

  5. Skift til fanen Security Key.

  6. 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.

  7. 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.

  8. I tekstfeltet » « (Indtast PIN-kode) skal du indtaste PIN-koden til din HSM 2.

  9. Click the Open button.

  10. 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.

  11. Klik på knappen OK for at bekræfte valget. Dette bringer dig tilbage til vinduet Share Certificate. Vinduet viser nu detaljerne for det valgte certifikat.

  12. Klik på knappen Add… i rammen Access and Permissions i vinduet. Dette åbner vinduet Vælg bruger.

  13. Vælg en eksisterende bruger i rullemenuen, eller opret en ny ved at vælge Create New User…. Klik på knappen OK for at bekræfte valget. Hvis du vælger at oprette en ny bruger, vises vinduet New User bagefter.

  14. Tilbage i vinduet Share Certificate skal du også sørge for kun at tillade de nødvendige handlinger for certifikatet eller den generiske nøgle. Dette kan ændres med afkrydsningsfelterne i bunden af Access and Permissions frame.

  15. Klik på knappen OK for at udgive certifikatet. Dette bringer dig tilbage til hovedvinduet i PKI Proxy.

  16. Tekstlisten under Certificate Management viser nu det offentliggjorte certifikat.

PKI Proxy - Klient

PKI Proxy-klientværktøjerne giver forskellige måder at få adgang til de delte nøgler og certifikater fra en PKI Proxy-server.

Tip

PKI Proxy-serveren indeholder klientværktøjerne. Derfor kan den maskine, der kører serveren, også være en klient for sig selv.

Installation

  1. Download PKI Proxy 2024 - Client Tools fra /n software-webstedet.

  2. Åbn installationsprogrammet, og følg installationsguiden.

KSP (Key Storage Provider)

PKI Proxy leverer en KSP til grænsefladen med PKI Proxy-serveren. KSP’en gør det muligt at bruge oprindelige Windows-API’er med applikationer gennem CNG-grænsefladen (Cryptography API: Next Generation). Se dokumentationen til PKI Proxy for mere information.

PKCS#11

PKI Proxy indeholder et PKCS#11-modul til at interface med PKI Proxy-serveren. Se venligst PKI Proxy-dokumentation for mere information.