1
如何使用ASN1解碼器(libtasn1-3.3)打印作爲參數接收的DD證書pem的內容?ASN1解碼器(libtasn1-3.3)打印DD證書的內容pem
如何使用ASN1解碼器(libtasn1-3.3)打印作爲參數接收的DD證書pem的內容?ASN1解碼器(libtasn1-3.3)打印DD證書的內容pem
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);
}
[asn1Decoding](http://www.gnu.org/software/libtasn1/manual/libtasn1.html#Invoking-asn1Decoding)是否失敗? –
@ElliottFrisch我不知道這個功能可以請你生成一個例子嗎? – NinjaStars
艾略特你還能告訴我怎麼做? – NinjaStars