#define CRYPTO_MDEBUG
#include "openssl\bio.h"
#include "openssl\err.h"
#include "openssl\pem.h"
#include "openssl\pkcs12.h"
void main()
{
   EVP_PKEY *pkey = NULL;
   BIO *bio = NULL;
   PKCS12 *p12 = NULL;

   MemCheck_start();
   OpenSSL_add_all_algorithms();
   bio = BIO_new_file( "test.p12", "r" );
   p12 = d2i_PKCS12_bio( bio, NULL );
   PKCS12_parse( p12, "test", &pkey, NULL, NULL );
   if ( p12 ) PKCS12_free( p12 );
   if ( bio ) BIO_free( bio );
   if ( pkey ) EVP_PKEY_free( pkey );
   OBJ_cleanup();
   ERR_remove_state(0);
   EVP_cleanup();
   ERR_free_strings();
   CRYPTO_mem_leaks_fp( stderr );
}