Skip to content

feat(fdo-manufacturing-client): Support command line option for DI_SIGN_KEY_PATH and DI_HMAC_KEY_PATH - #476

Open
nak3 wants to merge 2 commits into
fdo-rs:mainfrom
nak3:add-key-path-option
Open

feat(fdo-manufacturing-client): Support command line option for DI_SIGN_KEY_PATH and DI_HMAC_KEY_PATH#476
nak3 wants to merge 2 commits into
fdo-rs:mainfrom
nak3:add-key-path-option

Conversation

@nak3

@nak3 nak3 commented Apr 14, 2023

Copy link
Copy Markdown
Contributor

As fdo-manufacturing-client plain-di does not have the option for DI_SIGN_KEY_PATH and DI_HMAC_KEY_PATH, we need to specify them via env variable.

This patch support the command line option.

@nak3
nak3 force-pushed the add-key-path-option branch from 9c5923d to 4e73d0c Compare April 14, 2023 13:01
@7flying

7flying commented Apr 14, 2023

Copy link
Copy Markdown
Contributor

I did not add those options since I'm usure of the values that they should take. Can you provide an example?

@nak3

nak3 commented Apr 17, 2023

Copy link
Copy Markdown
Contributor Author

Sorry if you already might know but these values (keys) are stored in device credential. You can follow the code perform_di() -> save_to_credential().

The device credential stores the keys at last as:

https://github.com/fedora-iot/fido-device-onboard-rs/blob/69fec227de04d98c51a5b5d8eb218bdc264f0a3f/data-formats/src/devicecredential/file.rs#L24-L27

You can dump the secrets by fdo-owner-tool dump-device-credential, though you need to tweak the code to print the secret.

@7flying

7flying commented Apr 17, 2023

Copy link
Copy Markdown
Contributor

Sorry if you already might know but these values (keys) are stored in device credential. You can follow the code perform_di() -> save_to_credential().

The device credential stores the keys at last as:

https://github.com/fedora-iot/fido-device-onboard-rs/blob/69fec227de04d98c51a5b5d8eb218bdc264f0a3f/data-formats/src/devicecredential/file.rs#L24-L27

You can dump the secrets by fdo-owner-tool dump-device-credential, though you need to tweak the code to print the secret.

Yes, my question is about how a user would generate those secrets. What type of keys are they? How do I generate them?

@nak3

nak3 commented Apr 18, 2023

Copy link
Copy Markdown
Contributor Author

Oh, I see. Sorry for my misreading. I hope below answers your question.

hmac_key_path:

  • It is a plain file contains a random value. (if you don't concern about security, any value is fine and there is no restrictions for 32 byte.)
  • Example command to generate:
$ head --bytes 32 /dev/urandom  > /path/to/hmac/secret

sign_key_path

  • The private key which is a DER format.
  • Example command to generate:
$ openssl ecparam -name secp384r1 -genkey -noout -outform der -out /path/to/sign_key/key.der

@7flying

7flying commented Apr 25, 2023

Copy link
Copy Markdown
Contributor

I'm just going to see what we can do for #477 before I merge this.
We need some documentation/guidelines on how to generate the keys and were to put them before this goes in.

@nak3
nak3 force-pushed the add-key-path-option branch 3 times, most recently from b9dd88a to ed1ccc7 Compare April 26, 2023 11:12
@nak3

nak3 commented Apr 26, 2023

Copy link
Copy Markdown
Contributor Author

Alright, I updated the docs https://github.com/nak3/fido-device-onboard-rs/blob/add-key-path-option/HOWTO.md#plain-di
Is it alright? Or do we need a doc somewhere else?

nak3 added 2 commits May 29, 2023 16:58
As `fdo-manufacturing-client plain-di` does not have the option for
`DI_SIGN_KEY_PATH` and `DI_HMAC_KEY_PATH`, we need to specify it via
env variable.

This patch support the command line option.
This patch updates HOWTO docs with how to generate the private keys.

Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
@nak3
nak3 force-pushed the add-key-path-option branch from ed1ccc7 to 14d6692 Compare May 29, 2023 07:58
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