OPENSSL-EC(1ossl)
π NAME π
openssl-ec β literally the EC key processing era, bestie. Elliptic curve keys, handled. That's the vibe.
(If you're the type who reads the header of a manpage: this is from the OpenSSL manual set, part 1ossl. All the deets, none of the boredom. π«Ά)
β¨ SYNOPSIS β¨
openssl ec [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in
filename|uri] [-passin arg] [-out filename] [-passout arg] [-des]
[-des3] [-idea] [-text] [-noout] [-param_out] [-pubin] [-pubout]
[-conv_form arg] [-param_enc arg] [-no_public] [-check] [-engine id]
[-provider name] [-provider-path path] [-provparam [name:]key=value]
[-propquery propq]
π¦ DESCRIPTION π¦
okay so openssl-ec(1) processes EC keys. Like, EC keys are the main character here and this command is their stylist β it converts them between various forms and prints out their components. π
Heads up, bestie: OpenSSL uses the private key format specified in 'SEC 1: Elliptic Curve Cryptography' (<https://www.secg.org/> β well, the doc sayshttp://www.secg.org/). So if you've got an OpenSSL EC private key and you need it in PKCS#8 private key format, you go use theopenssl-pkcs8(1)command. Different command, different slay. π₯
π OPTIONS π
-helpβ prints out a usage message. Your little map. πΊοΈ-inform DER|PEM|P12|ENGINEβ the key input format, and it's unspecified by default (mystery!! π). Peepopenssl-format-options(1)for the details.-outform DER|PEMβ the key output format, and the default isPEM. Again,openssl-format-options(1)has the lore.- Private keys are an SEC1 private key or PKCS#8 format.
- Public keys are a SubjectPublicKeyInfo as specified in IETF RFC 3280.
-in filename|uriβ tells it where to read a key from. No-in? It reads standard input, no big deal. And if the key is encrypted, it'll prompt you for a pass phrase. π-out filenameβ where to write the key to. Skip it and it writes to standard output. If any encryption options are set, you'll get a pass phrase prompt. π
Warning, bestie: the output filename should not be the same as the input filename. Just. Don't. π
-passin arg,-passout argβ the password source for the input file and the output file respectively. For more info on the format of arg, seeopenssl-passphrase-options(1).-des|-des3|-ideaβ these bad boys encrypt the private key before outputting it, using DES, triple DES, IDEA, or literally any other cipher supported by OpenSSL. A pass phrase gets prompted for. If none of these options is specified, the key is written in plain text. π- Which means: using this command to read in an encrypted key with no encryption option can be used to remove the pass phrase from a key.
- Or, by setting the encryption options, it can be used to add or change the pass phrase.
Note: these options can only be used with PEM format output files. PEM only, no exceptions, iykyk.
-textβ prints out the public key components, private key components and parameters. The full tour. β¨-nooutβ prevents output of the encoded version of the key. Like, we don't need that part.-param_outβ prints the elliptic curve parameters.-pubinβ by default a private key is read from the input; with this option, a public key is read instead. And if the input contains no public key but a private key, its public part is used. Resourceful of it. π-puboutβ by default a private key is output; with this option a public key gets output instead. This option is automatically set if the input is a public key. Automatic queen behavior. π-conv_form argβ specifies how the points on the elliptic curve are converted into octet strings. Possible values are:compresseduncompressedβ the default valuehybrid
For more info on point conversion forms, go read the X9.62 standard.
Patent drama alert: due to patent issues, thecompressedoption is disabled by default for binary curves, and can be enabled by defining the preprocessor macroOPENSSL_EC_BIN_PT_COMPat compile time. Yes, really. π«
-param_enc argβ specifies how the elliptic curve parameters are encoded. Possible values:named_curveβ i.e. the ec parameters are specified by an OID. This is the default!explicitβ where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures)
Note: the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL. F in the chat. π
-no_publicβ omits the public key components from the private key output. Bye bestie. π-checkβ checks the consistency of an EC private or public key. A lil wellness check. π©Ί-engine idβ see "Engine Options" inopenssl(1).
This option is deprecated. Just so you know. π
-provider name,-provider-path path,-provparam [name:]key=value,-propquery propqβ see "Provider Options" inopenssl(1),provider(7), andproperty(7). The whole provider cinematic universe. π
Also, on the lowkey important tip side: the openssl-pkey(1) command is capable of performing all the operations this command can, plus it supports other public key types. So like. pkey is that girl. But ec still ate. β¨
π EXAMPLES π
The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here. But here they are anyway, because we love a demo:
To encrypt a private key using triple DES:
openssl ec -in key.pem -des3 -out keyout.pem
To convert a private key from PEM to DER format:
openssl ec -in key.pem -outform DER -out keyout.der
To print out the components of a private key to standard output:
openssl ec -in key.pem -text -noout
To just output the public part of a private key:
openssl ec -in key.pem -pubout -out pubkey.pem
To change the parameters encoding to explicit:
openssl ec -in key.pem -param_enc explicit -out keyout.pem
To change the point conversion form to compressed:
openssl ec -in key.pem -conv_form compressed -out keyout.pem
πΈ SEE ALSO πΈ
openssl(1), openssl-pkey(1), openssl-ecparam(1), openssl-dsa(1), openssl-rsa(1)
The whole friend group. π«Ά
π« HISTORY π«
- The
-engineoption was deprecated in OpenSSL 3.0. - The
-conv_formand-no_publicoptions are no longer supported with keys loaded from an engine in OpenSSL 3.0.
Not the glow-down, but okay. π
π COPYRIGHT π
Copyright 2003-2023 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
β¨ that's the whole page, bestie β¨ β this one's from version 3.5.6, dated 2026-04-07, and it lives in the OPENSSL-EC(1ossl) manual. mwah ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms