Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to read hashed private key as input in softsign feature #742

Closed
wants to merge 1 commit into from

Conversation

greg-szabo
Copy link

Overview

As a temporary solution for networks like Injective that require faster signing turnaround than what the YubiHSM key can provide, the softsign feature was extended with the option to read the "expanded secret key" from the file system instead of the regular seed key (or private key as people call it).

The yubihsm-unwrap command's output file can be directly fed into the defined path field in the configuration and the key-loading mechanism will automatically see which type of key was presented.

It also verifies the private key for good measure in cases where this is possible and prints an entry into the log for the end-user.

yubihsm-unwrap command PR: Yubico/yubihsm-shell#323 .

How it is done

I've replaced the private key loading mechanism's return type from ed25519::KeyPair to a custom-made KeyPair that can hold either the regular seed key or the expanded secret key with the corresponding private key. The custom struct has enough conversion traits that throughout the codebase only minimal modifications were needed to integrate it.

Why not just use the expanded key and completely get rid of the seed key?

This is a valid question since the seed key is not necessary for signing. (RFC8032 defines the first 32 bytes of the hash of the seed key as the private key.)
In the codebase, the Ed25519 seed key loading mechanism is used elsewhere too. For example, while opening the TCP connection, the code uses an Ed25519 seed key as the hub secret connection key. There was no point in upsetting parts of the code that work well and it was easier to implement enough From traits to overcome the different use.

@tony-iqlusion
Copy link
Member

@greg-szabo I've since upgraded tendermint-rs which now uses ed25519_consensus, so this needs to be redone in terms of that.

I also introduced an ed25519::SigningKey newtype which somewhat duplicates the ed25519_keypair::Keypair in this PR.

@tony-iqlusion
Copy link
Member

Closing as stale.

Please reopen with an implementation based on ed25519-consensus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants