关于RSA,关于PKCS#1,PKCS#8,密钥相关的知识。请参考: RSA 相关知识
私钥
-----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQDJTwCsWHU4MTzHkZOiG2otXsG3kEHPh5C68M7CQf1f+DK/NRD/ pEj9kk98+hx2hQKlAIKHe3JFT6TXNONVeJGMX+8o1i5V7VSFiedmgbFAJdn3Ginv 0xQJuon0WUjymY66bD4c5xEXZWNTDmI2sPcZ0/3NgShBEGmCw6j+7EdQSwIDAQAB AoGAJIjYAG9VZstY0odTGdqL3IwT8DKYHwfldmf5vjuntmEfJKCG4z53mL2S+4WQ 4Nmm7zc2eUwoIvgfXIdWss5c66A3NBUPg1Q3XcWVTvx50pLtcTH9uVPWOYc5ZF68 kJdobmZgsfqrgkBpDSeWkDwih0H5P3SoVlX/6p16PACWy/ECQQD6r96HRIaJrcmS 6K+E5K5+ADgEfn4tiT7tAZ8MCAp84CYgJtCnGTlqc+MCx874UQ8x4SGff5qh0iyo fL8eOsTnAkEAzZM5r7wK+NZCHyJudUUe62QNs1StD5OLXRL+/WyoJRjdwspzkLw6 MD4M+wlBOOl3UN8gaVjc4QwnBp8GBKiI/QJAJ8EmH/ts/n5x3ftKgl+lkFPGjmfk 6KHAOeOs7kKEL0N4qFafdjBY25nfITzAhL6OE1HpfBrHUew7qsiFomyddwJAMZrj Apq3cxAQaH7gdH+3VEmSXMGD+Qw7Rrw8t14uvLThXg2IEVa6G8X9T94N1PPRDLyq j4EX214ZVKmuxBT+6QJBAPqAe2riAeNzYNmy4efed7bktAkZdvEu80mWsJ51BeX4 37xs3pWLoWwZomSgLd+ACl+AaJJS6CgTAyNUlWCbX+M= -----END RSA PRIVATE KEY-----
公钥
-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJTwCsWHU4MTzHkZOiG2otXsG3 kEHPh5C68M7CQf1f+DK/NRD/pEj9kk98+hx2hQKlAIKHe3JFT6TXNONVeJGMX+8o 1i5V7VSFiedmgbFAJdn3Ginv0xQJuon0WUjymY66bD4c5xEXZWNTDmI2sPcZ0/3N gShBEGmCw6j+7EdQSwIDAQAB -----END PUBLIC KEY-----生成密钥的openssl 命令
openssl genrsa 2048 openssl genrsa -out rsa_private.pem 2048 openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem openssl pkcs8 -topk8 -in rsa_private.pem -nocrypt -out rsa_private_pkcs8.pem生成带密码保护的密钥文件
openssl genrsa -aes256 -passout pass:1234567890 -out rsa_private_crypt.pem 2048
只需要输入PKCS#1私钥或者公钥部分其中一个即可。