【问题标题】:ASN1 decoder (libtasn1-3.3) to print the content of a DD certificate pemASN1 解码器 (libtasn1-3.3) 打印 DD 证书 pem 的内容
【发布时间】:2014-02-18 18:50:00
【问题描述】:

如何使用 ASN1 解码器 (libtasn1-3.3) 打印作为参数接收的 DD 证书 pem 的内容?

【问题讨论】:

  • asn1Decoding 失败了吗?
  • @ElliottFrisch 我不知道这个函数你能生成一个例子吗?
  • 艾略特你还能告诉我怎么做吗?

标签: java c++ c encoding certificate


【解决方案1】:

asn1Decoding 是来自libtasn1-3.3的程序

如果该程序适合您,那么 ansn1Decoding 有一个您可以使用的解码功能(当然,您必须修改此代码。如果您不想通过将解码代码移到您的程序中进行修改,那么您必须将解码代码复制到您的代码中):

static int decode (asn1_node definitions, const char *typeName, void *der, int der_len, int benchmark)

如果你想从你的程序中调用解码,那么你必须

asn1_node definitions = NULL;
int asn1_result = ASN1_SUCCESS;
unsigned char *der;
int der_len = 0, benchmark = 0;
// Please test with asn1Decoding application manually to find the correct typeName for your code
char typeName[] = {"PKIX1.Certificate"};

asn1_result = asn1_parser2tree ("Your File Name", &definitions, errorDescription);
if (asn1_result != ASN1_SUCCESS) {    exit(1); }
{
    size_t tmplen;
    der = (unsigned char *) read_binary_file (inputFileDerName, &tmplen);
    der_len = tmplen;
}

if (der == NULL)
{
      asn1_delete_structure (&definitions);
      exit (1);
}

if (decode (definitions, typeName, der, der_len, benchmark) != ASN1_SUCCESS)
{
      asn1_delete_structure (&definitions);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-08
    • 1970-01-01
    • 1970-01-01
    • 2019-02-09
    • 1970-01-01
    相关资源
    最近更新 更多