Im following the example here:
https://video2.skills-academy.com/en-us/windows/uwp/security/smart-cards
To initiate a smart card pin change or reset.
I can successfully enumerate readers/cards etc. and also issue certificates.
The following code executes successfully:
SmartCardProvisioning provisioning = await SmartCardProvisioning.FromSmartCardAsync(card);
var id = await provisioning.GetIdAsync();
var name = await provisioning.GetNameAsync();
var status = await card.GetStatusAsync();
But
bool result = await provisioning.RequestPinChangeAsync();
Throws COM exception
System.Runtime.InteropServices.COMException: 'Elementet blev ikke fundet. (0x80070490)'
Translates to "Element not found"
Stack trace:
StackTrace " at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)\r\n at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)\r\n at ABI.Windows.Devices.SmartCards.ISmartCardProvisioningMethods.RequestPinChangeAsync(IObjectReference _obj)\r\n at Windows.Devices.SmartCards.SmartCardProvisioning.RequestPinChangeAsync()\r\n at Liga.LocalID.Providers.CardResetProvider.<ResetPin>d__4.MoveNext() in C:\\Users\\frederik\\source\\repos\\LigaID\\LigaLocalID\\Providers\\CardResetProvider.cs:line 64" string
I am building a packaged desktop app on dotnet framework 5, referencing Microsoft.WindowsAppSDK 1.0.0 and Microsoft.Windows.SDK.BuildTools 10.0.22000.196
I have requested the "Shared User Certificates" capability in the package.appxmanifest .
<Capabilities>
<rescap:Capability Name="runFullTrust" />
<uap:Capability Name="userAccountInformation"/>
<uap:Capability Name="sharedUserCertificates"/>
</Capabilities>
and these are the dependencies:
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
Im developing in c#, Visual studio 2019 pro, on windows 10 build 19043.1415.
The smartcard is physical, GIDS/OpenSmartcard and works flawlessly with regular pkcs11 tools like pkcs11admin
So, short recap:
I am successfully enumerating smartcards and readers, issuing certificates to the cards, etc.
The problem is to get windows (the minidriver?) to display a pin change dialog.
Any help appreciated!
Kind regards
Frederik Borg