#tpm #hsm #kanidm #storage-key #pin #rs256 #es256

kanidm-hsm-crypto

A library for easily interacting with a HSM or TPM

13 releases

0.3.5 Nov 21, 2025
0.3.4 Jun 28, 2025
0.3.1 Apr 15, 2025
0.2.0 Mar 28, 2024
0.1.5 Nov 30, 2023

#255 in Cryptography

Download history 657/week @ 2025-10-03 1119/week @ 2025-10-10 1185/week @ 2025-10-17 1232/week @ 2025-10-24 961/week @ 2025-10-31 1345/week @ 2025-11-07 1318/week @ 2025-11-14 946/week @ 2025-11-21 1159/week @ 2025-11-28 650/week @ 2025-12-05 661/week @ 2025-12-12 403/week @ 2025-12-19 226/week @ 2025-12-26 919/week @ 2026-01-02 1242/week @ 2026-01-09 1289/week @ 2026-01-16

3,742 downloads per month
Used in 19 crates (3 directly)

MPL-2.0 license

150KB
3.5K SLoC

Kanidm HSM Crypto

This library allows the use of HSM's, TPM's or SoftHSM's in cryptographic applications. The goal is to simplify interactions with these devices so that applications can utilise these.

Upgrading 0.2 to 0.3

Existing soft tpm keys will continue to work during this upgrade. Most types have changed name and path to better reflect their capabilities within a TPM.

  • Tpm functionality has been broken down to specific traits allowing you to mix and match what you need.
  • Keys are separated by their cryptographic type, rather than purpose.
  • PIN's may now only be set on StorageKeys.
  • OpenSSL is no longer required as a library.
  • ES256 and RS256 can now be used with X509 Certificate requests and operations.
  • ES256 and RS256 keys no longer host/store their X509 Certificates.

Some structs have changed paths. This is not an complete list, but should give an idea about the changes.

  • kanidm_hsm_crypto::Loadable X Key -> kanidm_hsm_crypto::structures::Loadable X Key
  • kanidm_hsm_crypto::X Key -> kanidm_hsm_crypto::structures::X Key
  • kanidm_hsm_crypto::soft::SoftTpm -> kanidm_hsm_crypto::provider::SoftTpm
  • kanidm_hsm_crypto::BoxedDynTpm -> kanidm_hsm_crypto::provider::BoxedDynTpm
  • kanidm_hsm_crypto::IdentityKey -> kanidm_hsm_crypto::structures::RS256Key OR kanidm_hsm_crypto::structures::ES256Key

There are a number of aliases available to help you rename some types.

Dependencies

~20–36MB
~544K SLoC