Skip to content

Conversation

@tinymahua
Copy link

The ED25519 key pair was previously loaded from the PEM format. In the dependency library cryptography, the EDPrivateKey can be used to export in the PEM format, but there seem to be some issues with the export of the EDPublicKey. Loading from the original byte string of the ED key pair can solve this problem and is also more convenient.

The ED25519 key pair was previously loaded from the PEM format.
In the dependency library cryptography, the EDPrivateKey can be used to export in the PEM format,
but there seem to be some issues with the export of the EDPublicKey.
Loading from the original byte string of the ED key pair can solve this problem and is also more convenient.
@tinymahua tinymahua marked this pull request as draft April 27, 2025 02:29
@tinymahua tinymahua marked this pull request as ready for review April 27, 2025 02:30
@tinymahua tinymahua marked this pull request as draft April 27, 2025 07:38
@tinymahua tinymahua closed this Apr 27, 2025
@kislyuk
Copy link
Member

kislyuk commented May 12, 2025

Thank you for your interest in http-message-signatures. Could you elaborate on what issue you saw with serializing ed25519 keys in the PEM format? The following seems to work for me:

key = ed25519.Ed25519PrivateKey.generate()
key_bytes = key.public_key().public_bytes(
    encoding=serialization.Encoding.PEM,
    format=serialization.PublicFormat.SubjectPublicKeyInfo
)
serialization.load_pem_public_key(key_bytes)

The classes are also deliberately made available for subclassing. If you need to change the loading behavior, you could subclass http_message_signatures.algorithms.ED25519 and change the load_pem_keys method.

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 this pull request may close these issues.

2 participants