Coder Social home page Coder Social logo

webhsm's Introduction

webhsm by HyperifyIO: Revolutionizing Web Application Security

webhsm contributes to HyperifyIO's broader vision of enhancing digital security through innovative solutions for custom Public Key Infrastructure (PKI). As a pivotal element of our security toolkit, it addresses the critical need for secure cryptographic operations within web applications.

Reinventing Cryptographic Security for the Web

webhsm offers a groundbreaking SoftHSM solution tailored for the unique challenges of web environments. It provides a PKCS#11 compatible API that allows web applications to securely manage cryptographic private keys inside the browser's IndexDB. The genius of webhsm lies in its novel approach to securing sensitive information: it prevents direct access by front-end applications, requiring the use of its PKCS#11 API for any cryptographic actions.

Architectural Innovation

At the core of webhsm's security model is its ability to operate in a distinct cross-origin context, ensuring that cryptographic keys and operations are securely isolated from the main application. This is achieved through a combination of iframes and web workers, with the latter running Go-compiled WebAssembly (wasm) to perform cryptographic tasks. This innovative architecture not only enhances security but also maintains the integrity of the cryptographic operations.

Mission-Critical Security

The primary mission of webhsm is to lay the foundation for mutual TLS (mTLS) in client-side applications, enabling the secure management and storage of client x509 certificates and their private keys. This is essential for establishing secure client-server communications within web applications, making webhsm an indispensable tool for developers looking to bolster their app's security.

Development

See PKCS11 Compatibility. We organize our work in a simple Project (or use case) -> Task -> Subtask hierarchy.

Features

  • PKCS#11 Compatible API: Enables standard cryptographic operations, ensuring compatibility with existing security protocols. See PKCS11 Compatibility Backlog for current development status in webhsm.
  • Secure Key Storage: Leverages the browser's IndexDB for storing cryptographic keys, with enhanced security measures to prevent direct access by front-end code.
  • Isolated Execution Environment: Utilizes cross-origin iframes and web workers to segregate cryptographic operations from the main application, safeguarding against unauthorized access.
  • WebAssembly (wasm) Support: Employs Go-compiled wasm for executing cryptographic operations, combining performance with portability.

Getting Started

(TODO: Detailed instructions on setting up webhsm, including any prerequisites, installation steps, and a basic usage guide, would be provided here.)

Contribution

We welcome contributions to webhsm! Whether you're interested in improving existing functionality, or reporting issues, your input is invaluable to the project.

You can join our community at Discord.

License

webhsm is available under the Functional Source License, Version 1.1, MIT Future License (FSL-1.1-MIT), allowing use, copying, modification, and redistribution for permitted purposes, excluding competing uses. Two years post-release, the software will also be available under MIT license terms. Refer to the LICENSE.md file for complete license details.

Support

For support or further inquiries, particularly regarding the SaaS offering and its suitability for securing private services and embedded application connections, please contact us directly at [email protected].

webhsm's People

Contributors

thejhh avatar

Watchers

 avatar

webhsm's Issues

TASK PKCS11 FindObjectsFinal

Signature: FindObjectsFinal(sh pkcs11.SessionHandle) error

PKCS11 Object Management

Subtasks

  • Implement FindObjectsFinal

TASK PKCS11 CloseAllSessions

Signature: CloseAllSessions(slotID uint) error

Related to PKCS11 Token and Session Management

Subtasks

  • Implement CloseAllSessions

TASK PKCS11 Decrypt

Signature: Decrypt(sh pkcs11.SessionHandle, cipher []byte) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement Decrypt

TASK PKCS11 VerifyRecover

Signature: VerifyRecover(sh pkcs11.SessionHandle, signature []byte) ([]byte, error)

Related to PKCS11 Signing and Verification

Subtasks

  • Implement VerifyRecover

TASK PKCS11 EncryptInit

Signature: EncryptInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, o pkcs11.ObjectHandle)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement EncryptInit

PKCS11 Compatibility

PKCS11 Compatibility for webhsm

This issue serves as a comprehensive backlog for integrating PKCS11 compatibility within webhsm. It outlines the use cases and tasks required to achieve full support for PKCS11 operations. These tasks will be addressed as they become relevant to use cases or as prioritized by the project's needs.

The completion of this list signifies full PKCS11 support within webhsm, enabling secure cryptographic operations and key management directly from web applications.

Use cases

Commercial Prioritization

Should you require prioritization for specific use cases within this list, please feel free to contact our sales team. We are open to discussing commercial engagements to expedite the development of prioritized features.

TASK PKCS11 SignRecover

Signature: SignRecover(sh pkcs11.SessionHandle, data []byte) ([]byte, error)

