# Re: CipherOutputStream flush() bug

Jan Luehe (Jan.Luehe@Eng)
Fri, 30 Jan 1998 10:06:43 -0800 (PST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: john MacNeille: "problem with key agreement"
- Previous message: Devi, Rama: "SIGNING JAR FILES"
- Maybe in reply to: Jonathan Knudsen: "CipherOutputStream flush() bug"

    Date: Fri, 30 Jan 1998 10:06:43 -0800 (PST)

    From: Jan Luehe <Jan.Luehe@Eng>

    Subject: Re: CipherOutputStream flush() bug

    To: java-security@web1.javasoft.com, jonathan@oreilly.com

Jonathan:

> I believe I've isolated a bug in CipherOutputStream's
> flush() method. Specifically, I'm trying to use DES/CFB8
> with cipher streams to transmit single bytes over a socket
> connection. When I call flush() on the CipherOutputStream,
> the data gets mangled somehow. There's a test class at
> the bottom of this message so you can reproduce the problem.

I have changed the semantics of "flush", so it no longer resets
the encapsulated Cipher, but only write any buffered data to
the underlying output stream.

Your test program now runs correctly:

java FlushBug
Flushing will not be done.
Creating a SecureRandom...please be patient.
a -> a
b -> b
c -> c
d -> d
e -> e
f -> f
Flushing will be done.
Creating a SecureRandom...please be patient.
a -> a
b -> b
c -> c
d -> d
e -> e
f -> f

This fix will be included in the upcoming JCE 1.2 beta release.
Thanks for pointing this out.

Jan

- Next message: john MacNeille: "problem with key agreement"
- Previous message: Devi, Rama: "SIGNING JAR FILES"
- Maybe in reply to: Jonathan Knudsen: "CipherOutputStream flush() bug"