what is default cipher for PEM format in OpenSSL?

…衆ロ難τιáo~ 提交于 2021-02-07 04:01:51

问题


I generate key/cert using openssl

openssl.exe req -x509 -days 1000 -newkey rsa:1024 -keyout key.pem -out cert.pem

It prompts for a password. I guess that the password is used for key encryption. However I haven't specified any cipher. What cipher is used in this case?


回答1:


The default cipher is DES-EDE3-CBC, which is three-key triple DES EDE in CBC mode. You can see this in the source code file req.c.

cipher=EVP_des_ede3_cbc();

If you are using an OpenSSL version compiled with the option OPENSSL_NO_DES, then the library will not encrypt the key by default. This is the same behavior as if you pass the -nodes argument.

An easier way to figure this out is just to look at your key file. It announces the cipher in the PEM header.

$ cat key.pem
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,CAFD88DF2EF2EE81
...


来源:https://stackoverflow.com/questions/7402230/what-is-default-cipher-for-pem-format-in-openssl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!