Related to PKCS11 Signing and Verification

Subtasks

  • Implement SignRecover

TASK PKCS11 FindObjectsInit

Signature: FindObjectsInit(sh pkcs11.SessionHandle, temp []*pkcs11.Attribute) error

PKCS11 Object Management

Subtasks

  • Implement FindObjectsInit

mTLS

Goal

Create an MVP using webhsm to safeguard private keys for mTLS and manage PKI x509 certificates efficiently.

Application Example in Browser Environment

This use case will boost web security by enabling PKCS11 support for mTLS directly in browsers, for apps using WebAssembly (wasm), JavaScript, TypeScript, or web workers. It integrates smoothly with web ecosystems, enhancing secure communications.

Our additional library (TODO:link) makes setting up mTLS from wasm straightforward, allowing for secure, flexible communications with tailored certificates. This is key for sectors like finance and healthcare, where security and privacy are critical. webhsm helps developers establish secure mTLS connections, ensuring mutual client-server authentication and reducing risks like data breaches and man-in-the-middle attacks.

Imagine a virtual server running through a hypervizor like QEMU. It can leverage mTLS to securely authenticate VNC users -- which is already supported out of the box. With our webhsm and webtcp it is possible to integrate web based VNC client like novnc to directly access the QEMU using end-to-end encrypted connection over mTLS connection.

Tasks

TASK PKCS11 SignFinal

Signature: SignFinal(sh pkcs11.SessionHandle) ([]byte, error)

Related to PKCS11 Signing and Verification

Subtasks

  • Implement SignFinal

TASK PKCS11 DeriveKey

Signature: DeriveKey(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, basekey pkcs11.ObjectHandle, a []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

Related to PKCS11 Key Management

Subtasks

  • Implement DeriveKey

TASK PKCS11 CopyObject

Signature: CopyObject(sh pkcs11.SessionHandle, o pkcs11.ObjectHandle, temp []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

Related to PKCS11 Object Management

Subtasks

  • Implement CopyObject

TASK PKCS11 Encrypt

Signature: Encrypt(sh pkcs11.SessionHandle, message []byte) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement Encrypt

TASK PKCS11 DigestFinal

Signature: DigestFinal(sh pkcs11.SessionHandle) ([]byte, error)

Related to PKCS11 Digesting

Subtasks

  • Implement DigestFinal

TASK PKCS11 VerifyRecoverInit

Signature: VerifyRecoverInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, key pkcs11.ObjectHandle) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement VerifyRecoverInit

TASK PKCS11 SignRecoverInit

Signature: SignRecoverInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, key pkcs11.ObjectHandle) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement SignRecoverInit

TASK PKCS11 Logout

Signature: Logout(sh pkcs11.SessionHandle) error

PKCS11 Token and Session Management

Subtasks

  • Implement Logout

TASK PKCS11 GetObjectSize

Signature: GetObjectSize(sh pkcs11.SessionHandle, oh pkcs11.ObjectHandle) (uint, error)

Related to PKCS11 Object Management

Subtasks

  • Implement GetObjectSize

TASK PKCS11 SetAttributeValue

Signature: SetAttributeValue(sh pkcs11.SessionHandle, o pkcs11.ObjectHandle, a []*pkcs11.Attribute) error

PKCS11 Object Management

Subtasks

  • Implement SetAttributeValue

TASK PKCS11 GetSessionInfo

Signature: GetSessionInfo(sh pkcs11.SessionHandle) (pkcs11.SessionInfo, error)

Related to PKCS11 Token and Session Management

Subtasks

  • Implement GetSessionInfo

TASK PKCS11 VerifyFinal

Signature: VerifyFinal(sh pkcs11.SessionHandle, signature []byte) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement VerifyFinal

TASK PKCS11 GenerateKeyPair

Signature: GenerateKeyPair(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, public, private []*pkcs11.Attribute) (pkcs11.ObjectHandle, pkcs11.ObjectHandle, error)

Part of PKCS11 Key Management.

Goal

To create new key pairs (public and private keys) for your certificates. The private key stays within the HSM for security, while the public key is used in the certificate signing request (CSR).

Subtasks

  • Implement GenerateKeyPair

TASK PKCS11 EncryptUpdate

Signature: EncryptUpdate(sh pkcs11.SessionHandle, plain []byte) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement EncryptUpdate

TASK PKCS11 UnwrapKey

