Skip to content

Add PKCS11 token support with tests and documentation#780

Closed
rajanarahul93 wants to merge 1 commit intobitcoin-core:masterfrom
rajanarahul93:feature/pkcs11-token-support
Closed

Add PKCS11 token support with tests and documentation#780
rajanarahul93 wants to merge 1 commit intobitcoin-core:masterfrom
rajanarahul93:feature/pkcs11-token-support

Conversation

@rajanarahul93
Copy link
Copy Markdown

Add PKCS11 Token Support

Description

This PR adds support for PKCS11 tokens (HSMs) with secp256k1 curve support to HWI. The implementation allows users to use PKCS11-compliant hardware security modules as Bitcoin hardware wallets.

Changes Made

  1. Added PKCS11 client implementation in hwilib/devices/pkcs11.py
  2. Created comprehensive test suite in test/test_pkcs11.py
  3. Updated test runner in test/run_tests.py to include PKCS11 tests
  4. Added documentation in README.md
  5. Added Windows-specific prerequisites and installation instructions

Features

  • Support for PKCS11 tokens with secp256k1 curve
  • Cross-platform support (Windows, Linux, macOS)
  • Full test coverage
  • Integration with existing test framework
  • Documentation and usage examples

Testing

To run the tests:

python test/run_tests.py

Usage

  1. Set environment variables:
# Windows
$env:PKCS11_LIB_PATH = "C:\path\to\your\pkcs11\library.dll"
$env:PKCS11_TOKEN_LABEL = "YourTokenLabel"

# Unix-like
export PKCS11_LIB_PATH=/path/to/your/pkcs11/library.so
export PKCS11_TOKEN_LABEL=YourTokenLabel
  1. Use with HWI:
hwi --device-type pkcs11 --path /path/to/library.so getmasterxpub

Dependencies

  • python-pkcs11>=0.7.0
  • OpenSSL development libraries
  • Visual Studio Build Tools (Windows)

Related Issues

Closes #774

@rajanarahul93 rajanarahul93 closed this by deleting the head repository May 6, 2025
@embetrix
Copy link
Copy Markdown

embetrix commented Sep 1, 2025

@rajanarahul93 any good reason why this PR was closed ? It's a real add up !

@rajanarahul93
Copy link
Copy Markdown
Author

@embetrix Thanks for pointing that out! I closed it unintentionally when I deleted my fork. I’ll restore the branch and reopen the PR so we can continue the review.

@embetrix
Copy link
Copy Markdown

any update on this ?

@rajanarahul93
Copy link
Copy Markdown
Author

rajanarahul93 commented Nov 21, 2025

@embetrix , I have created a replica PR #806

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.

pkcs11 token support

2 participants