Skip to content

implement openssl's GENPKEY and PKEY subcommands in library crypto #156

@remys

Description

@remys

openssl provides 2 subcommands GENPKEY and PKEY which can be used to generate a private and public key pair, eg. using algorithm x25519
e.g.

openssl genpkey -algorithm x25519 > key.pem

-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VuBCIEIIi4uhhOCvU8v4Vi7+qORXuIUYlaz+nlPQs8ubkgwnpy
-----END PRIVATE KEY-----

openssl pkey -in key.pem -pubout

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEACkVQ78NAnw4QtUeCJjROvObTuYP8CvuHxzWQP8GsmVc=
-----END PUBLIC KEY-----

library crypto does currently not provide any predicates for private/public key generation.
I'd then suggest to add 2 new predicates in library crypto
e.g

%% crypto_private_key(+Algo, -PrivateKey, +Options) is nondet
% where PrivateKey is a random private key generated by openssl using algorithm Algo
% generates an infinite number of keys on backtracking

and
%% crypto_public_key(-PrivateKey, +PublicKey, +Options) is det
% where PublicKey is the public key associated with PrivateKey

For reference, see discussion in Curve25519 in library crypto

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