gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU Crypto] Re: [Classpathx-crypto] Problem/Bug in gnu-crypto-1.0.0


From: Casey Marshall
Subject: [GNU Crypto] Re: [Classpathx-crypto] Problem/Bug in gnu-crypto-1.0.0
Date: Tue, 05 Nov 2002 18:56:08 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stefan Prelle wrote:

- From now on the gnu-crypto mailing list is address@hidden

> Hi,
>
> I just encountered the following exception while playing around
> with gnu-crypto-1.0.0:
>
> The gnu.crypto library and the JDK disagree on whether
> 0xde09f1902cf484f232fee5d27262372d1c6072d7 is a probable prime
> or not. While this library claims it is, the JDK claims the
> opposite.

This part just says that the prime tester in the GNU library found a
probable prime that the JDK's algorithm claims isn't. This is a known
bug in Sun's implementation of the java.math library:

http://developer.java.sun.com/developer/bugParade/bugs/4624738.html

> Please contact the maintainer of this library, and provide this
message for further investigation. TIA
> Exception in thread "main" java.lang.ArithmeticException: Negative
exponent
>       at java.math.BigInteger.pow(BigInteger.java:1257)
>       at
gnu.crypto.sig.dss.DSSKeyPairGenerator.generateParameters(DSSKeyPairGenerator.java:362)
>       at
gnu.crypto.sig.dss.DSSKeyPairGenerator.generate(DSSKeyPairGenerator.java:245)
>
> The conflicting source code was:
>       public LocalPeerGenerator() throws NoSuchAlgorithmException {
>       IKeyPairGenerator keyGen =
KeyPairGeneratorFactory.getInstance(KeyPairGeneratorFactory.DSS_KPG);
>       KeyPair pair = keyGen.generate();
>       }
>
>
> Am I too stupid to use the library or did I find a bug?
>

The key pair generator (like most of the algorithms in GNU crypto) needs
to be initialized first. For the key pair generator classes, this is the
setup(java.util.Map) method.

The Map is a mapping between keys, such as
gnu.crypto.sig.dss.DSSKeyPairGenerator.MODULUS_LENGTH, and parameters,
which in the case of MODULUS_LENGTH is a java.lang.Integer.

If you want to use the default values, do a call similar to:

   keyGen.setup(new java.util.HashMap());

sometime before you call generate().

The cause of the exception is because the DSS parameter L is 0 when the
factory is not initialized, and this is obviously not an appropriate
value for this parameter.

Cheers,

- --
Casey Marshall < address@hidden > http://metastatic.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQE9yITHgAuWMgRGsWsRAk0lAJ9d/ut2HrG+ZZ1cH4IfnqYFfXuP1gCfSZtv
+Yn2XS/ydCD0ICjYhh4kQ4U=
=UTtt
-----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]