@@ -46,10 +46,11 @@ fn sign_verify() -> TestResult {
4646 Attribute :: Private ( false ) ,
4747 Attribute :: PublicExponent ( public_exponent) ,
4848 Attribute :: ModulusBits ( modulus_bits. into( ) ) ,
49+ Attribute :: Verify ( true ) ,
4950 ] ;
5051
5152 // priv key template
52- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
53+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
5354
5455 // generate a key pair
5556 let ( public, private) =
@@ -93,7 +94,7 @@ fn sign_verify_eddsa() -> TestResult {
9394 ] ) ,
9495 ] ;
9596
96- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
97+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
9798
9899 let ( public, private) =
99100 session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -136,7 +137,7 @@ fn sign_verify_eddsa_with_ed25519_schemes() -> TestResult {
136137 ] ) ,
137138 ] ;
138139
139- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
140+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
140141
141142 let ( public, private) =
142143 session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -186,7 +187,7 @@ fn sign_verify_eddsa_with_ed448_schemes() -> TestResult {
186187 ] ) ,
187188 ] ;
188189
189- let priv_key_template = vec ! [ Attribute :: Token ( true ) ] ;
190+ let priv_key_template = vec ! [ Attribute :: Token ( true ) , Attribute :: Sign ( true ) ] ;
190191
191192 let ( public, private) =
192193 session. generate_key_pair ( & mechanism, & pub_key_template, & priv_key_template) ?;
@@ -1339,9 +1340,16 @@ fn rsa_pkcs_oaep_empty() -> TestResult {
13391340 let session = pkcs11. open_rw_session ( slot) ?;
13401341 session. login ( UserType :: User , Some ( & AuthPin :: new ( USER_PIN . into ( ) ) ) ) ?;
13411342
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+ ) ?;
13451353 let oaep = PkcsOaepParams :: new (
13461354 MechanismType :: SHA1 ,
13471355 PkcsMgfType :: MGF1_SHA1 ,
@@ -1509,6 +1517,7 @@ fn sign_verify_sha1_hmac() -> TestResult {
15091517 Attribute :: Private ( true ) ,
15101518 Attribute :: Sensitive ( true ) ,
15111519 Attribute :: Sign ( true ) ,
1520+ Attribute :: Verify ( true ) ,
15121521 Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
15131522 Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
15141523 Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1538,6 +1547,7 @@ fn sign_verify_sha224_hmac() -> TestResult {
15381547 Attribute :: Private ( true ) ,
15391548 Attribute :: Sensitive ( true ) ,
15401549 Attribute :: Sign ( true ) ,
1550+ Attribute :: Verify ( true ) ,
15411551 Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
15421552 Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
15431553 Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1567,6 +1577,7 @@ fn sign_verify_sha256_hmac() -> TestResult {
15671577 Attribute :: Private ( true ) ,
15681578 Attribute :: Sensitive ( true ) ,
15691579 Attribute :: Sign ( true ) ,
1580+ Attribute :: Verify ( true ) ,
15701581 Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
15711582 Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
15721583 Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1596,6 +1607,7 @@ fn sign_verify_sha384_hmac() -> TestResult {
15961607 Attribute :: Private ( true ) ,
15971608 Attribute :: Sensitive ( true ) ,
15981609 Attribute :: Sign ( true ) ,
1610+ Attribute :: Verify ( true ) ,
15991611 Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
16001612 Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
16011613 Attribute :: ValueLen ( 256 . into( ) ) ,
@@ -1625,6 +1637,7 @@ fn sign_verify_sha512_hmac() -> TestResult {
16251637 Attribute :: Private ( true ) ,
16261638 Attribute :: Sensitive ( true ) ,
16271639 Attribute :: Sign ( true ) ,
1640+ Attribute :: Verify ( true ) ,
16281641 Attribute :: KeyType ( KeyType :: GENERIC_SECRET ) ,
16291642 Attribute :: Class ( ObjectClass :: SECRET_KEY ) ,
16301643 Attribute :: ValueLen ( 256 . into( ) ) ,
0 commit comments