@@ -46,10 +46,14 @@ fn sign_verify() -> TestResult {
46
46
Attribute :: Private ( false ) ,
47
47
Attribute :: PublicExponent ( public_exponent) ,
48
48
Attribute :: ModulusBits ( modulus_bits. into( ) ) ,
49
+ Attribute :: Verify ( true ) ,
49
50
] ;
50
51
51
52
// priv key template
52
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
53
+ let priv_key_template = vec ! [
54
+ Attribute :: Token ( true ) ,
55
+ Attribute :: Sign ( true ) ,
56
+ ] ;
53
57
54
58
// generate a key pair
55
59
let ( public, private) =
@@ -93,7 +97,10 @@ fn sign_verify_eddsa() -> TestResult {
93
97
] ) ,
94
98
] ;
95
99
96
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
100
+ let priv_key_template = vec ! [
101
+ Attribute :: Token ( true ) ,
102
+ Attribute :: Sign ( true ) ,
103
+ ] ;
97
104
98
105
let ( public, private) =
99
106
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -136,7 +143,10 @@ fn sign_verify_eddsa_with_ed25519_schemes() -> TestResult {
136
143
] ) ,
137
144
] ;
138
145
139
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
146
+ let priv_key_template = vec ! [
147
+ Attribute :: Token ( true ) ,
148
+ Attribute :: Sign ( true ) ,
149
+ ] ;
140
150
141
151
let ( public, private) =
142
152
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -186,7 +196,10 @@ fn sign_verify_eddsa_with_ed448_schemes() -> TestResult {
186
196
] ) ,
187
197
] ;
188
198
189
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
199
+ let priv_key_template = vec ! [
200
+ Attribute :: Token ( true ) ,
201
+ Attribute :: Sign ( true ) ,
202
+ ] ;
190
203
191
204
let ( public, private) =
192
205
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -1339,9 +1352,10 @@ fn rsa_pkcs_oaep_empty() -> TestResult {
1339
1352
let session = pkcs11. open_rw_session ( slot) ?;
1340
1353
session. login ( UserType :: User , Some ( & AuthPin :: new ( USER_PIN . into ( ) ) ) ) ?;
1341
1354
1342
- let pub_key_template = [ Attribute :: ModulusBits ( 2048 . into ( ) ) ] ;
1355
+ let pub_key_template = [ Attribute :: ModulusBits ( 2048 . into ( ) ) , Attribute :: Encrypt ( true ) ] ;
1356
+ let priv_key_template = [ Attribute :: Decrypt ( true ) ] ;
1343
1357
let ( pubkey, privkey) =
1344
- session. generate_key_pair ( & Mechanism :: RsaPkcsKeyPairGen , & pub_key_template, & [ ] ) ?;
1358
+ session. generate_key_pair ( & Mechanism :: RsaPkcsKeyPairGen , & pub_key_template, & priv_key_template ) ?;
1345
1359
let oaep = PkcsOaepParams :: new (
1346
1360
MechanismType :: SHA1 ,
1347
1361
PkcsMgfType :: MGF1_SHA1 ,
@@ -1509,6 +1523,7 @@ fn sign_verify_sha1_hmac() -> TestResult {
1509
1523
Attribute :: Private ( true ) ,
1510
1524
Attribute :: Sensitive ( true ) ,
1511
1525
Attribute :: Sign ( true ) ,
1526
+ Attribute :: Verify ( true ) ,
1512
1527
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1513
1528
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1514
1529
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1538,6 +1553,7 @@ fn sign_verify_sha224_hmac() -> TestResult {
1538
1553
Attribute :: Private ( true ) ,
1539
1554
Attribute :: Sensitive ( true ) ,
1540
1555
Attribute :: Sign ( true ) ,
1556
+ Attribute :: Verify ( true ) ,
1541
1557
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1542
1558
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1543
1559
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1567,6 +1583,7 @@ fn sign_verify_sha256_hmac() -> TestResult {
1567
1583
Attribute :: Private ( true ) ,
1568
1584
Attribute :: Sensitive ( true ) ,
1569
1585
Attribute :: Sign ( true ) ,
1586
+ Attribute :: Verify ( true ) ,
1570
1587
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1571
1588
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1572
1589
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1596,6 +1613,7 @@ fn sign_verify_sha384_hmac() -> TestResult {
1596
1613
Attribute :: Private ( true ) ,
1597
1614
Attribute :: Sensitive ( true ) ,
1598
1615
Attribute :: Sign ( true ) ,
1616
+ Attribute :: Verify ( true ) ,
1599
1617
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1600
1618
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1601
1619
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1625,6 +1643,7 @@ fn sign_verify_sha512_hmac() -> TestResult {
1625
1643
Attribute :: Private ( true ) ,
1626
1644
Attribute :: Sensitive ( true ) ,
1627
1645
Attribute :: Sign ( true ) ,
1646
+ Attribute :: Verify ( true ) ,
1628
1647
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1629
1648
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1630
1649
Attribute :: ValueLen ( 256 . into( ) ) ,
0 commit comments