Add a bunch of S/MIME sample programs and data.
[openssl.git] / demos / maurice / loadkeys.c
index 7c89f071f353f9741b096e978ce8f0046f231563..82fd22a950369c02aad71c0977e3c16a22c7bad5 100644 (file)
 #include <strings.h>
 #include <stdlib.h>
 
-#include "rsa.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
-#include "err.h"
-#include "pem.h"
-#include "ssl.h"
+#include <openssl/rsa.h>
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/err.h>
+#include <openssl/pem.h>
+#include <openssl/ssl.h>
 
 EVP_PKEY * ReadPublicKey(const char *certfile)
 {
@@ -31,9 +31,7 @@ EVP_PKEY * ReadPublicKey(const char *certfile)
   if (!fp) 
      return NULL; 
 
-  x509 = (X509 *)PEM_ASN1_read ((char *(*)())d2i_X509,
-                                   PEM_STRING_X509,
-                                   fp, NULL, NULL);
+  x509 = PEM_read_X509(fp, NULL, 0, NULL);
 
   if (x509 == NULL) 
   {  
@@ -61,10 +59,7 @@ EVP_PKEY *ReadPrivateKey(const char *keyfile)
        if (!fp)
                return NULL;
 
-       pkey = (EVP_PKEY*)PEM_ASN1_read ((char *(*)())d2i_PrivateKey,
-                              PEM_STRING_EVP_PKEY,
-                              fp,
-                              NULL, NULL);
+       pkey = PEM_read_PrivateKey(fp, NULL, 0, NULL);
 
        fclose (fp);