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

AW: [iaik-ssl] DH key and NullPointerException



Hello,

> 1) Your demo applet contains the following code:
> SSLClientContext context = new SSLClientContext(

> (RSAPublicKey)PublicKeyStore.getPublicKey("RSA"),

> (DHPublicKey)PublicKeyStore.getPublicKey("DH"));

> However, the generated PublicKeyStore.java file creates only RSA key:

> public static PublicKey getPublicKey(String algorithm) {
>     if( algorithm.equals("RSA") ) return new RSAPublicKey(modulus,
exponent);
> //    if( algorithm.equals("DH") ) return new DHPublicKey(y, p, g);
>    return null;
> }

> How can I extract a DH key? And do I have to do it? RSA key is not enough?

If you want to use both, RSA and DH keys specify both options when running
ExtractKeys tool, e.g.:
java ExtractKeys PublicKeyStore.java -dh:dh.cer -rsa:rsa.cer

However, in praxis DH is hardly used.

> 2) When I run my test applet, I get the following exception in
> SSLConnection.startHandshake():

> java.lang.NullPointerException
> at iaik.applet.ssl.Random.nextByte(Random)
> at iaik.applet.ssl.Random.nextBytes(Random, Compiled Code)
> at iaik.applet.ssl.ClientHello.<init>(ClientHello)
> at
iaik.applet.ssl.ClientHandshaker.sendHandshakeMessages(ClientHandshaker)
> at iaik.applet.ssl.ClientHandshaker.doHandshake(ClientHandshaker)
> at iaik.applet.ssl.SSLConnection.startHandshake(SSLConnection)
> at com.test.Test$SendButtonAction.actionPerformed(Test.java:75)

Most likely you did not set a seed (see documentation, demos and Javadoc)

Regards,
Dieter Bratko



-----Ursprungliche Nachricht-----
Von: iaik-ssl-owner@iaik.tu-graz.ac.at
[mailto:iaik-ssl-owner@iaik.tu-graz.ac.at]Im Auftrag von Alex Ratner
Gesendet: Montag, 19. Februar 2001 20:35
Cc: iaik-ssl@iaik.tu-graz.ac.at
Betreff: [iaik-ssl] DH key and NullPointerException


Dieter Bratko wrote:

> Hello,
>
> [...]
> However, since ExtractKeys tool expects a version of iSaSiLk (2) no more
> available for downlaod, I attach a new version of ExtractKeys that can be
> run with the most recent version of iSaSiLk 3.
>
> Regards,
> Dieter Bratko
>

Thank you.
I run this new ExtractKeys program with my certificate file, and it
created the file PublicKeyStore.java containing public RSA key
from that certificate. Great.

But I still have two problems:

1) Your demo applet contains the following code:
SSLClientContext context = new SSLClientContext(

(RSAPublicKey)PublicKeyStore.getPublicKey("RSA"),

(DHPublicKey)PublicKeyStore.getPublicKey("DH"));

However, the generated PublicKeyStore.java file creates only RSA key:

public static PublicKey getPublicKey(String algorithm) {
    if( algorithm.equals("RSA") ) return new RSAPublicKey(modulus,
exponent);
//    if( algorithm.equals("DH") ) return new DHPublicKey(y, p, g);
    return null;
}

How can I extract a DH key? And do I have to do it? RSA key is not enough?

2) When I run my test applet, I get the following exception in
SSLConnection.startHandshake():

java.lang.NullPointerException
 at iaik.applet.ssl.Random.nextByte(Random)
 at iaik.applet.ssl.Random.nextBytes(Random, Compiled Code)
 at iaik.applet.ssl.ClientHello.<init>(ClientHello)
 at iaik.applet.ssl.ClientHandshaker.sendHandshakeMessages(ClientHandshaker)
 at iaik.applet.ssl.ClientHandshaker.doHandshake(ClientHandshaker)
 at iaik.applet.ssl.SSLConnection.startHandshake(SSLConnection)
 at com.test.Test$SendButtonAction.actionPerformed(Test.java:75)
 [...]

What can be the reason for this exception?
Can it be wrong RSA key? or lack of DH key?
My SSL server uses the same certificate, which I had used to extract public
RSA
key from.


--
Best regards,
Alex Ratner



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--
Mailinglist-archive at
http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content:
UNSUBSCRIBE iaik-ssl




smime.p7s