@@ -112,14 +112,6 @@ public IScpYubiKeyConnection CreateScpConnection(YubiKeyApplication application,
112
112
/// </remarks>
113
113
public IYubiKeyConnection CreateConnection ( YubiKeyApplication application )
114
114
{
115
- if ( _smartCardDevice != null )
116
- {
117
- _log . LogDebug ( "Connecting via the SmartCard interface." ) ;
118
-
119
- WaitForReclaimTimeout ( Transport . SmartCard ) ;
120
- return new SmartCardConnection ( _smartCardDevice , application ) ;
121
- }
122
-
123
115
if ( _hidKeyboardDevice != null && application == YubiKeyApplication . Otp )
124
116
{
125
117
_log . LogDebug ( "Connecting via the Keyboard interface." ) ;
@@ -128,13 +120,22 @@ public IYubiKeyConnection CreateConnection(YubiKeyApplication application)
128
120
return new KeyboardConnection ( _hidKeyboardDevice ) ;
129
121
}
130
122
131
- if ( _hidFidoDevice != null && ( application == YubiKeyApplication . Fido2 || application == YubiKeyApplication . FidoU2f ) )
123
+ bool isFidoApplication = application == YubiKeyApplication . Fido2 || application == YubiKeyApplication . FidoU2f ;
124
+ if ( _hidFidoDevice != null && isFidoApplication )
132
125
{
133
126
_log . LogDebug ( "Connecting via the FIDO interface." ) ;
134
127
135
128
WaitForReclaimTimeout ( Transport . HidFido ) ;
136
129
return new FidoConnection ( _hidFidoDevice ) ;
137
130
}
131
+
132
+ if ( _smartCardDevice != null )
133
+ {
134
+ _log . LogDebug ( "Connecting via the SmartCard interface." ) ;
135
+
136
+ WaitForReclaimTimeout ( Transport . SmartCard ) ;
137
+ return new SmartCardConnection ( _smartCardDevice , application ) ;
138
+ }
138
139
139
140
throw new InvalidOperationException ( "No suitable interface present. Unable to establish connection to YubiKey." ) ;
140
141
}
0 commit comments