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

RE: [iaik-jce] JCE Applet Edition reporting iaik.java.security.SignatureException: Not in signing state.



Andreas,

I am now using RSA and get the following error:

java.lang.RuntimeException: Method not supported.
	java.lang.Throwable(java.lang.String)
	java.lang.Exception(java.lang.String)
	java.lang.RuntimeException(java.lang.String)
	int iaik.pkcs.pkcs1.RSACipher.engineGetBlockSize()
	int javax.crypto.Cipher.getBlockSize()
	javax.crypto.CipherInputStream(java.io.InputStream, javax.crypto.Cipher,
int)
	javax.crypto.CipherInputStream(java.io.InputStream, javax.crypto.Cipher)
	void uk.co.iicl.gui.ConvertVisiBrokertoP12.butEncryptText_ActionPerformed()
	void
uk.co.iicl.gui.ConvertVisiBrokertoP12.connEtoC22(java.awt.event.ActionEvent)
	void
uk.co.iicl.gui.ConvertVisiBrokertoP12.actionPerformed(java.awt.event.ActionE
vent)
	void java.awt.Button.processActionEvent(java.awt.event.ActionEvent)
	void java.awt.Button.processEvent(java.awt.AWTEvent)
	void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
	void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
	void java.awt.EventDispatchThread.run()

from the following code:

try
{
	javax.crypto.Cipher privateCipher =
javax.crypto.Cipher.getInstance(privateKey.getAlgorithm());
	privateCipher.init(javax.crypto.Cipher.ENCRYPT_MODE, privateKey);
	javax.crypto.CipherInputStream privateCipherInputStream = new
javax.crypto.CipherInputStream(new
java.io.ByteArrayInputStream(getTxfTextToBeEncryptedByPrivateKey().getText()
.getBytes()), privateCipher);
	java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
	byte[] bytes = new byte[256];
	int status = privateCipherInputStream.read(bytes);
	while (status != -1)
	{
		baos.write(bytes, 0, status);
		status = privateCipherInputStream.read(bytes);
	}
	privateCipherInputStream.close();
	baos.flush();
	String encryptedPassword = baos.toString();
	baos.close();
	getTextArea1().setText(encryptedPassword);
}
catch (Exception e)
{
	GeneralStatic.handleError(null, e);
	getTextArea1().setText("Encryption failed - seek support!");
}

the privateKey variable is a RSA private key so privateKey.getAlgorithm()
gives "RSA".

Please help...

Regards

Dave
-----Original Message-----
From: iaik-jce-owner@iaik.tu-graz.ac.at
[mailto:iaik-jce-owner@iaik.tu-graz.ac.at]On Behalf Of Andreas Sterbenz
Sent: 22 September 1999 14:41
To: Dave Streeter - IICL Email; iaik-jce@iaik.tu-graz.ac.at
Subject: Re: [iaik-jce] JCE Applet Edition reporting
iaik.java.security.SignatureException: Not in signing state.


DSA is the Digital Signature Algorithm and it was designed for
signing/verifying only, it cannot be used for encryption. For asymmetric
encryption we currently support RSA and DH, although DH is of course a
key agreement scheme and cannot do real encryption.

 Andreas Sterbenz              mailto:Andreas.Sterbenz@iaik.tu-graz.ac.at

-----Ursprüngliche Nachricht-----
Von: Dave Streeter - IICL Email <dave.streeter@iicl.co.uk>
An: Andreas Sterbenz <Andreas.Sterbenz@iaik.tu-graz.ac.at>;
<iaik-jce@iaik.tu-graz.ac.at>
Gesendet: Mittwoch, 22. September 1999 12:26
Betreff: RE: [iaik-jce] JCE Applet Edition reporting
iaik.java.security.SignatureException: Not in signing state.


> Andreas,
>
> Thanks for that, now that I have encrypted the String how do I decrypt
it (I
> do have the X509 certificate accompanying the private and the public
keys)?
>
> Regards
>
> Dave
> -----Original Message-----
> From: iaik-jce-owner@iaik.tu-graz.ac.at
> [mailto:iaik-jce-owner@iaik.tu-graz.ac.at]On Behalf Of Andreas Sterbenz
> Sent: 22 September 1999 11:21
> To: Dave Streeter - IICL Email; iaik-jce@iaik.tu-graz.ac.at
> Subject: Re: [iaik-jce] JCE Applet Edition reporting
> iaik.java.security.SignatureException: Not in signing state.
>
>
> You can only either sign or verify, not both at the same time. The
> procedure to use is initSign(), update(), sign() (and for verify
> respectively).
>
>  Andreas Sterbenz
mailto:Andreas.Sterbenz@iaik.tu-graz.ac.at




--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce