Skip to content

Investigate PKCS#11 front-end compatibility layer for Parsec #291

Open
@paulhowardarm

Description

@paulhowardarm

Summary

There are a number of existing systems that use PKCS#11 as their interface of choice for calling out to hardware security functions - it is a well-established interface with a lot of industry adoption. If Parsec could be accessed and driven through this interface, it would allow those systems to gain the benefits of the Parsec platform abstraction without having to code to any Parsec-specific front-end API or client library. Existing PKCS#11 client code would automatically "just work" with Parsec. Hence it would be a useful ecosystem enabler.

This request is to investigate and define the required work.

Design Considerations

A non-exhaustive list of design considerations for this investigation:

  • What is the general mechanism via which a Rust-based PKCS#11 library should be built? The interface needs to be C-callable using the Oasis-defined headers, and it needs to compile to a dynamic (shared object) library exposing this interface. But the bulk of the implementation would likely be Rust and hook up to the existing Rust Parsec client library, Is it useful to have a generic PKCS#11 "skin" that provides the interface and the C/Rust interop layer? Should this be part of Parsec, or an enhancement of other Rust PKCS#11 ecosystem projects? How would it bridge to the Parsec client library? Should we try to capture the PKCS#11 contracts as simplified Rust traits, so that anyone could create a Rust-based PKCS#11 library with reduced effort?
  • What should the slot and slot access models look like? Does it make sense to model the Parsec service in terms of its providers, and perhaps have a slot per provider? What about slot PINs? Does it make sense to expose these? What would that mean? What if the back-end is also PKCS#11 and has multiple slots? Should we try to reflect the back-end slots into front-end slots? That could get messy, and is also breaking the abstraction that Parsec is trying to provide. There is benefit to keeping back-end slots "hidden" within the Parsec service, because then things like slot PINs can be managed by the Parsec admin and do not need to be leaked out to any other part of the system.
  • What's the subset of the PKCS#11 standard that we need to cover?
  • Related to the above, are the existing Parsec API (based on PSA Crypto) sufficient? Do we need PSA storage APIs as well? (The answer to this may depend on how many client systems we want to try to integrate with).
  • The C_FindObjects API could prove a challenge. Parsec currently has a ListKeys opcode, but it's not clear whether that is comprehensive enough to allow objects to be found by PKCS#11-style key/value pair templates.

Definition of Done

This is a ticket for investigation, so the expected end result would be a more detailed specification and scope for the work, perhaps with a breakdown into individual issues for concrete engineering items. Part of the DoD should also be a specification (perhaps as a PR against parsec-book) for the subset of PKCS#11 standard that would be implemented - this should aim to resolve some of the questions about slot modelling noted above. A good first target would be to enable PKCS#11-compatible access to the Parsec features that exist at time of writing (November 2020) for the provisioning of asymmetric keys, sign/verify and asymmetric crypto primitives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ecosystemIssues related to building or improving compatibility layers to enhance Parsec's ecosystem position

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions