I want to convert this hex string into raw binary file using BIGNUM's BN_bn2bin function
BN_hex2bn(&asn1hash, "3031300D060960864801650304020105000420BC5F9353CBB9DCAE86B9F8F68C1C95856DB836ACA2E00C9319716CDF4DD0F5BA");
char *buf = (unsigned char *)malloc(BN_num_bytes(asn1hash));
BN_bn2bin(asn1hash, buf);
FILE *fp;
fp = fopen("ASn1Hash","wb+");
fputs(buf, fp);
fclose(fp);
But why is it that only "30 31 30 0D 06 09 60 86 48 01 65 03 04 02 01 05" is ever outputted into the file?