]>
git.ipfire.org Git - thirdparty/openssl.git/blob - demos/maurice/loadkeys.c
3 Please read the README file for condition of use, before
6 Maurice Gittens <mgittens@gits.nl> January 1997
12 #include <netinet/in.h>
17 #include <openssl/rsa.h>
18 #include <openssl/evp.h>
19 #include <openssl/objects.h>
20 #include <openssl/x509.h>
21 #include <openssl/err.h>
22 #include <openssl/pem.h>
23 #include <openssl/ssl.h>
25 EVP_PKEY
* ReadPublicKey(const char *certfile
)
27 FILE *fp
= fopen (certfile
, "r");
34 x509
= PEM_read_X509(fp
, NULL
, 0, NULL
);
38 ERR_print_errors_fp (stderr
);
44 pkey
=X509_extract_key(x509
);
49 ERR_print_errors_fp (stderr
);
54 EVP_PKEY
*ReadPrivateKey(const char *keyfile
)
56 FILE *fp
= fopen(keyfile
, "r");
62 pkey
= PEM_read_PrivateKey(fp
, NULL
, 0, NULL
);
67 ERR_print_errors_fp (stderr
);