Signature: UnwrapKey(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, unwrappingkey pkcs11.ObjectHandle, wrappedkey []byte, a []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

Related to PKCS11 Key Management

Subtasks

  • Implement UnwrapKey

TASK PKCS11 DigestUpdate

Signature: DigestUpdate(sh pkcs11.SessionHandle, message []byte) error

Related to PKCS11 Digesting

Subtasks

  • Implement DigestUpdate

TASK PKCS11 CreateObject

Signature: CreateObject(sh pkcs11.SessionHandle, temp []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

PKCS11 Object Management

Subtasks

  • Implement CreateObject

TASK PKCS11 Digest

Signature: Digest(sh pkcs11.SessionHandle, message []byte) ([]byte, error)

Related to PKCS11 Digesting

Subtasks

  • Implement Digest

TASK PKCS11 DecryptInit

Signature: DecryptInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, o pkcs11.ObjectHandle) error

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement DecryptInit

TASK PKCS11 FindObjects

Signature: FindObjects(sh pkcs11.SessionHandle, max int) ([]pkcs11.ObjectHandle, bool, error)

PKCS11 Object Management

Subtasks

  • Implement FindObjects

TASK PKCS11 CloseSession

Signature: CloseSession(sh pkcs11.SessionHandle) error

PKCS11 Token and Session Management

Subtasks

  • Implement CloseSession

TASK PKCS11 DestroyObject

Signature: DestroyObject(sh pkcs11.SessionHandle, oh pkcs11.ObjectHandle) error

PKCS11 Object Management

Subtasks

  • Implement DestroyObject

TASK PKCS11 SignUpdate

Signature: SignUpdate(sh pkcs11.SessionHandle, message []byte) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement SignUpdate

TASK PKCS11 Login

Signature: Login(sh pkcs11.SessionHandle, userType uint, pin string) error

PKCS11 Token and Session Management

Subtasks

  • Implement Login

TASK PKCS11 SeedRandom

Signature: SeedRandom(sh pkcs11.SessionHandle, seed []byte) error

Related to PKCS11 Random Number Generation

Subtasks

  • Implement SeedRandom

TASK PKCS11 EncryptFinal

Signature: EncryptFinal(sh pkcs11.SessionHandle) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement EncryptFinal

TASK PKCS11 DecryptFinal

Signature: DecryptFinal(sh pkcs11.SessionHandle) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement DecryptFinal

TASK PKCS11 GenerateKey

Signature: GenerateKey(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, temp []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

Related to PKCS11 Key Management

Subtasks

  • Implement GenerateKey

TASK PKCS11 VerifyInit

Signature: VerifyInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, key pkcs11.ObjectHandle) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement VerifyInit

TASK PKCS11 Verify

Signature: Verify(sh pkcs11.SessionHandle, data []byte, signature []byte) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement Verify

TASK PKCS11 DigestInit

Signature: DigestInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism) error

Related to PKCS11 Digesting

Subtasks

  • Implement DigestInit

TASK PKCS11 DigestKey

Signature: DigestKey(sh pkcs11.SessionHandle, key pkcs11.ObjectHandle) error

Related to PKCS11 Digesting

Subtasks

  • Implement DigestKey

TASK PKCS11 Sign

Signature: Sign(sh pkcs11.SessionHandle, message []byte)

Related to PKCS11 Signing and Verification

Subtasks

  • Implement Sign

TASK PKCS11 SignInit

Signature: SignInit(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, o pkcs11.ObjectHandle) error

PKCS11 Signing and Verification

Subtasks

  • Implement SignInit

TASK PKCS11 WrapKey

Signature: WrapKey(sh pkcs11.SessionHandle, m []*pkcs11.Mechanism, wrappingkey, key pkcs11.ObjectHandle) ([]byte, error)

Related to PKCS11 Key Management

Subtasks

  • Implement WrapKey

TASK PKCS11 GetAttributeValue

Signature: GetAttributeValue(sh pkcs11.SessionHandle, o pkcs11.ObjectHandle, a []*pkcs11.Attribute) ([]*pkcs11.Attribute, error)

For PKCS11 Object Management.

Subtasks

  • Implement GetAttributeValue

TASK PKCS11 VerifyUpdate

Signature: VerifyUpdate(sh pkcs11.SessionHandle, part []byte) error

Related to PKCS11 Signing and Verification

Subtasks

  • Implement VerifyUpdate

TASK PKCS11 DecryptUpdate

Signature: DecryptUpdate(sh pkcs11.SessionHandle, cipher []byte) ([]byte, error)

Related to PKCS11 Encryption and Decryption

Subtasks

  • Implement DecryptUpdate

TASK PKCS11 OpenSession

Signature: OpenSession(slotID uint, flags uint) (pkcs11.SessionHandle, error)

PKCS11 Token and Session Management

Subtasks

  • Implement OpenSession

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.