[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.



I am not quite sure what you want to do. If you want to password encrypt
a private key use iaik.pkcs.pkcs8.EncryptedPrivateKeyInfo.

Otherwise you should use a symmetric cipher to encrypt data. RSA is not
designed to be used for bulk data encryption, both for performance and
for security reasons. Our RSACipher implementation is just a
pseudo-cipher that only always does one RSA operation.

Regards,

 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 17:37
Betreff: 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.ActionEve
nt)
> void
>
uk.co.iicl.gui.ConvertVisiBrokertoP12.actionPerformed(java.awt.event.Acti
onE
> 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().getTex
t()
> .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



smime.p7s