[openssl-users] Encrypting using EC public key

Matt Caswell matt at openssl.org
Mon Jan 16 09:35:10 UTC 2017

On 15/01/17 03:47, Norm Green wrote:
> Is there a way to encrypt a file using the openssl command with an
> elliptic curve public key?  Here's what I get when I try using OpenSSL
> 1.1.0c :

OpenSSL only supports ECDH (for key exchange) and ECDSA (for digital
signatures) for elliptic curve keys, i.e. there are no ec encryption
algorithms available.


> normg>./openssl pkeyutl -encrypt -pubin -inkey secp256k1-public-key.pem
> -in a.txt -out a.txt.enc
> pkeyutl: Error initializing context
> 140339244734272:error:0608B096:digital envelope
> routines:EVP_PKEY_encrypt_init:operation not supported for this
> keytype:crypto/evp/pmeth_fn.c:139:
> normg>cat secp256k1-public-key.pem
> -----BEGIN PUBLIC KEY-----
> XmxFEr1AwKnmeD8dAg4F62ddmzX76fNaw1QqLbmEQTLdrEYM3KxUdA==
> -----END PUBLIC KEY-----
> Norm Green

More information about the openssl-users mailing list