Skip to content

Commit 4b44830

Browse files
committed
tests: Reproducer for empty AllowedMechanisms issue with SoftHSM
Signed-off-by: Jakub Jelen <[email protected]>
1 parent 2702bba commit 4b44830

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cryptoki/tests/basic.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ fn import_export() -> TestResult {
10841084
Attribute::Class(ObjectClass::PUBLIC_KEY),
10851085
Attribute::KeyType(KeyType::RSA),
10861086
Attribute::Verify(true),
1087+
Attribute::AllowedMechanisms(Vec::<MechanismType>::new()),
10871088
];
10881089

10891090
{
@@ -1113,6 +1114,16 @@ fn import_export() -> TestResult {
11131114
panic!("Expected the Modulus attribute.");
11141115
}
11151116

1117+
let attr = session
1118+
.get_attributes(is_it_the_public_key, &[AttributeType::AllowedMechanisms])?
1119+
.remove(0);
1120+
1121+
if let Attribute::AllowedMechanisms(v) = attr {
1122+
assert_eq!(v, Vec::<MechanismType>::new());
1123+
} else {
1124+
panic!("Expected the AllowedMechanisms attribute.");
1125+
}
1126+
11161127
// delete key
11171128
session.destroy_object(is_it_the_public_key)?;
11181129

0 commit comments

Comments
 (0)