Virtual Smart Card creation - 'Element not found. (Exception from HRESULT: 0x80070490)'

2

I'm having an issue regarding Virtual Smart Card creation. RequestVirtualSmartCardCreationAsync() is throwing a strange exception. I'm attaching snippet of code.

public async void ScenarioCreateTpmVirtualSmartCard()
    {
        IBuffer adminKey = CryptographicBuffer.CreateFromByteArray(
        new byte[] {
             0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
             0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
             0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
        });
        SmartCardPinPolicy pinPolicy = new SmartCardPinPolicy()
        {
            MinLength = 8,
            MaxLength = 127,
            LowercaseLetters = SmartCardPinCharacterPolicyOption.Allow,
            UppercaseLetters = SmartCardPinCharacterPolicyOption.Allow,
            Digits = SmartCardPinCharacterPolicyOption.Allow,
            SpecialCharacters = SmartCardPinCharacterPolicyOption.Allow
        };
        SmartCardProvisioning cardProvisioning = await SmartCardProvisioning.RequestVirtualSmartCardCreationAsync(
        "Contoso Virtual Smart Card", adminKey, pinPolicy, Guid.NewGuid());
        if (cardProvisioning == null)
            return;
    }

The problem is that when I run this method, I get System.Exception saying

Element not found. (Exception from HResult:0x80070490)

I'm using VS 2017 and I'm running this example on Windows 10. Any help would be really appreciated...

c#
smartcard
tpm
asked on Stack Overflow Feb 4, 2019 by Tomislav Šimović • edited Feb 4, 2019 by alnorth29

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0