On 5/29/06, Dr. Stephen Henson <[EMAIL PROTECTED]> wrote:
On Mon, May 29, 2006, Saurabh Arora wrote:
> hi all
>
> heres another lead , but with few problems :
>
> using this function we can set the type :
> ---------
> void ASN1_TYPE_set(a,type,value)
> ----------
> where
> ASN1_TYPE *a;
> int type;
> char *value;
>
> so wen i try this with the type - V_ASN1_SEQUENCE,
> what should i add in the field (char *)value ??
>
> do i have to convert ATTRIBUTE1 and 2 into octet strings using i2d
> functions to set the type ??
>
You have to generate the encoding of the attribute and place it in an
ASN1_STRING structure using the type V_ASN1_SEQUENCE .
The decoding process is similar except you have to check the type is
V_ASN1_SEQUENCE then deocde it based on the contents of the ASN1_STRING.
thanks for help.
i carried out the encoding :
----------------------------
ASN1_STRING *os;
ATTRIBUTE1 attr;
unsigned char * p,*q;
int n;
n = i2d_ATTRIBUTE1(attr,NULL);
p = (char *)OPENSSL_malloc(n);
q=p;
i2d_TPMSPECIFICATION(tpm,&p);
os = ASN1_STRING_type_new(V_ASN1_SEQUENCE);
os->data = q;
os->length = n;
ASN1_TYPE_set(one,V_ASN1_SEQUENCE,os);
fp = open ("outFile", O_WRONLY|O_CREAT, 0700);
write (fp, p, n);
close (fp);
--------------------------------
, but i am unable to find a way for decoding .
can you tell the way.. how to check the type V_ASN1_SEQUENCE .
regards
tanish
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]