Skip to content

Redesign of ed25519 key loading functions #502

@karel-m

Description

@karel-m

Currently we have:

int ed25519_set_key(sk, sklen, pk, pklen, &key);
int ed25519_import(in, inlen, &key);
int ed25519_import_x509(in, inlen, &key);
int ed25519_import_pkcs8(in, inlen, pwd, pwdlen, &dkey);

First, I propose replacing ed25519_set_key with:

int ed25519_import_raw(in, inlen, type, &key);
/* where type is PK_PRIVATE or PK_PUBLIC */

Next, I would suggest renaming ed25519_import to ed25519_import_openssl and extending it so that it can import not only public keys but also private keys produced by openssl (which is similar to what we do in ecc_import_openssl).

The test vectors can be generated by:

openssl genpkey -algorithm Ed25519 -out ed25519_sk.pem
openssl pkey -in ed25519_sk.pem -inform PEM -out ed25519_sk.der -outform DER
openssl pkey -in ed25519_sk.pem -inform PEM -out ed25519_pk.der -pubout -outform DER

Our ed25519_import_openssl should be able to handle both ed25519_pk.der and ed25519_sk.der.

I am currently short of time for coding therefore opening just an issue,

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