@@ -738,6 +738,42 @@ public void Validate_Slot_Allow_if_Wrong_slot_is_denied_10020()
738738 Assert . False ( result . DeniedForIssuance ) ;
739739 PrintResult ( result ) ;
740740
741+ output . WriteLine ( policy . SaveToString ( ) ) ;
742+ }
743+ [ Fact ]
744+ public void Validate_Slot_with_0x_10021 ( )
745+ {
746+ CertificateDatabaseRow dbRow = new CertificateDatabaseRow ( _yubikey_valid_5_4_3_Once_Never_UsbAKeychain_9a_Normal_RSA_2048_CSR , CertCli . CR_IN_PKCS10 , null , 10020 ) ;
747+ CertificateRequestPolicy policy = _policy ;
748+ var result = new CertificateRequestValidationResult ( dbRow ) ;
749+
750+ // Required slot 0x9a, which needs to match 9a
751+ policy = _policy ;
752+ policy . YubikeyPolicy [ 0 ] . Slot = new List < string > { "0x9a" } ;
753+ result = new CertificateRequestValidationResult ( dbRow ) ;
754+ result = _YKvalidator . ExtractAttestion ( result , _policy , dbRow , out var yubikeyInfo ) ;
755+ result = _YKvalidator . VerifyRequest ( result , policy , yubikeyInfo , dbRow . RequestID ) ;
756+ Assert . False ( result . DeniedForIssuance ) ;
757+ PrintResult ( result ) ;
758+
759+ output . WriteLine ( policy . SaveToString ( ) ) ;
760+ }
761+ [ Fact ]
762+ public void Validate_Slot_incorrect_with_0x_10022 ( )
763+ {
764+ CertificateDatabaseRow dbRow = new CertificateDatabaseRow ( _yubikey_valid_5_4_3_Once_Never_UsbAKeychain_9a_Normal_RSA_2048_CSR , CertCli . CR_IN_PKCS10 , null , 10020 ) ;
765+ CertificateRequestPolicy policy = _policy ;
766+ var result = new CertificateRequestValidationResult ( dbRow ) ;
767+
768+ // Should not match the csr which is 9A
769+ policy = _policy ;
770+ policy . YubikeyPolicy [ 0 ] . Slot = new List < string > { "0x9e" } ;
771+ result = new CertificateRequestValidationResult ( dbRow ) ;
772+ result = _YKvalidator . ExtractAttestion ( result , _policy , dbRow , out var yubikeyInfo ) ;
773+ result = _YKvalidator . VerifyRequest ( result , policy , yubikeyInfo , dbRow . RequestID ) ;
774+ Assert . True ( result . DeniedForIssuance ) ;
775+ PrintResult ( result ) ;
776+
741777 output . WriteLine ( policy . SaveToString ( ) ) ;
742778 }
743779 }
0 commit comments