Skip to content

Add from_pkcs8_pem or from_pkcs8_der for X25519 static secret #846

@imlk0

Description

@imlk0

Hi there! 👋

I'm currently working on loading an X25519 private key from a PEM file in PKCS#8 format (e.g., generated by openssl genpkey -algorithm X25519), and I noticed that while ed25519-dalek provides convenient methods like:

SigningKey::from_pkcs8_pem(pem_str)?

the x25519-dalek crate does not offer similar functionality. This makes interoperability with standard key formats (like those used in TLS, OpenSSL, or configuration files) more cumbersome.

It would be incredibly helpful if x25519-dalek could provide built-in support for parsing PKCS#8 PEM/DER, just like ed25519-dalek does, e.g.:

let secret = x25519_dalek::StaticSecret::from_pkcs8_pem(pem_str)?;
// or
let secret = x25519_dalek::StaticSecret::from_pkcs8_der(der_bytes)?;

This would greatly improve usability and reduce boilerplate code for users integrating with standard tooling (OpenSSL, Let's Encrypt-style keys, etc.).

Would you be open to adding this feature? I’d be happy to help contribute if needed!

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