Refactor MechanismWithParam
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 170
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
MechanismWithParam was a hack to allow for various param mechanisms, but it doesn't scale.
mechanism_param should be removed and mechanism be replaced to allow either a CK_MECHANISM or a Mechanism class.
The default Mechanism class would be mechanism=Mechanism(CK_MECHANISM, param=...) passing mechanism=CK_MECHANISM would be equivalent to mechanism=Mechanism(CK_MECHANISM).
The Mechanism class could be inherited to provide for specific, typed mechanisms Mechanism.RSA_PKCS_PSS(params...) these would be responsible for allocating their appropriate structure in PKCS#11 and passing it as the mechanism parameter.
This is both more Pythonic, typeable (when typing is added to python-pkcs11) and allows for extension into more mechanism types, including extension outside of python-pkcs11.
See the discussion in https://github.com/danni/python-pkcs11/pull/97#discussion_r502974498 for more information.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating MechanismWithParam, mechanism_param, and the current mechanism handling, then read the discussion on pull request 97. Define how Mechanism accepts CK_MECHANISM or a Mechanism instance and how typed subclasses allocate PKCS#11 parameter structures. Done means the old mechanism_param approach is removed and the new extensible API supports the described default and subclass forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cryptography, security
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100