bonny joy wrote: > I am working in the ASN module in mozilla's NSS code.
What work are you doing in that module? > From the study i did i > came to analyse that SEC_ASN1EncodeItem is the top level function. It is _a_ top level function. There are others. > SECItem * > SEC_ASN1EncodeItem (PRArenaPool *poolp, SECItem *dest, void *src, > const SEC_ASN1Template *theTemplate) > > I have some doubts in the implementation. > doubt 1 > ---------- > we can encode if we mention a structure *src and the corresponding > SEC_ASN1Template *theTemplate. > > Why different modules like pkcs 7 is using there on ASN encode functions.why > cant those > modules can directly call SEC_ASN1EncodeItem. NSS has two ASN.1 encoders. One is newer than the other. Different parts of the NSS code use different encoders dependening on when they were written and what they are trying to do. > doubt 2 > ------------ > > SEC_ASN1Encode calls > SEC_ASN1EncoderUpdate (SEC_ASN1EncoderContext *cx,const char *buf, unsigned > long len) > > here *buf,len are always Null and 0 > > why it is always NULL and zero Because SEC_ASN1Encode does not handle streaming input. buf and len are for streaming input. > doubt 3 > ----------- > > the following comment is given for SEC_ASN1EncoderUpdate() . > > /* > * This function is called whether or not we are streaming; [snip] > > i could'nt get the meaning of streaming It is possible to encode and decode items that are not entirely present in memory all at one time. It is possible to read in a little bit of data, en/decode it, output any intermediate results, and repeat this process until done. This is known as streaming. > there is a field sec_asn1e_parse_status in the sec_EncoderContext_struct > > the structure is defined below. > what does keepGoing,needBytes means in sec_asn1e_parse_status . These are states of the streaming parser. They indicate that the parser is in the middle of encoding data, and either it should continue going, or that it has exhausted the available input (to be encoded) and should wait for more data to be encoded (e.g. in a future call to SEC_ASN1EncoderUpdate). -- Nelson Bolyard Netscape Communications (subsidiary of AOL) Disclaimer: I speak for myself, not for Netscape
