使用OpenSSL生成公共ED25519密钥
我正在使用此命令生成私有ED25519密钥:
openssl genpkey -algorithm ed25519 -out private.pem
这就是结果:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
因此,我想基于此私钥生成一个公共密钥,然后我这样做:
openssl pkey -in private.pem -out public.pem
但是,使用此命令,我仍然得到一个私钥看起来这样:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
此外,这个私人和“公共”密钥不是32个bytes,而是64。我的命令有什么问题?
I'm using this command to generate private ed25519 key:
openssl genpkey -algorithm ed25519 -out private.pem
and this is the example result:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
So then I want to generate a public key based on this private key and I do it like this:
openssl pkey -in private.pem -out public.pem
but with this command I still get a private key that looks like this:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
Additionally, this private and "public" key is not 32-bytes, but 64. What's wrong with my command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将返回公共密钥作为文件。
This will return the public key as a file.
这个问题重复下一个 Gen pubkey openssl ed25519 给出了答案。
openssl pkey -in ed25519Key.pem -pubout
The question duplicates next gen pubkey openssl ed25519 and the answer has been given.
openssl pkey -in ed25519key.pem -pubout