Skip to content

Test failures with cryptography 47.0.0 #94

@mweinelt

Description

@mweinelt

These look all the same and complain about the encoding of the private key.

joserfc 1.6.1
cryptography 47.0.0

raw = b'-----BEGIN EC PRIVATE KEY-----\nMIHbAgEBBEFvFujwdb3ZFYnWnUZrFobrksVQfpDGFJ9Zt1ofpUrDBjBd4Z6rNB+x\nK5OrfJPm2WidZxzsU6...Epwe1e4VZTklnO+WULy8anV5yIjrmdwIDVvJ1IyJuBDK\nZO7SyxCnL6S/OW+>
password = None

    def import_from_pem_key(raw: bytes, password: bytes | None = None) -> Any:
        key: Any
    
        if b"OPENSSH PRIVATE" in raw:
            key = load_ssh_private_key(raw, password=password)
    
        elif b"PUBLIC" in raw:
            key = load_pem_public_key(raw)
    
        elif b"PRIVATE" in raw:
>           key = load_pem_private_key(raw, password=password)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           ValueError: EC private key is not encoded properly: private key value is too short. Please file an issue at https://github.com/pyca/cryptography/issues explaining how your priv>
E           If your key is in PKCS#8 format, you must use BEGIN/END PRIVATE KEY PEM delimiters

src/joserfc/_rfc7517/pem.py:39: ValueError
FAILED tests/jwe/test_compact.py::TestJWECompact::test_ECDH_ES_with_EC_key - ValueError: EC private key is not encoded properly: private key value is to...
FAILED tests/jwk/test_ec_key.py::TestECKey::test_import_p512_key - ValueError: EC private key is not encoded properly: private key value is to...
FAILED tests/jws/test_errors.py::TestJWSErrors::test_ec_incorrect_curve - ValueError: EC private key is not encoded properly: private key value is to...
FAILED tests/jws/test_examples.py::TestJWSExamples::test_ES512 - ValueError: EC private key is not encoded properly: private key value is to...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions