-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #636 from merlin-northern/men_7523__mender_artifac…
…t_signature_72_case_asn1_encoded_signatures_do_not_work_ fix: hardware-security returned signatures support for ECDSA256.
- Loading branch information
Showing
7 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
*.o | ||
*.a | ||
*.so | ||
*.mender | ||
|
||
# Folders | ||
_obj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# tests data files | ||
|
||
## ECDSA256 Nitro HSM case | ||
|
||
### generate the keys in the HSM | ||
|
||
```sh | ||
pkcs11-tool --module /usr/lib/arm-linux-gnueabihf/opensc-pkcs11.so -l --pin xx --keypairgen --key-type EC:prime256v1 --id xx | ||
``` | ||
|
||
save the public key: | ||
|
||
```sh | ||
pkcs11-tool --read-object --type pubkey --id xx -o pub.key | ||
``` | ||
|
||
save in PEM format: | ||
|
||
```sh | ||
openssl pkey -pubin -in pub.key -outform PEM -out ec.pem | ||
``` | ||
|
||
### generate artifact and sign | ||
|
||
configure OpenSSL, add to the config: | ||
|
||
``` | ||
[openssl_init] | ||
engines=engine_section | ||
[engine_section] | ||
pkcs11 = pkcs11_section | ||
[pkcs11_section] | ||
engine_id = pkcs11 | ||
MODULE_PATH = /usr/lib/x86_64-linux-gnu/pkcs11/opensc-pkcs11.so | ||
init = 0 | ||
``` | ||
|
||
get the PKCS#11 URI: | ||
|
||
```sh | ||
pkcs11-tool --login --pin xx --list-objects | ||
p11tool --login --set-pin xx --list-all-privkeys 'URL you got from above' | ||
``` | ||
|
||
sign: | ||
|
||
```sh | ||
mender-artifact sign --key-pkcs11 "${key}" /tmp/a0.mender -o /tmp/a0-signed-nitro.mender | ||
# where key is the PKCS#11 URI to your private key | ||
``` | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDTjFpi9+tJ8KnTPQff34Gpj4E4uc | ||
T4ML17IzkcWZhtY1O44fqMHmejS0umai8xJlD0Z/THhTiuRO8PC3vpkU9g== | ||
-----END PUBLIC KEY----- |