Issue 29 in salmon-protocol: Mention need to remove leading zero bytes from modulus & exponent binary serializations

9 views
Skip to first unread message

salmon-...@googlecode.com

unread,
Dec 9, 2010, 5:39:35 PM12/9/10
to salmon-...@googlegroups.com
Status: Accepted
Owner: johnrobertpanzer

New issue 29 by johnrobertpanzer: Mention need to remove leading zero bytes
from modulus & exponent binary serializations
http://code.google.com/p/salmon-protocol/issues/detail?id=29

In the RSA key serialization, a first step is convert from an internal
integer representation of modulus and exponent to the standard network byte
order representations. This is ambiguous since it does not specify how to
handle leading zero bytes -- there are an infinite number of network byte
order serializations for any number (42, 042, 0042, 000042...). This is
important because we do bytewise comparison of keys and also in some cases
sha256 hashes.

Existing code assumes no leading zero bytes (all network byte order
representations are normalized so the first, leftmost, byte is always
nonzero). The specification should state this requirement explicitly.

(At least one Ruby library implementation sometimes generates leading zero
bytes due to processing data in larger-than-byte-sized-chunks, which is why
this issue came up.)

Ben Laurie

unread,
Dec 10, 2010, 10:00:57 AM12/10/10
to salmon-...@googlegroups.com
Ironic that we hit canonicalisation issues in a protocol designed to
avoid them :-)

salmon-...@googlecode.com

unread,
Jan 7, 2011, 7:58:41 PM1/7/11
to salmon-...@googlegroups.com
Updates:
Status: Fixed

Comment #1 on issue 29 by johnrobertpanzer: Mention need to remove leading

zero bytes from modulus & exponent binary serializations
http://code.google.com/p/salmon-protocol/issues/detail?id=29

Changed text to "Each of the components is first represented as an integer
in network byte order (big endian), with no leading zero bytes," to make
that step of the recipe unambiguous.

Reply all
Reply to author
Forward
0 new messages