public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException
@ 2006-04-20 20:53 r_ovidius at eml dot cc
2006-04-20 22:16 ` [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: r_ovidius at eml dot cc @ 2006-04-20 20:53 UTC (permalink / raw)
To: java-prs
Originally from jsch (jcraft.com)
com/jcraft/jsch/jce/DH.java
getE()
This function works in Sun's java, but on libgcj it fails. Here is a
standalone sample that works in Sun's java:
(I believe this used to work with gnu.crypto)
gcj (GCC) 4.2.0 20060419 (experimental)
gcj --main=Sec -o Sec Sec.java
./Sec
java.security.InvalidAlgorithmParameterException: params
at gnu.javax.crypto.jce.sig.DHKeyPairGeneratorSpi.initialize (libgcj.so.7)
at java.security.KeyPairGenerator.initialize (libgcj.so.7)
at Sec.main (Sec)
=====
public class Sec {
private static KeyPairGenerator myKpairGen;
private static KeyAgreement myKeyAgree;
private static BigInteger p;
private static BigInteger g;
private static BigInteger e; // my public key
private static byte[] e_array;
public static void main(String[] args) {
try {
myKpairGen = KeyPairGenerator.getInstance("DH");
myKeyAgree = KeyAgreement.getInstance("DH");
p = new
BigInteger("1797693134862315907708391567937874531978602960487560117064444236841971802161585193689478337958649255415021805654
859805036464405481992391000507928770033558166392295531362390765087357599148225748625750074253020774477125895509579377784244424266173347276
29299387668709205606050270810842907692932019128194467627007");
g = new BigInteger("2");
DHParameterSpec dhSkipParamSpec = new DHParameterSpec(p, g);
myKpairGen.initialize(dhSkipParamSpec);
KeyPair myKpair = myKpairGen.generateKeyPair();
myKeyAgree.init(myKpair.getPrivate());
// BigInteger
x=((javax.crypto.interfaces.DHPrivateKey)(myKpair.getPrivate())).getX();
byte[] myPubKeyEnc = myKpair.getPublic().getEncoded();
System.err.println(myPubKeyEnc);
e = ((javax.crypto.interfaces.DHPublicKey) (myKpair.getPublic())).getY();
e_array = e.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
}
}
--
Summary: java.security.InvalidAlgorithmParameterException
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: r_ovidius at eml dot cc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
2006-04-20 22:16 ` [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
@ 2006-04-20 22:16 ` tromey at gcc dot gnu dot org
2006-04-20 23:08 ` tromey at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-04-20 22:16 UTC (permalink / raw)
To: java-prs
------- Comment #2 from tromey at gcc dot gnu dot org 2006-04-20 22:16 -------
Created an attachment (id=11310)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11310&action=view)
updated test case
This is a version of the test case that compiles.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
@ 2006-04-20 22:16 ` tromey at gcc dot gnu dot org
2006-04-20 22:16 ` tromey at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-04-20 22:16 UTC (permalink / raw)
To: java-prs
------- Comment #1 from tromey at gcc dot gnu dot org 2006-04-20 22:16 -------
I see this with 4.2. 4.1 seems to work.
With jamvm and classpath cvs I see something else:
opsy. ~/workspace/classpath/install/bin/jamvm Sec
java.security.NoSuchAlgorithmException: DH
at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:115)
at Sec.main(Sec.java:17)
... which is curious since DH is definitely defined as a key pair generator
in GnuCrypto.java.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-04-20 22:16:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
2006-04-20 22:16 ` [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
2006-04-20 22:16 ` tromey at gcc dot gnu dot org
@ 2006-04-20 23:08 ` tromey at gcc dot gnu dot org
2006-04-20 23:14 ` [Bug crypto/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-04-20 23:08 UTC (permalink / raw)
To: java-prs
------- Comment #3 from tromey at gcc dot gnu dot org 2006-04-20 23:08 -------
Ok... I fixed a problem with my jamvm setup and now
I am seeing this with classpath cvs as well.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (2 preceding siblings ...)
2006-04-20 23:08 ` tromey at gcc dot gnu dot org
@ 2006-04-20 23:14 ` tromey at gcc dot gnu dot org
2006-04-21 2:30 ` csm at gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-04-20 23:14 UTC (permalink / raw)
To: java-prs
------- Comment #4 from tromey at gcc dot gnu dot org 2006-04-20 23:14 -------
Moving to Classpath.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libgcj |crypto
Product|gcc |classpath
Version|4.2.0 |0.90
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (3 preceding siblings ...)
2006-04-20 23:14 ` [Bug crypto/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
@ 2006-04-21 2:30 ` csm at gnu dot org
2006-04-21 5:02 ` r_ovidius at eml dot cc
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: csm at gnu dot org @ 2006-04-21 2:30 UTC (permalink / raw)
To: java-prs
------- Comment #5 from csm at gnu dot org 2006-04-21 02:30 -------
There's an `instanceof' check that I think is wrong in
gnu.javax.crypto.jce.sig.DHKeyPairGeneratorSpi.java, line 80:
-> if (! (params instanceof DHGenParameterSpec))
-> throw new InvalidAlgorithmParameterException("params");
The `DHKeyPairGeneratorSpi' class delegates the call to the class
`gnu.javax.crypto.key.dh.GnuDHKeyPairGenerator,' which looks to me like it can
handle both `DHParameterSpec' and `DHGenParameterSpec.' The `instanceof' above
should test for both kinds of parameters.
Also: why are Diffie Hellman classes in the `sig' package?
--
csm at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |csm at gnu dot org
Last reconfirmed|2006-04-20 22:16:04 |2006-04-21 02:30:18
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (4 preceding siblings ...)
2006-04-21 2:30 ` csm at gnu dot org
@ 2006-04-21 5:02 ` r_ovidius at eml dot cc
2006-04-21 6:37 ` csm at gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: r_ovidius at eml dot cc @ 2006-04-21 5:02 UTC (permalink / raw)
To: java-prs
------- Comment #6 from r_ovidius at eml dot cc 2006-04-21 05:02 -------
One of the first things I tried was to remove the instanceof check and see what
would happen, but it just lead to another exception (I don't recall what it
was).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (5 preceding siblings ...)
2006-04-21 5:02 ` r_ovidius at eml dot cc
@ 2006-04-21 6:37 ` csm at gnu dot org
2006-04-22 18:11 ` cvs-commit at developer dot classpath dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: csm at gnu dot org @ 2006-04-21 6:37 UTC (permalink / raw)
To: java-prs
------- Comment #7 from csm at gnu dot org 2006-04-21 06:37 -------
GnuDHKeyPairGenerator looks all-over wrong when you give it a DHParameterSpec.
It is generating an entirely new P and G, even when you explicitly set those
values. This is totally bogus; if you already have DH parameters, you don't
need to generate new ones, you use them to generate a key.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (6 preceding siblings ...)
2006-04-21 6:37 ` csm at gnu dot org
@ 2006-04-22 18:11 ` cvs-commit at developer dot classpath dot org
2006-04-22 19:18 ` david at jpackage dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at developer dot classpath dot org @ 2006-04-22 18:11 UTC (permalink / raw)
To: java-prs
------- Comment #8 from cvs-commit at developer dot classpath dot org 2006-04-22 18:11 -------
Subject: Bug 27228
CVSROOT: /cvsroot/classpath
Module name: classpath
Branch:
Changes by: Casey Marshall <rsdio@savannah.gnu.org> 06/04/22 17:57:19
Modified files:
. : ChangeLog
gnu/javax/crypto/jce/sig: DHKeyPairGeneratorSpi.java
gnu/javax/crypto/key/dh: GnuDHKeyPairGenerator.java
Log message:
2006-04-22 Casey Marshall <csm@gnu.org>
Fixes PR classpath/27228.
* gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java
(initialize): also accept `DHParameterSpec.'
* gnu/javax/crypto/key/dh/GnuDHKeyPairGenerator.java (setup):
handle a passed-in `DHParameterSpec' properly.
(generate): don't check if the random exponent is less than `q -
1' if no `q' was specified.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.7188&tr2=1.7189&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/javax/crypto/key/dh/GnuDHKeyPairGenerator.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (7 preceding siblings ...)
2006-04-22 18:11 ` cvs-commit at developer dot classpath dot org
@ 2006-04-22 19:18 ` david at jpackage dot org
2006-04-22 19:26 ` csm at gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: david at jpackage dot org @ 2006-04-22 19:18 UTC (permalink / raw)
To: java-prs
------- Comment #9 from david at jpackage dot org 2006-04-22 19:18 -------
Maybe we can consider moving these class before closing this bug? I am also
wondering why the are Diffie Hellman classes in the `sig' package. DH is not a
digital signature algorithm, unless we are accounting for the obvious
similarities between DH and DSA (but then, ElGamal is similar as well). But
then there are ElGamal classes are in javax.crypto.key.dh. How confusing can we
get?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (8 preceding siblings ...)
2006-04-22 19:18 ` david at jpackage dot org
@ 2006-04-22 19:26 ` csm at gnu dot org
2006-07-22 0:31 ` raif at swiftdsl dot com dot au
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: csm at gnu dot org @ 2006-04-22 19:26 UTC (permalink / raw)
To: java-prs
------- Comment #10 from csm at gnu dot org 2006-04-22 19:26 -------
I don't know; a confusing internal structure doesn't impact anyone trying to
use Classpath with their application, they'll just want their program to work.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (9 preceding siblings ...)
2006-04-22 19:26 ` csm at gnu dot org
@ 2006-07-22 0:31 ` raif at swiftdsl dot com dot au
2006-07-22 5:23 ` csm at gnu dot org
2006-07-24 10:58 ` raif at swiftdsl dot com dot au
12 siblings, 0 replies; 14+ messages in thread
From: raif at swiftdsl dot com dot au @ 2006-07-22 0:31 UTC (permalink / raw)
To: java-prs
------- Comment #11 from raif at swiftdsl dot com dot au 2006-07-22 00:31 -------
any objections to marking this PR as fixed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (10 preceding siblings ...)
2006-07-22 0:31 ` raif at swiftdsl dot com dot au
@ 2006-07-22 5:23 ` csm at gnu dot org
2006-07-24 10:58 ` raif at swiftdsl dot com dot au
12 siblings, 0 replies; 14+ messages in thread
From: csm at gnu dot org @ 2006-07-22 5:23 UTC (permalink / raw)
To: java-prs
------- Comment #12 from csm at gnu dot org 2006-07-22 05:23 -------
Subject: Re: java.security.InvalidAlgorithmParameterException
On Jul 21, 2006, at 5:31 PM, raif at swiftdsl dot com dot au wrote:
>
> ------- Comment #11 from raif at swiftdsl dot com dot au
> 2006-07-22 00:31 -------
> any objections to marking this PR as fixed?
>
Not from me. It would help if the OP could comment on whether or not
this fixed his problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug crypto/27228] java.security.InvalidAlgorithmParameterException
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
` (11 preceding siblings ...)
2006-07-22 5:23 ` csm at gnu dot org
@ 2006-07-24 10:58 ` raif at swiftdsl dot com dot au
12 siblings, 0 replies; 14+ messages in thread
From: raif at swiftdsl dot com dot au @ 2006-07-24 10:58 UTC (permalink / raw)
To: java-prs
------- Comment #13 from raif at swiftdsl dot com dot au 2006-07-24 10:58 -------
i'm marking this FIXED as per Casey's patch.
i've also added a Mauve testlet to validate the current codebase: TestOfPR27228
in gnu.testlet.gnu.javax.crypto.jce.
--
raif at swiftdsl dot com dot au changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27228
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2006-07-24 10:58 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-20 20:53 [Bug libgcj/27228] New: java.security.InvalidAlgorithmParameterException r_ovidius at eml dot cc
2006-04-20 22:16 ` [Bug libgcj/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
2006-04-20 22:16 ` tromey at gcc dot gnu dot org
2006-04-20 23:08 ` tromey at gcc dot gnu dot org
2006-04-20 23:14 ` [Bug crypto/27228] java.security.InvalidAlgorithmParameterException tromey at gcc dot gnu dot org
2006-04-21 2:30 ` csm at gnu dot org
2006-04-21 5:02 ` r_ovidius at eml dot cc
2006-04-21 6:37 ` csm at gnu dot org
2006-04-22 18:11 ` cvs-commit at developer dot classpath dot org
2006-04-22 19:18 ` david at jpackage dot org
2006-04-22 19:26 ` csm at gnu dot org
2006-07-22 0:31 ` raif at swiftdsl dot com dot au
2006-07-22 5:23 ` csm at gnu dot org
2006-07-24 10:58 ` raif at swiftdsl dot com dot au
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).