From: Hartmut K. <har...@ha...> - 2007-10-19 10:25:31
|
Dear all I want to add something important concerning my problem. If I use non-streaming example-files like EncryptAndSign.java or DecryptAndVerify.java there is no exception. I just get the exception message by using streaming-classes for encrypting/signing AND for decrypting/verifying. You can get the data-file data.dat.9 which produces the error at www.hauk-sasko.de/data.dat.9 thanks a lot anybody trying to reproduce the exception behaviour and - hopefully - finding out the problem. Regards, Hartmut Again, my problem: Dear all, I tried to use the example-files StreamEncryptSign.java and StreamDecryptVerify.java to encrypt/sign and decrypt/verify a binary file. Therefor, in the file StreamEncryptSign.java I changed the part: for (int i=0; i<10000; i++) // we write to literal litmos.write( (i+" This is a large message. \r\n").getBytes() ); litmos.close(); in File f = new File("data.dat.9"); FileInputStream fileis = new FileInputStream(f); byte[] buf = new byte[(int) f.length()]; fileis.read(buf); litmos.write(buf); fileis.close(); litmos.close(); By using StreamDecryptVerify.java for decrypting/verifying the encrypted and signed binary file I get the following messages: Decoding message... cryptix.openpgp.PGPFatalDataFormatException: Read tried past end of inputstream at cryptix.openpgp.io.PGPLengthDataInputStream.readDirect(PGPLengthDataInputStream.java:123) at cryptix.openpgp.io.PGPLengthDataInputStream.readInternal(PGPLengthDataInputStream.java:159) at cryptix.openpgp.io.PGPLengthDataInputStream.readBuffer(PGPLengthDataInputStream.java:286) at cryptix.openpgp.io.PGPLengthDataInputStream.readBuffer(PGPLengthDataInputStream.java:250) at cryptix.openpgp.io.PGPLengthDataInputStream.readByteArray(PGPLengthDataInputStream.java:320) at cryptix.openpgp.packet.PGPSignaturePacket.decodeBody(PGPSignaturePacket.java:507) at cryptix.openpgp.provider.PGPDecodedMessageInputStream$SignedLiteralInputStream.verify(PGPDecodedMessageInputStream.java:732) at cryptix.openpgp.provider.PGPDecodedMessageInputStream.engineClose(PGPDecodedMessageInputStream.java:485) at cryptix.message.stream.DecodedMessageInputStream.close(DecodedMessageInputStream.java:162) at cryptix.openpgp.examples.StreamDecryptVerify.run(StreamDecryptVerify.java:138) atcryptix.openpgp.examples.StreamDecryptVerify.main(StreamDecryptVerify.java:64) Streaming the message failed. cryptix.message.stream.MessageStreamException: cryptix.openpgp.PGPFatalDataFormatException: Read tried past end of inputstream. at cryptix.openpgp.provider.PGPDecodedMessageInputStream$SignedLiteralInputStream.verify(PGPDecodedMessageInputStream.java:737) atcryptix.openpgp.provider.PGPDecodedMessageInputStream.engineClose(PGPDecodedMessageInputStream.java:485) at cryptix.message.stream.DecodedMessageInputStream.close(DecodedMessageInputStream.java:162) at cryptix.openpgp.examples.StreamDecryptVerify.run(StreamDecryptVerify.java:138) at cryptix.openpgp.examples.StreamDecryptVerify.main(StreamDecryptVerify.java:64) Does anybody have an idea, why this happens ? Thanks a lot Cheers Hartmut |