Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetching individual certificate attributes #121

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/storage/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,15 @@ impl Storage for StdStorageFormat {
/* the values don't matter, only the type */
let dnm: CK_ULONG = 0;
let mut attrs = CkAttrs::from(attributes);
/* we need CKA_CLASS and CKA_KEY_TYPE to be present in
/* we need object defining attributes to be present in
* order to get sensitive attrs from the factory later */
if attributes.len() != 0 {
attrs.add_missing_ulong(CKA_CLASS, &dnm);
/* it is safe to add CKA_KEY_TYPE even if the object
* is not a key, the attribute will simply not be returned
* in that case */
/* it is safe to add attributes even if the objects
* are not of the correct type, the attribute will simply
* not be returned in that case */
attrs.add_missing_ulong(CKA_KEY_TYPE, &dnm);
attrs.add_missing_ulong(CKA_CERTIFICATE_TYPE, &dnm);
}

let mut obj = self.store.fetch_by_uid(&uid, attrs.as_slice())?;
Expand Down