Skip to content

CIP8 signing with extended signing key fails #270

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

Closed
theeldermillenial opened this issue Sep 29, 2023 · 1 comment · Fixed by #273
Closed

CIP8 signing with extended signing key fails #270

theeldermillenial opened this issue Sep 29, 2023 · 1 comment · Fixed by #273

Comments

@theeldermillenial
Copy link
Contributor

Describe the bug
When using an extended signing key, either payment or staking, signing a message using cip8.sign produces an error.

To Reproduce
Modify the test_cipy8.py tests to use extended signing keys from the test_keys.py file. Run the test.

Logs
The error generated reads as follows:

pycardano/cip/cip8.py:88: in sign
    encoded = msg.encode()
.venv/lib/python3.10/site-packages/cose/messages/sign1message.py:67: in encode
    message = [self.phdr_encoded, self.uhdr_encoded, self.payload, self.compute_signature()]
.venv/lib/python3.10/site-packages/cose/messages/signcommon.py:63: in compute_signature
    return alg.sign(key=self.key, data=self._sig_structure)
.venv/lib/python3.10/site-packages/cose/algorithms.py:1021: in sign
    sk = Ed25519PrivateKey.from_private_bytes(key.d)
.venv/lib/python3.10/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py:77: in from_private_bytes
    return backend.ed25519_load_private_bytes(data)

Expected behavior
Since cip8.sign checks to see if one of the keys is a StakeExtendedSignKey, I would expect that at least a StakeExtendedSignKey to work correctly.

@theeldermillenial
Copy link
Contributor Author

On a separate note, it might not be a bad idea to parameterize these tests to make it easier.

I'd be happy to take a stab at parameterizing the tests and getting extended signing keys to work.

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 a pull request may close this issue.

1 participant