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

Use Builder Pattern for HsmKeyParams #155

Closed
wants to merge 9 commits into from
Closed

Conversation

cps-b
Copy link
Contributor

@cps-b cps-b commented Oct 30, 2023

Adapt the HsmKeyParams to use a Builder Pattern instead of a struct

@cps-b cps-b marked this pull request as ready for review October 30, 2023 11:50
public:
class Builder;

bool isExtractable() const { return cka_extractable; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to expose PKCS#11 slang here? Wouldn't it be better if this provides some Abstraction and we say here that the param is that the is is extractable or not? Sensitive is really not self-explanatory.

src/hsm.cpp Outdated
@@ -233,7 +234,8 @@ openssl::SSL_EVP_PKEY_Ptr HsmEngine::generateKey(const ECCSpec &spec,
const std::string &keyLabel,
const std::vector<uint8_t> &keyID)
{
HsmKeyParams hsmKeyParams;
HsmKeyParams hsmKeyParams =
HsmKeyParams::Builder().setCkaExtractable(false).setCkaSensitive(true).build();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Most of the library uses {} for object construction.

garw
garw previously requested changes Oct 31, 2023
Copy link
Member

@garw garw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks cleaner to me now. Feel free to merge after the consistency problem has been fixed.

src/mococrw/hsm.h Outdated Show resolved Hide resolved
@cps-b
Copy link
Contributor Author

cps-b commented Nov 10, 2023

Merging in PR #156

@cps-b cps-b closed this Nov 10, 2023
@cps-b cps-b deleted the cka-attributes-builder branch November 13, 2023 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants