5
如何在两种公钥格式之间转换,一种是“ BEGIN RSA PUBLIC KEY”,另一种是“ BEGIN PUBLIC KEY”
如何在两种公钥格式之间转换,一种格式是: -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY----- 另一种格式是: -----BEGIN RSA PUBLIC KEY----- ... -----END RSA PUBLIC KEY----- 例如,我使用ssh-keygen命令生成了id_rsa / id_rsa.pub对,我使用以下命令从id_rsa计算了公钥: openssl rsa -in id_rsa -pubout -out pub2 然后我再次使用id计算来自id_rsa.pub的公钥: ssh-keygen -f id_rsa.pub -e -m pem > pub1 内容是pub1是: -----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEA61BjmfXGEvWmegnBGSuS+rU9soUg2FnODva32D1AqhwdziwHINFa D1MVlcrYG6XRKfkcxnaXGfFDWHLEvNBSEVCgJjtHAGZIm5GL/KA86KDp/CwDFMSw luowcXwDwoyinmeOY9eKyh6aY72xJh7noLBBq1N0bWi1e2i+83txOCg4yV2oVXhB o8pYEJ8LT3el6Smxol3C1oFMVdwPgc0vTl25XucMcG/ALE/KNY6pqC2AQ6R2ERlV gPiUWOPatVkt7+Bs3h5Ramxh7XjBOXeulmCpGSynXNcpZ/06+vofGi/2MlpQZNhH Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB -----END RSA …