PKCS12文件的密码验证失败 [英] Password verification of PKCS12 file failed

查看:1176
本文介绍了PKCS12文件的密码验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是:

   FILE * fp = fopen(inputdata, "r");
   PKCS12 * p12 = d2i_PKCS12_fp(fp, NULL);

    if (p12 == NULL)
    {
         NSLog(@"Error loading PKCS12 file to p12 \n"); 
    }
    if ((ret = PKCS12_verify_mac(p12,"tcs",3))){
        lblmsg.text = @"password validated"; 
        NSLog(@"Password validated %s",ppvc_pfxPassPhrase);
    }
    NSLog(@"ret value %d",ret);

我能够将文件加载到p12,但是无法验证PKCS12文件. PKCS12_verify_mac的返回值是0.

I'm able to load the file to p12, but unable to verify the PKCS12 file. I'm getting 0 as the return from PKCS12_verify_mac.

为什么它返回0?

推荐答案

尝试使用ERR_print_errors找出原因.示例:

Try using ERR_print_errors to find out the cause. Example:

ret = PKCS12_verify_mac(p12, "tcs", 3);
if (ret == 0) {
    ERR_print_errors(stderr);
    // Abort?
} else {
    lblmsg.text = @"password validated"; 
    NSLog(@"Password validated %s",ppvc_pfxPassPhrase);
}

这篇关于PKCS12文件的密码验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