signatory icon indicating copy to clipboard operation
signatory copied to clipboard

Signatory-cli import on azure - error: The property "key" must be a valid JsonWebKey object

Open colossus-digital opened this issue 2 years ago • 4 comments

I cannot import an spsk private key (secp256k1) on azure key vault. The result is: Error: The property "key" must be a valid JsonWebKey object. Any solution / workaround ?

tnks

image

colossus-digital avatar Jul 28 '22 18:07 colossus-digital

I'm looking into this now and will update ASAP.

AbineshECAD avatar Jul 29 '22 03:07 AbineshECAD

I got the issue reproduced. I'm still debugging, will update once I get a workaround or fix.

% ./signatory-cli import -c ./azure.yaml --base-dir ./ --vault azure spsk INFO[0000] Initializing vault vault=azure vault_name=azure INFO[0000] Requesting import operation pkh=tz2PeYw5zJS3Q2aXd2zuQbjs4MTbwmvCQ6tg vault=Azure vault_name="https://forimport.vault.azure.net/" Error: (Azure/https://forimport.vault.azure.net/): The property "key" must be a valid JsonWebKey object.

AbineshECAD avatar Jul 29 '22 08:07 AbineshECAD

Found the cause of the issue. For p256k alone "curve:" parameter is empty when filling in the fields of the key in JWK format. It is filled with the return value of key.Params().Name Once I fill in the curve parameter statically when key.Params().Name is empty the import succeeds without any issue.

Code: https://github.com/ecadlabs/signatory/blob/bb2c2417845db73645fec2ab589158ec92d98792/pkg/jwk/jwk.go#L202

If you are building signatory from the source you can add the workaround here for now. j.Curve = key.Params().Name if j.Curve == "" { j.Curve = "P-256K" }

For the fix, I have to figure out things as the crypto library doesn't support this curve yet.

AbineshECAD avatar Jul 29 '22 09:07 AbineshECAD

Fixed in #256, @AbineshECAD to verify.

jevonearth avatar Oct 25 '22 16:10 jevonearth