Created
November 4, 2019 18:31
-
-
Save emmiep/d97c703e89f82a85eada3c7c97a0e7f2 to your computer and use it in GitHub Desktop.
Read private RSA key from PEM file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <openssl/pem.h> | |
| #include <openssl/rsa.h> | |
| int main(int argc, char *argv[]) { | |
| FILE *f = fopen(argv[1], "r"); | |
| RSA *key = PEM_read_RSAPrivateKey(f, NULL, NULL, NULL); | |
| RSA_print_fp(stdout, key, 0); | |
| fclose(f); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment