<div dir="ltr">Hello, I checked the pkeyutl manpage, but it says that <div>-The Ed25519 and Ed448 signature algorithms are not supported by this utility. They accept non-hashed input, but this utility can only be used to sign hashed input.</div><div>So what command should I use to simply sign or encrypt a message with ed25519 or x25519? I also checked the cms manpage, if I use this command the result will be in MIME format.</div><div>Besides, I used the speed command and it will test the sign and verify the speed of ed25519, I just want to know what command will do this sign and verify operation.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Viktor Dukhovni <<a href="mailto:openssl-users@dukhovni.org">openssl-users@dukhovni.org</a>> 于2020年4月22日周三 上午1:35写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Apr 21, 2020 at 05:48:19PM +0800, yang berlin wrote:<br>
<br>
> I want to use ed25519 in openssl.<br>
<br>
Why?  What actual real-world purpose do you have for ed25519?<br>
<br>
> The problem I met is: I can use "speed ed25519" to test the speed of<br>
> ed25519, but when I use "dgst -ed25519", it tells me that "dgst:<br>
> Unrecognized flag Ed25519".<br>
<br>
That's because "ed25519" is not a digest algorithm, it is a public key<br>
algorithm.  You can use it to sign messages, but not to compute message<br>
digests.<br>
<br>
> So could you please help me to learn how to use ed25519 correctly?<br>
<br>
That question has no answer.  Whether a use of "ed25519" is correct or<br>
incorrect depends on the security protocol in which it is to be used,<br>
and whether that protocol is appropriate to security requirements of<br>
the application using it.<br>
<br>
If you're just playing with ed25519, you can generate ed25519 keys with:<br>
<br>
    $ openssl genpkey -algorithm ed25519 -out privkey.pem<br>
<br>
You can extract just the public key via:<br>
<br>
    $ openssl pkey -in privkey.pem -pubout -out pubkey.pem<br>
<br>
You can generate an ed25519 self-signed public key certificate with:<br>
<br>
    $ openssl req -key privkey.pem -new \<br>
        -x509 -subj "/CN=$(uname -n)" -days 36500 -out pubcert.pem<br>
<br>
You can use the key and certificate with s_client, and s_server<br>
via the "-key" and "-cert" arguments.<br>
<br>
You can also sign and/or encrypt messages with ed25519 using cms(1),<br>
but you may not be ready to dive into cms.<br>
<br>
Low-level public and private key operations are possible via pkeyutl(1).<br>
<br>
While the dgst(1) command supports signing message digests with various<br>
public key signature algorithms, ed25519 is not one of these:<br>
<br>
       -sign filename<br>
           Digitally sign the digest using the private key in "filename". Note<br>
           this option does not support Ed25519 or Ed448 private keys. Use the<br>
           pkeyutl command instead for this.<br>
<br>
See the pkeyutl(1) manpage.<br>
<br>
Don't assume that some use of encryption implies any gain in security.<br>
It could be mere security theatre.  For actual security you need to<br>
apply a robust protocol that matches the application's security<br>
requirements.<br>
<br>
-- <br>
    Viktor.<br>
</blockquote></div>