How to use openssl lib pem_read to read public/private key from a string
问题 I use openssl in C++ , copy the PrivateKey and PublicKey file content to two const char*, but I see the demo of api is only get pem public/private key from a pem file,so how can I get a public/private key from a string? 回答1: Try this: char* mKey="-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQCDT4ntP3Fqj73RQW32B6hCDHMG64GtxeQDZ5BcQnQSRB3S/EwM\ngpZwuGYwTb7E65pdAAQ0e5na2d7yIGZX4MoDRGaDbYgdxr49J430cVLRU1r9EW+O\nqZQERyGYefxWOqBaNZL2PBclS/qf+AxRh1WnD8aY5V5zNItgVV4Bv9w4YQIDAQAB