Thanks for explaning the correct method.
Also it would be very much helpful if can provide me some algorithm
which takes some integer(max 4 bytes value) as input and should return the length needed for ASN1 BER encoding.

Could any one help me in finding thos algorithm.

I did already in a separate email. I wrote

===

It would be very much useful
to me if u can provide me some algorithm which encode an ASN integer

If the integer is between -128 and +127, move the rightmost byte.

If the integer is between +128 and +32767, or between -129 and -32768, move the rightmost two bytes.

Etc.

You can also just start from the left like this:
- examine the bytes from the left one at a time;
- if it's 0x00 or 0xFF, go to the next byte;
- if it isn't 0x00 or 0xFF, copy it and the rest of the bytes to its right;
- if all you have is 0x0000000 or 0xFFFFFFFF, then copy the single
byte 0x00 or 0xFF.

_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to