Windows KSP e PKCS#11 com proxy PKI

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.

Os possíveis casos de utilização desta configuração são:

  • Code signing

  • Document signing

Dica

Consulte também a documentação oficial do Proxy PKI ` <https://cdn.nsoftware.com/help/PK1/app/default.htm>` __ para obter mais informações.

Pré-requisitos

  • HSM 2

    • Initialized

    • Provisioned with keys and certificates

  • Windows machine

    • OpenSC PKCS#11 driver installed (only required on the PKI Proxy Server).

Proxy PKI - Servidor

The PKI Proxy server shares the keys and certificates from a HSM 2 for different users.

Instalação

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

  2. Abra o instalador e siga o assistente de instalação.

  3. Abra o Proxy PKI no menu Iniciar. Se o tiver instalado na localização predefinida, também pode executá-lo com o seguinte comando a partir da caixa de diálogo Run ou do PowerShell.

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

    Nota

    O PKI Proxy será minimizado para a bandeja do sistema, mesmo que a janela principal esteja fechada.

Service Configuration

As instruções abaixo configuram o proxy PKI.

  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. Crie um novo utilizador clicando no botão New…. Escolha um tipo de autenticação que seja suportado por todos os clientes.

  6. Na barra de menus da janela principal, clique no botão Start para iniciar o serviço PKI Proxy.

Publish Certificates from the HSM 2

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

  1. Certifique-se de que a janela principal do Proxy PKI está aberta.

  2. Change to the Certificates tab.

  3. Clique no botão New…. Será aberta a janela Share Certificate.

  4. Clique no botão Select Certificate or Key…, no quadro Certificate da janela. Isso abrirá a janela Selecionar uma chave privada.

  5. Mudar para o separador 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. No campo de texto « PIN », introduza o PIN do seu 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. Clique no botão OK para confirmar a seleção. Isto levá-lo-á de volta à janela Share Certificate. A janela mostrará agora os detalhes do certificado selecionado.

  12. Clique no botão Adicionar…, no quadro Acesso e permissões da janela. Isto abrirá a janela Selecionar utilizador.

  13. Selecione um utilizador existente no menu pendente ou crie um novo selecionando Criar novo utilizador…. Clique no botão OK para confirmar a seleção. Se optar por criar um novo utilizador, a janela New User será mostrada em seguida.

  14. De volta à janela Share Certificate, certifique-se também de permitir apenas as operações necessárias para o certificado ou chave genérica. Isso pode ser alterado com as caixas de seleção na parte inferior do quadro Acesso e permissões.

  15. Clique no botão OK para publicar o certificado. Isto levá-lo-á de volta à janela principal do PKI Proxy.

  16. A lista de texto abaixo de Certificate Management mostra agora o certificado publicado.

Proxy PKI - Cliente

As ferramentas de cliente PKI Proxy fornecem diferentes formas de aceder às chaves partilhadas e aos certificados de um servidor PKI Proxy.

Dica

O servidor proxy PKI contém as ferramentas do cliente. Por conseguinte, a máquina que executa o servidor também pode ser um cliente para si própria.

Instalação

  1. Descarregue o PKI Proxy 2024 - Client Tools a partir do sítio Web do software /n.

  2. Abra o instalador e siga o assistente de instalação.

KSP (Key Storage Provider)

O PKI Proxy fornece um KSP para fazer a interface com o servidor PKI Proxy. O KSP permite a utilização de APIs nativas do Windows com aplicações, através da interface CNG (Cryptography API: Next Generation). Consulte a documentação do Proxy PKI ` <https://cdn.nsoftware.com/help/PK1/app/nsoftware.PKIProxy.htm#pg_runningksp>` __ para obter mais informações.

PKCS#11

O PKI Proxy fornece um módulo PKCS#11 para fazer a interface com o servidor PKI Proxy. Para mais informações, consulte a documentação PKI Proxy.