Creating a virtual smart card in a Hyper-V guest system

For test environments, it is often helpful to be able to work with smartcards. Below is a brief guide on how to set up a virtual smartcard in a Hyper-V guest using a virtualized Trusted Platform Module (TPM).

Implementation

Do you know TameMyCerts? TameMyCerts is an add-on for the Microsoft certification authority (Active Directory Certificate Services). It extends the function of the certification authority and enables the Application of regulationsto realize the secure automation of certificate issuance. TameMyCerts is unique in the Microsoft ecosystem and is available under a free license. It can downloaded via GitHub and can be used free of charge.

The prerequisite is that a Trusted Platform Module has been installed and commissioned on the host system.

The virtual machine must be Generation 2.

In the virtual machine settings, you can then activate the Trusted Platform Module under Security.

To use the virtual smartcard in the Hyper-V guest, the "Enhanced Session" must be disabled, otherwise there will be a connection via Remote Desktop, which will pass the smartcard readers from the host system to the guest.

The virtual smartcard can then be created with the following command (as admin).

tpmvscmgr.exe create ^
    /name TestVSC ^
    /pin prompt ^
    /adminkey random ^
    /generate

During the creation of the virtual smartcard, you will be asked for a PIN, which must be at least eight characters long by default.

Related links:

External sources

en_USEnglish