Skip to content

CIP8 signing with extended signing key fails #270

Closed
@theeldermillenial

Description

@theeldermillenial

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions