On Fri, Apr 09, 2004, tech wrote:
> 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;
> }
>
The problem is not the template but the fact that you are feeding invalid data
to it.
What exactly are you trying to do?
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]