8000 Change PIN Parameter type from string to []byte · Issue #184 · miekg/pkcs11 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Change PIN Parameter type from string to []byte #184

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

Open
basrach opened this issue May 26, 2025 · 2 comments
8000
Open

Change PIN Parameter type from string to []byte #184

basrach opened this issue May 26, 2025 · 2 comments

Comments

@basrach
Copy link
basrach commented May 26, 2025

Currently, the PIN is passed as a string, making it impossible to legally overwrite the PIN in memory after use. When sensitive data like a PIN is passed as a string, it may remain in memory longer than necessary and could be exposed in a memory dump.

Proposal:
Change the PIN parameter type from string to []byte. This would allow the caller to manually zero out the PIN after use, improving control over sensitive data and aligning the library with secure coding practices.

Would the maintainers consider this change? I’d be glad to assist with implementation if needed.

@miekg
Copy link
Owner
miekg commented May 26, 2025

regardless of 'keeping in memory' (i think there are some dirty tricks in go to remove a string more quickly), this would be a backward incompatible change, which would imply a v2, which isn't planned

@basrach
Copy link
Author
basrach commented May 26, 2025

For go string i know trick. But currently, an additional copy of the value is created when passing it to C, and I’m not aware of any trick to avoid or clean up that one.

Understood about v2 — but what about v3?

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

No branches or pull requests

2 participants
0