From e4b3319766f7c5aff3dc3d77ce8af094c1b5c056 Mon Sep 17 00:00:00 2001 From: Oscar Virot Date: Fri, 3 Jan 2025 10:21:32 +0100 Subject: [PATCH 1/2] Fix small bug in SetYubikeyFIDO2 -ForcePINChange Comment out unimplmeneted KeyEntryRequest.ChangePivPin in keyCollector --- Module/Cmdlets/Fido/SetYubikeyFIDO2.cs | 5 ++++- Module/support/YKKeyCollector.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Module/Cmdlets/Fido/SetYubikeyFIDO2.cs b/Module/Cmdlets/Fido/SetYubikeyFIDO2.cs index 7e2a36b..66616d8 100644 --- a/Module/Cmdlets/Fido/SetYubikeyFIDO2.cs +++ b/Module/Cmdlets/Fido/SetYubikeyFIDO2.cs @@ -151,8 +151,11 @@ protected override void ProcessRecord() { // Use TrySetPinConfig to enable Force PIN Change. bool? forceChangePin = true; - if (!fido2Session.TrySetPinConfig(null, null, forceChangePin)) + if (fido2Session.TrySetPinConfig(null, null, forceChangePin)) + { WriteObject("Force PIN change set."); + } + else { // Throw an exception if applying the setting fails. throw new InvalidOperationException("Failed to enforce PIN change."); diff --git a/Module/support/YKKeyCollector.cs b/Module/support/YKKeyCollector.cs index 362fa9d..d50ebc4 100644 --- a/Module/support/YKKeyCollector.cs +++ b/Module/support/YKKeyCollector.cs @@ -102,7 +102,7 @@ public bool YKKeyCollectorDelegate(KeyEntryData keyEntryData) break; case KeyEntryRequest.ChangePivPin: throw new NotImplementedException("Change PIV PIN is not yet implemented"); - break; + //break; case KeyEntryRequest.SetFido2Pin: keyEntryData.SubmitValue(System.Text.Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(Marshal.SecureStringToGlobalAllocUnicode(YubiKeyModule._fido2PINNew!))!)); break; From b622d2afc9137758bb1c191599b80990c224ce74 Mon Sep 17 00:00:00 2001 From: Oscar Virot Date: Fri, 3 Jan 2025 10:23:53 +0100 Subject: [PATCH 2/2] fix formating --- Module/support/YKKeyCollector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Module/support/YKKeyCollector.cs b/Module/support/YKKeyCollector.cs index d50ebc4..47fecc3 100644 --- a/Module/support/YKKeyCollector.cs +++ b/Module/support/YKKeyCollector.cs @@ -102,7 +102,7 @@ public bool YKKeyCollectorDelegate(KeyEntryData keyEntryData) break; case KeyEntryRequest.ChangePivPin: throw new NotImplementedException("Change PIV PIN is not yet implemented"); - //break; + //break; case KeyEntryRequest.SetFido2Pin: keyEntryData.SubmitValue(System.Text.Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(Marshal.SecureStringToGlobalAllocUnicode(YubiKeyModule._fido2PINNew!))!)); break;