On Mon, Feb 06, 2006 at 10:50:18PM +0530, jimmy wrote: > majorsoul (sent by Nabble.com) wrote: > >why does the DER encoding of public key modulus begins with > >02 81 81 00 and not with 02 81 80 ?? > > ASN.1 specifies integers cannot be negative. so the leading zero makes > it positive.
Not quite; integers _can_ be negative in ASN.1. They are represented in 2s-complement, so a leading high bit signifies an negative number. So, when you want to encode a positive number that would happen to have the high bit set (such as a 8*n bit RSA modulus), you need to add a leading zero byte. -J ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
