Hello All,

                How to use and create ASN1_TEMPLATE? I have to use
ASN1_TEMPLATE structure in ASN1_template_d2i function.

The following program fails:

#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/asn1.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>

int main()
{
 const ASN1_ITEM *it=NULL;
 ASN1_VALUE *pval = (ASN1_VALUE *)BN_new();
 unsigned char *str=(unsigned char *)"TEST";
 long len=5000;

 // int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len,
const ASN1_TEMPLATE *tt)
 assert( ASN1_template_d2i(&pval,&str,len,ASN1_ITEM_rptr(RSAPrivateKey)) !=
0 );
 return 0;
}

Regs,
Rao.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.654 / Virus Database: 419 - Release Date: 4/7/2004

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to