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

[iaik-jce]



Hello,

I'm working with  iaik.pkcs.pkcs7.EnvelopedDataStream  class.
I'm working with this code:
(I have already setted RecipientInfo[]  for only a recipient)

        	AlgortihmID algID = Algortihm.des_CBC;
	Cipher c = (Cipher) algID.getInstance();
            byte[] bytes = new byte[c.getBlockSize()];
            java.util.Random random = new java.util.Random();
            random.nextBytes(bytes);
            String s = new String(bytes);

	GeneralString generalString = new GeneralString(s);
            algID.setParameter(generalString);

	EnvelopedDataStream enveloped_data = new EnvelopedDataStream(is, algID);
  	enveloped_data.setRecipientInfos(recipients);

  	enveloped_data.writeTo(os );

On recipient   side  I wrote: (os -----> is)

  	EnvelopedDataStream envelop_data = new EnvelopedDataStream(is);
	PrivateKey pk = ........(the rigth public key)
            envelop_data.setupCipher(pk, 0);

but  this exception throws:

iaik.pkcs.PKCSException: Unable to get algorithm parameter!
   at iaik.pkcs.pkcs7.EncryptedContentInfoStream.setupCipher(Unknown Source)
   at iaik.pkcs.pkcs7.EnvelopedDataStream.setupCipher(Unknown Source)
   at
it.cefriel.cosmos.pse.PSEServerImpl.extractEnvelopedData(PSEServerImpl.java:
1916)
   at
it.cefriel.cosmos.pse.PSEServerImpl_Skel.dispatch(PSEServerImpl_Skel.java:80
3)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:164)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:161)
   at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:593)
   at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:499)
   at java.lang.Thread.run(Thread.java:474)

I think I have setted  algorithm parameters  in a bad way but
I  don't find other solution.
Suggested me  one., please

Thank you,

Vito

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