PelionIoT / manifest-tool

A tool for creating and parsing update manifests
Apache License 2.0
10 stars 14 forks source link

Is ECC-384 (secp384r1) key supported for creating and signing manifest? #39

Open DivyaVijayvargiya-8 opened 1 year ago

DivyaVijayvargiya-8 commented 1 year ago

I am trying to create a manifest and want to use the ECC-384 (secp384r1) keypair. I have generated the private key using:

$ openssl ecparam -genkey -name secp384r1 -outform PEM -out secp384r1.priv.key.pem

However, when I try to create manifest manifest-tool --debug create \ --config my.config.yaml \ --key secp384r1.priv.key.pem \ --fw-version 1.2.3 \ --output my.manifest.bin

I am getting below error: 023-01-11 09:06:11,803 INFO Vendor-ID: fe1d22aa8d2f589db31a962349b16969 2023-01-11 09:06:11,803 INFO Class-ID: 692be9ae461c5018b855726b71a820f9 2023-01-11 09:06:11,826 ERROR int too big to convert

Traceback (most recent call last): File "~/.local/lib/python3.6/site-packages/manifesttool/mtool/mtool.py", line 142, in entry_point CreateAction.entry_point(args, ManifestAsnCodecV3) File "~/.local/lib/python3.6/site-packages/manifesttool/mtool/actions/create.py", line 190, in entry_point asn1_codec_class=asn1_codec File "~/.local/lib/python3.6/site-packages/manifesttool/mtool/actions/create.py", line 152, in do_create ecdsa_helper.signature_der_to_raw(signature) File "~/.local/lib/python3.6/site-packages/manifesttool/mtool/ecdsa_helper.py", line 90, in signature_der_to_raw return int_to_bytes(r, 32) + int_to_bytes(s, 32) File "/usr/local/lib64/python3.6/site-packages/cryptography/utils.py", line 77, in int_to_bytes length or (integer.bit_length() + 7) // 8 or 1, "big" OverflowError: int too big to convert

Also., tried with Python 3.10.7 and got the same error:

2023-01-11 08:52:48,494 INFO Vendor-ID: fe1d22aa8d2f589db31a962349b16969 2023-01-11 08:52:48,494 INFO Class-ID: 692be9ae461c5018b855726b71a820f9 2023-01-11 08:52:48,532 ERROR int too big to convert Traceback (most recent call last): File "~\AppData\Local\Programs\Python\Python310\lib\site-packages\manifesttool\mtool\mtool.py", line 142, in entry_point CreateAction.entry_point(args, ManifestAsnCodecV3) File "~\AppData\Local\Programs\Python\Python310\lib\site-packages\manifesttool\mtool\actions\create.py", line 185, in entry_point manifest_bin = cls.do_create( File "~\AppData\Local\Programs\Python\Python310\lib\site-packages\manifesttool\mtool\actions\create.py", line 152, in do_create ecdsa_helper.signature_der_to_raw(signature) File "~\AppData\Local\Programs\Python\Python310\lib\site-packages\manifesttool\mtool\ecdsa_helper.py", line 90, in signature_der_to_raw return int_to_bytes(r, 32) + int_to_bytes(s, 32) File "~\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\utils.py", line 63, in int_to_bytes return integer.to_bytes( OverflowError: int too big to convert