Skip to content

TPM Provider does not persist imported private RSA keys #505

Open
@wiktor-k

Description

@wiktor-k

When importing private RSA keys Parsec uses a method that will make the keys unusable after a power cycle.

The import method uses load_external_rsa of TransientKeyContext.

The tss_esapi's TransientKeyContext.html::load_external_rsa uses the LoadExternal TPM function and saves the loaded keys in the Null hierarchy. Quoting the spec:

External objects are Temporary Objects. The saved external object contexts shall be invalidated at the next TPM Reset.

And the book:

Ephemeral keys are keys that are erased at reboot. An entire hierarchy, primary keys, storage keys, and leaf keys can be constructed in the NULL hierarchy. On reboot, as the seed changes, the entire key hierarchy is cryptographically erased. That is, the wrapped keys may exist on disk, but they can't be loaded.

The issue was observed by @ionut-arm on Slack. I'm just recording the problem so it's easier to track.

As far as I've seen it GnuPG uses TPM2_Import for moving private keys to TPM but that one requires a primary key to attach imported key to. (It's not currently implemented by tss-esapi crate but is on my radar in September).

Cc: @hug-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmediumEffort labelplatformsCompatibility with different secure services or hardware platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions