@@ -23,32 +23,53 @@ namespace Yubico.YubiKey.Piv
23
23
public class GenerateTests : PivSessionIntegrationTestBase
24
24
{
25
25
[ SkippableTheory ( typeof ( NotSupportedException ) ) ]
26
- [ InlineData ( KeyType . RSA1024 ) ]
27
- [ InlineData ( KeyType . RSA2048 ) ]
28
- [ InlineData ( KeyType . RSA3072 ) ]
29
- [ InlineData ( KeyType . RSA4096 ) ]
30
- [ InlineData ( KeyType . Ed25519 ) ]
31
- [ InlineData ( KeyType . X25519 ) ]
32
- [ InlineData ( KeyType . ECP256 ) ]
33
- [ InlineData ( KeyType . ECP384 ) ]
34
- [ InlineData ( KeyType . RSA1024 , true ) ]
35
- [ InlineData ( KeyType . RSA2048 , true ) ]
36
- [ InlineData ( KeyType . RSA3072 , true ) ]
37
- [ InlineData ( KeyType . RSA4096 , true ) ]
38
- [ InlineData ( KeyType . X25519 , true ) ]
39
- [ InlineData ( KeyType . Ed25519 , true ) ]
40
- [ InlineData ( KeyType . ECP256 , true ) ]
41
- [ InlineData ( KeyType . ECP384 , true ) ]
26
+ [ InlineData ( KeyType . RSA1024 , StandardTestDevice . Fw5 ) ]
27
+ [ InlineData ( KeyType . RSA2048 , StandardTestDevice . Fw5 ) ]
28
+ [ InlineData ( KeyType . RSA3072 , StandardTestDevice . Fw5 ) ]
29
+ [ InlineData ( KeyType . RSA4096 , StandardTestDevice . Fw5 ) ]
30
+ [ InlineData ( KeyType . Ed25519 , StandardTestDevice . Fw5 ) ]
31
+ [ InlineData ( KeyType . X25519 , StandardTestDevice . Fw5 ) ]
32
+ [ InlineData ( KeyType . ECP256 , StandardTestDevice . Fw5 ) ]
33
+ [ InlineData ( KeyType . ECP384 , StandardTestDevice . Fw5 ) ]
34
+
35
+ [ InlineData ( KeyType . RSA1024 , StandardTestDevice . Fw5Fips ) ]
36
+ [ InlineData ( KeyType . RSA2048 , StandardTestDevice . Fw5Fips ) ]
37
+ [ InlineData ( KeyType . RSA3072 , StandardTestDevice . Fw5Fips ) ]
38
+ [ InlineData ( KeyType . RSA4096 , StandardTestDevice . Fw5Fips ) ]
39
+ [ InlineData ( KeyType . Ed25519 , StandardTestDevice . Fw5Fips ) ]
40
+ [ InlineData ( KeyType . X25519 , StandardTestDevice . Fw5Fips ) ]
41
+ [ InlineData ( KeyType . ECP256 , StandardTestDevice . Fw5Fips ) ]
42
+ [ InlineData ( KeyType . ECP384 , StandardTestDevice . Fw5Fips ) ]
43
+
44
+ [ InlineData ( KeyType . RSA1024 , StandardTestDevice . Fw5Fips , true ) , ]
45
+ [ InlineData ( KeyType . RSA2048 , StandardTestDevice . Fw5Fips , true ) , ]
46
+ [ InlineData ( KeyType . RSA3072 , StandardTestDevice . Fw5Fips , true ) , ]
47
+ [ InlineData ( KeyType . RSA4096 , StandardTestDevice . Fw5Fips , true ) , ]
48
+ [ InlineData ( KeyType . X25519 , StandardTestDevice . Fw5Fips , true ) , ]
49
+ [ InlineData ( KeyType . Ed25519 , StandardTestDevice . Fw5Fips , true ) , ]
50
+ [ InlineData ( KeyType . ECP256 , StandardTestDevice . Fw5Fips , true ) , ]
51
+ [ InlineData ( KeyType . ECP384 , StandardTestDevice . Fw5Fips , true ) , ]
42
52
public void SimpleGenerate (
43
- KeyType expectedAlgorithm ,
53
+ KeyType keyType ,
54
+ StandardTestDevice deviceType ,
44
55
bool useScp03 = false )
45
56
{
46
57
using var pivSession = useScp03
47
58
? GetSessionScp ( )
48
59
: GetSession ( ) ;
49
60
50
- var result = pivSession . GenerateKeyPair ( PivSlot . Retired12 , expectedAlgorithm ) ;
51
- Assert . Equal ( expectedAlgorithm , result . KeyType ) ;
61
+ var pinPolicy = PivPinPolicy . Never ;
62
+ var touchPolicy = PivTouchPolicy . Never ;
63
+ if ( deviceType == StandardTestDevice . Fw5Fips )
64
+ {
65
+ FipsTestUtilities . SetFipsApprovedCredentials ( Session ) ;
66
+ pinPolicy = PivPinPolicy . Always ;
67
+ touchPolicy = PivTouchPolicy . Always ;
68
+ }
69
+
70
+ var result = Session . GenerateKeyPair ( PivSlot . Retired12 , keyType , pinPolicy , touchPolicy ) ;
71
+
72
+ Assert . Equal ( keyType , result . KeyType ) ;
52
73
}
53
74
}
54
75
}
0 commit comments