hi all
I am working in the ASN module in mozilla's NSS code.From the study i did i
came to analyse that SEC_ASN1EncodeItem is the top level function.
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.
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
doubt 3
-----------
the following comment is given for SEC_ASN1EncoderUpdate() .
/*
* This function is called whether or not we are streaming; if we
* *are* streaming, our caller can also instruct us to take bytes
* from the passed-in buffer (at buf, for length len, which is likely
* bytes but could even mean bits if the current field is a bit string).
* If we have been so instructed, we will gobble up bytes from there
* (rather than from our src structure) and output them, and then
* we will just return, expecting to be called again -- either with
* more bytes or after our caller has instructed us that we are done
* (for now) with the buffer.
i could'nt get the meaning of streaming
there is a field sec_asn1e_parse_status in the sec_EncoderContext_struct
the structure is defined below.
struct sec_EncoderContext_struct {
PRArenaPool *our_pool; /* for our internal allocs */
sec_asn1e_state *current;
sec_asn1e_parse_status status;
PRBool streaming;
PRBool from_buf;
SEC_ASN1NotifyProc notify_proc; /* call before/after handling field */
void *notify_arg; /* argument to notify_proc */
PRBool during_notify; /* true during call to notify_proc */
SEC_ASN1WriteProc output_proc; /* pass encoded bytes to this */
void *output_arg; /* argument to that function */
};
typedef enum {
allDone,
encodeError,
keepGoing,
needBytes
} sec_asn1e_parse_status;
what does keepGoing,needBytes means in sec_asn1e_parse_status .
Thanks in advance
Bye Bonny Joy
_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com