如何使用 ASN1 解码器(libtasn1-3.3)打印作为参数接收的 DD 证书 pem 的内容?
最佳答案
asn1Decoding 是来自 libtasn1-3.3 的一个程序
如果那个程序适合你,那么 ansn1Decoding 有一个你可以使用的解码函数(当然你必须修改这个代码。如果你不想通过将解码代码移到你的程序中来修改,然后你必须将解码代码复制到你的代码中):
静态整数
解码(asn1_node 定义,const char *typeName,void *der,int der_len,
内部基准)
如果你想从你的程序中调用解码,那么你必须
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);
}
关于java - ASN1解码器(libtasn1-3.3)打印DD证书pem的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21862754/