Crypt-SMimeEngine

 view release on metacpan or  search on metacpan

SMimeEngine.xs  view on Meta::CPAN

    sign = &sign_old;
    if( engine_name && strcmp(engine_name,"openssl") != 0 ) {
       // LOAD ENGINE HW
        eng = load_engine(engine_name, libeng_file);
        if(!(eng)) {
            destroy_ui_method();
            sprintf(errstring, "Error to load engine: %s (%s)", engine_name, libeng_file);
            return 1;
        }

        if( !(pkey = ENGINE_load_private_key(eng, key_file, ui_method, NULL)) ){
            destroy_ui_method();
            ENGINE_cleanup();
            sprintf(errstring, "Error to load private key file: %s", key_file);
            return 1;
        }
     } else {
        FILE *fp;
        if (!(fp = fopen(key_file, "r")) ||
            !(pkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL))){

SMimeEngine.xs  view on Meta::CPAN

    if(pkey){
        EVP_PKEY_free(pkey);
    }
    if(signer){
        X509_free(signer);
    }

    // load key
    if( eng ){
        // ENGINE HW
        if( !(pkey = ENGINE_load_private_key(eng, prk, ui_method, NULL)) ){
            destroy_ui_method();
            ENGINE_cleanup();
            sprintf(errstring, "Error to load private key file: %s", prk);
            return 1;
        }
    }else{
        // ENGINE SW
        FILE *fp;
        if (!(fp = fopen(prk, "r")) ||
            !(pkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL))){



( run in 0.241 second using v1.01-cache-2.11-cpan-a5abf4f5562 )