I see many people using softhsm just for encryption / decryption rather than using openssl.When I ask people they reply softhsm is more secure. Can anyone say in what ways softhsm is more secure.

  • 8
    I've never heard of such a claim. Please provide sources for it. If you just "heard" from others then please ask the ones you've heard from to back their claim with more details. In general a HSM is more secure because the private key is protected by hardware and critical operations are only executed on the protected hardware so that the private key cannot be stolen. Only, this is not true with SoftHSM which only provides the API to behave like a real HSM but does not provide the protection expected by a real HSM. Commented Feb 25, 2019 at 4:39

2 Answers 2


SoftHSM does not do the same functions as OpenSSL. People aren’t “choosing” SoftHSM over OpenSSL, as they do different things.

Note that SoftHSM can be linked with the OpenSSL libraries to implement the cryptography internally, meaning that at best its overall security can be no better than that of the OpenSSL libraries themselves.

SoftHSM is also not more secure than an actual Hardware Security Module (HSM). Any keys stored in it are visible in some way to the host computer. By contrast, an actual HSM is designed with physical security in mind, and it will not allow a key to be exported or exposed. For example, an HSM is equipped with tamper-detection circuitry such that it will destroy any keys it contains rather than allowing someone to open the case and sniff out the keys with a logic probe.

Any differences you are seeing in use between using SoftHSM and a true HSM are almost certainly due to cost. SoftHSM is an open source implementation of a PKCS#11 service, and costs virtually nothing to test with and use. A true PKCS#11 commercial HSM can cost many thousands of dollars, and have even more costs for licensing, support contracts, installation, etc.

If you need to test a piece of software against a PKCS#11 server, SoftHSM is a cheap way to accomplish your task. OpenSSL doesn’t offer a PKCS#11 interface, so it’s not like they can use it as a substitute. But never think that SoftHSM is as secure as an HSM.

  • I think one thing it does is increase the security of the ecosystem by allowing code to be written with only the PKCS#11 interface and have it work on pure software, TPM, and HSM systems. It reduces client software complexity, and it allows an easy way to upgrade to HSM.
    – user71659
    Commented Feb 25, 2019 at 23:48
  • There is at least one PKCS#11 bridge underneath an OpenSSL engine (OpenSC's PKCS#11 provider bridge). You can use that with several different PKCS#11 providers, for different HSMs, smart cards, etc. There is still the problem of knowing whether the underlying device supports the PKCS#11 mechanisms needed, but that's beyond the scope of a comment....
    – rip...
    Commented Mar 1, 2019 at 4:48

If you mean a software "HSM” (Hardware Security Module), it is a contradiction in terms. HSM reason is to have a SAFE VAULT where sensitive information cannot be accessible by outside (e.g. smartcard with it's private key container)

By the way, you can have a "Software Security Module" that offer you a set of cryptographic functionalities (like openssl library) plus extra functionalities like store sensitive information in safe area (vault) and tools to handle them without access them directly (e.g. crypt/decrypt without access to the key).

How much "safe" is a Software Security Module? As much as software can be. There are no specific reason to choose “Software Security Module" vs other cryptographic libraries just for cryptographic functionalities.

Not the answer you're looking for? Browse other questions tagged .