@@ -46,10 +46,11 @@ 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 ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
53
54
54
55
// generate a key pair
55
56
let ( public, private) =
@@ -93,7 +94,7 @@ fn sign_verify_eddsa() -> TestResult {
93
94
] ) ,
94
95
] ;
95
96
96
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
97
+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
97
98
98
99
let ( public, private) =
99
100
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -136,7 +137,7 @@ fn sign_verify_eddsa_with_ed25519_schemes() -> TestResult {
136
137
] ) ,
137
138
] ;
138
139
139
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
140
+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
140
141
141
142
let ( public, private) =
142
143
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -186,7 +187,7 @@ fn sign_verify_eddsa_with_ed448_schemes() -> TestResult {
186
187
] ) ,
187
188
] ;
188
189
189
- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
190
+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
190
191
191
192
let ( public, private) =
192
193
session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -1339,9 +1340,16 @@ fn rsa_pkcs_oaep_empty() -> TestResult {
1339
1340
let session = pkcs11. open_rw_session ( slot) ?;
1340
1341
session. login ( UserType :: User , Some ( & AuthPin :: new ( USER_PIN . into ( ) ) ) ) ?;
1341
1342
1342
- let pub_key_template = [ Attribute :: ModulusBits ( 2048 . into ( ) ) ] ;
1343
- let ( pubkey, privkey) =
1344
- session. generate_key_pair ( & Mechanism :: RsaPkcsKeyPairGen , & pub_key_template, & [ ] ) ?;
1343
+ let pub_key_template = [
1344
+ Attribute :: ModulusBits ( 2048 . into ( ) ) ,
1345
+ Attribute :: Encrypt ( true ) ,
1346
+ ] ;
1347
+ let priv_key_template = [ Attribute :: Decrypt ( true ) ] ;
1348
+ let ( pubkey, privkey) = session. generate_key_pair (
1349
+ & Mechanism :: RsaPkcsKeyPairGen ,
1350
+ & pub_key_template,
1351
+ & priv_key_template,
1352
+ ) ?;
1345
1353
let oaep = PkcsOaepParams :: new (
1346
1354
MechanismType :: SHA1 ,
1347
1355
PkcsMgfType :: MGF1_SHA1 ,
@@ -1509,6 +1517,7 @@ fn sign_verify_sha1_hmac() -> TestResult {
1509
1517
Attribute :: Private ( true ) ,
1510
1518
Attribute :: Sensitive ( true ) ,
1511
1519
Attribute :: Sign ( true ) ,
1520
+ Attribute :: Verify ( true ) ,
1512
1521
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1513
1522
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1514
1523
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1538,6 +1547,7 @@ fn sign_verify_sha224_hmac() -> TestResult {
1538
1547
Attribute :: Private ( true ) ,
1539
1548
Attribute :: Sensitive ( true ) ,
1540
1549
Attribute :: Sign ( true ) ,
1550
+ Attribute :: Verify ( true ) ,
1541
1551
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1542
1552
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1543
1553
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1567,6 +1577,7 @@ fn sign_verify_sha256_hmac() -> TestResult {
1567
1577
Attribute :: Private ( true ) ,
1568
1578
Attribute :: Sensitive ( true ) ,
1569
1579
Attribute :: Sign ( true ) ,
1580
+ Attribute :: Verify ( true ) ,
1570
1581
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1571
1582
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1572
1583
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1596,6 +1607,7 @@ fn sign_verify_sha384_hmac() -> TestResult {
1596
1607
Attribute :: Private ( true ) ,
1597
1608
Attribute :: Sensitive ( true ) ,
1598
1609
Attribute :: Sign ( true ) ,
1610
+ Attribute :: Verify ( true ) ,
1599
1611
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1600
1612
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1601
1613
Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1625,6 +1637,7 @@ fn sign_verify_sha512_hmac() -> TestResult {
1625
1637
Attribute :: Private ( true ) ,
1626
1638
Attribute :: Sensitive ( true ) ,
1627
1639
Attribute :: Sign ( true ) ,
1640
+ Attribute :: Verify ( true ) ,
1628
1641
Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
1629
1642
Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
1630
1643
Attribute :: ValueLen ( 256 . into( ) ) ,
0 commit comments