> On Tue 12/05/09 1:14 PM , Harm Verhagen [email protected] sent: >As known on the openssl mailinglists there is a difference in byte order >between openssl and MS cryptoAPI, >when doing RSA encryption. >Googling around I find many references to claims that "openssl is PKCS#1 >compliant (big-endian)" "MS is >wrong" "just reverse your bytes". >I was about to settle with that: "OK, MS got it reversed compared to the rest >of the world... what else is new" > >Then I decided to actually read the rfc. [1] as these kind of issues >typically are very clearly specified. >When carefully reading chapter 7.2.1 encryption >It describes how to generate the ciphertext representative c. (an integer) >And then how to encode that integer using I2OSP which is described in 4.1. >Reading chapter 4.1 I2OSP >It states that the encrypted output is an octet string >X = X_1 X_2 ... X_xLen. >Where X_1 is the least significant octet of the ciphertext representative.
4 Data Conversion primitives ... For the purposes of this document, and consistent with ASN.1 syntax, an octet string is an ordered sequence of octets (eight-bit bytes). The sequence is ordered from first (conventionally, leftmost) to last (rightmost). For pupose to and from integers, the first octet is considered the most significant in the following conversion primitives. Looks fairly straightforward to me... Also MS "admits" that they are wrong implictly by stating that the bytes must be reversed for interoperability with just about everything else... Carl ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [email protected]
