Linux command
openssl-pkey 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
View private key details
openssl pkey -in [private.key] -text -noout
Extract public key
openssl pkey -in [private.key] -pubout -out [public.key]
Convert to DER format
openssl pkey -in [private.key] -outform DER -out [private.der]
Encrypt private key
openssl pkey -in [private.key] -aes256 -out [encrypted.key]
Remove encryption
openssl pkey -in [encrypted.key] -out [decrypted.key]
Check key validity
openssl pkey -in [private.key] -check
说明
openssl pkey is a general-purpose key processing tool. It can convert between formats, extract public keys, encrypt/decrypt private keys, and display key information. Works with RSA, EC, ED25519, and other key types.
参数
- -in _file_
- Input file.
- -out _file_
- Output file.
- -inform _format_
- Input format (PEM, DER).
- -outform _format_
- Output format.
- -pubout
- Output public key.
- -text
- Print text form.
- -noout
- Don't output key.
- -check
- Check key.
- -aes256
- Encrypt output.
FAQ
What is the openssl-pkey command used for?
openssl pkey is a general-purpose key processing tool. It can convert between formats, extract public keys, encrypt/decrypt private keys, and display key information. Works with RSA, EC, ED25519, and other key types.
How do I run a basic openssl-pkey example?
Run `openssl pkey -in [private.key] -text -noout` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -in _file_ do in openssl-pkey?
Input file.