[gnutls-help] too few bits from gnutls_dh_params_generate2() ?
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Nov 10 22:48:13 CET 2014
On Mon 2014-11-10 08:25:56 -1000, Pierre Ossman wrote:
> We're having some interoperability issues between Java's SSLEngine and
> GnuTLS in TigerVNC.
what version of Java and its SSLEngine are you using?
> Java will throw this at us sometimes (actually, rather often):
>> Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 2048 (inclusive)
>> at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120)
>> at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:658)
>> at sun.security.ssl.DHCrypt.<init>(DHCrypt.java:127)
>> ... 10 more
> After some debugging it turns out that the failing criteria is that
> multiple of 64 bits requirement. For some reason I've gotten a 1023
> bit prime, even though I called gnutls_dh_params_generate2() with 1024
> as the argument.
ugh. Java is at fault here -- there's no sense in this particular
severe limitation. if they're willing to use 512-bit DHE parameters and
1024-bit DHE parameters, they should be willing to use 1023-bit DHE
That said, i suppose it's possible that gnutls could always ensure that
the high bit is set when generating a prime of a given size.
> One example set of parameters I've gotten:
>> TLS: DH prime:
>> TLS: DH generator:
>> TLS: DH bits: 158
what is this output from? I'm not sure how to reconcile the "DH bits:
158" with the other data.
> This is with GnuTLS 3.2.15 and nettle 2.7.1 on Windows.
> Who's to blame here? GnuTLS? Java? Us? Everybody? :)
> And what do I do about it? Keep calling gnutls_dh_params_generate2()
> until I get what I need?
arguably, gnutls could keep the high bit set in its generated primes,
just to coddle broken peers like this java implementation.
>  Is that even a valid requirement? I cannot find any reference for
> this except that Java code.
have you reported this bug to java? it sounds like they should not be
More information about the Gnutls-help