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

Add the generate and destroy key operations #13

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

hug-dev
Copy link
Member

@hug-dev hug-dev commented Oct 8, 2020

The Generate key one currently hardcodes the key to 2048 bits RSA to make it easier to use on the CLI.

I tested it and it works well 😄

[hugdev01@machine parsec-tool]$ ./target/debug/parsec-tool -a tata psa-generate-key -k toto -p 1
[INFO] Generating key...
[hugdev01@machine parsec-tool]$ ./target/debug/parsec-tool -a tata psa-export-public-key -k toto -p 1
[INFO] Exporting public key...
[SUCCESS] Key:
30 82 01 0A 02 82 01 01 00 CF 35 30 8A C6 11 B0 F3 C8 5C 4C 80 46 D7 EE BD 14 20 10 C6 E4 07 0D 83 63 79 B9 36 1C 0D 8D 1C E2 CB 0F 0E CC 33 F8 F0 B2 28 AC 3F B8 A2 B9 1E BC 98 6B 74 95 D6 34 34 74 90 73 72 80 C8 0C 3C CF BF 8A A7 5B C2 30 68 B3 DE 06 75 01 27 30 AE CC 3C AC 7F B8 B5 01 0E 2D 61 32 BD 18 D1 FC B2 C4 D3 12 61 72 B0 C0 19 19 C7 BF 1E BE C2 97 C8 FA 70 9F 7E 52 90 07 8D B9 10 6E 22 F5 50 0D 2D 62 D6 60 89 D6 E7 71 02 DD 6D 41 BF 4D 58 6C 84 86 D7 B9 FA 2F 26 FD 07 30 79 C3 27 25 E0 63 99 BF 01 79 7D 05 F7 AE 17 40 DD DD B5 F4 1E 12 65 09 9E 97 50 54 50 B7 6C 4B AB 0A BC EE 72 AC 79 F6 30 5A 55 EA 86 EE 29 8C EA BC 13 18 EC D5 D9 BE 7B E1 C9 AC 45 FD 85 39 42 72 0C AD 95 90 E7 F4 AF 71 50 1F 49 63 E9 78 4A 22 43 FE A8 A5 A3 60 E8 74 61 83 93 69 8D A2 44 62 58 3E CA 72 DB 02 03 01 00 01
[hugdev01@machine parsec-tool]$ ./target/debug/parsec-tool -a tata psa-destroy-key -k toto -p 1
[INFO] Destroying a key...
[hugdev01@machine parsec-tool]$ ./target/debug/parsec-tool -a tata psa-export-public-key -k toto -p 1
[INFO] Exporting public key...
[ERR] Executing subcommand failed.

Caused by:
    asking for an item that doesn't exist

Will rebase on top of the other PR once merged.

@hug-dev hug-dev added the enhancement New feature or request label Oct 8, 2020
fn try_from(
psa_generate_key_subcommand: &PsaGenerateKeySubcommand,
) -> Result<NativeOperation, Self::Error> {
Ok(NativeOperation::PsaGenerateKey(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's worth adding a // FIXME or // TODO here to signify that there are currently no options for controlling which kind of key gets generated, but not a blocker.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done!

}
};

Ok(())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this locally -- could we get some text confirmation that the key has been created successfully? 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done 🚀 !

The key generation currently hardcodes it to 2048 RSA.

Signed-off-by: Hugues de Valon <[email protected]>
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to disregard the comment below.

Comment on lines +56 to +57
sign_hash: true,
..Default::default()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity - you don't want to be able to verify? I guess you can export public key and re-import it and verify with that, but it seems like a faff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, this is just to create a key but not use it with the tool, just to be able to list it and delete it 😄 We can modify this later!

@hug-dev hug-dev merged commit 06d3d92 into parallaxsecond:master Oct 9, 2020
@hug-dev hug-dev deleted the create-key branch October 9, 2020 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants