One leading NUL byte in RSA key modulus

Jim Lloyd jlloyd at
Wed Mar 28 22:23:06 CEST 2012


I am nearly done porting our application to use gnutls 2.12 instead of 2.8.
We have a reasonably decent set of unit tests, nearly all of which pass
without requiring any changes. However, there are two failing tests that I
find curious.

First, we have a function that user gnutls_x509_privkey_export_rsa_raw to
return the size in bytes of the modulus of a private key. One specific unit
test simply asserts that the size of a given test key is 128 bytes. That
test fails because the actual size of the key is now 129 bytes.

We have another test that uses gnutls_x509_crt_print to print a human
readable description of a certificate. The test simply verifies the output
is identical to an expected string. That test fails because the modulus now
shows an additional leading 00 byte. For example:

                Modulus (bits 1024):

In addition, the Public Key Id output by gnutls_x509_crt_print has changed
to be an entirely different hash.

If I change the expected results in these two unit tests to reflect these
changes, then my all of our unit tests completely pass. Still, it seems odd
to me that this behavior has changed. Is the change completely benign? What
was the reason for the change?

Jim Lloyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20120328/92547387/attachment.htm>

More information about the Gnutls-devel mailing list