PEM_read_RSA_PUBKEY error “Expecting: PUBLIC KEY” #include <stdio.h> #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/bio.h> #include <openssl/pem.h> #define SECFILE "sec.pem" #define PUBFILE "pub.pem" int main() { EVP_PKEY_CTX *ctx; EVP_PKEY *pkey = NULL; ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); BIO *bio_out = NULL; FILE *fp; if (!ctx) { perror("Error in CTX \n"); } if (EVP_PKEY_keygen_init(ctx) <= 0) { perror("Error in EVP_PKEY_keygen_init \n"); } if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0) { perror("Error in EVP_PKEY_CTX_set_rsa_keygen_bits \n"); } /*