[英]How to generate a Curve25519 key pair in Terminal?
How can we generate a Curve25519 key pair from the command line?我们如何从命令行生成 Curve25519 密钥对?
We have a MacBook Air with Homebrew installed.我们有一台安装了 Homebrew 的 MacBook Air。
Should we use OpenSSL or another command line tool?我们应该使用 OpenSSL 还是其他命令行工具?
How do we use that tool to generate a Curve25519 key pair?我们如何使用该工具生成 Curve25519 密钥对?
You can use the following command for generating the key pair:您可以使用以下命令生成密钥对:
openssl genpkey -algorithm x25519 -out x25519-priv.pem
And for extracting pubic key:并用于提取公钥:
openssl pkey -in x25519-priv.pem -pubout -out x25519-pub.pem
openssl in MacOS is apples own openssl that does not support Curve25519 you need to install it with brew MacOS中的openssl是苹果自己的openssl,不支持Curve25519,需要用brew安装
brew install openssl
and then link using PATH or using brew link --force openssl
(not recommended) for example if you are using zsh然后使用 PATH 或使用
brew link --force openssl
(不推荐) brew link --force openssl
,例如,如果您使用的是 zsh
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
to check.去检查。 if it worked just use the
which
command如果它有效,只需使用
which
命令
which openssl
now if you see output like this you are good to go现在,如果您看到这样的输出,您就可以开始了
/usr/local/opt/openssl@1.1/bin/openssl
now you can generate Curve25519 keys with using openssl现在您可以使用 openssl 生成 Curve25519 密钥
openssl genpkey -algorithm x25519 -out x25519-priv.pem
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.