# FCS coming up?

Frank Yellin (fy@awe181-20.Sun.COM)
Mon, 8 Mar 1999 19:42:22 -0800

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Jan Luehe: "Re: FCS coming up?"
- Previous message: Garrison M. Venn: "Re: CFB mode problems"
- Next in thread: Jan Luehe: "Re: FCS coming up?"

    Date: Mon, 8 Mar 1999 19:42:22 -0800

    Message-Id: <199903090342.TAA00431@awe181-20.>

    From: Frank Yellin <fy@awe181-20.Sun.COM>

    To: java-security@java.sun.com

    Subject: FCS coming up?

FCS is coming up? Does that mean you want me to quickly report
bugs and inconsistencies, or not to both you with them for the
near future?

I'll also report one other questionable feature. . .

I discovered that the code below gives me an error:

private static final String secretKeyType = "DES";
private static final String secretCipherType = "DES/OFB8/NoPadding";
....

KeyGenerator keyGen = KeyGenerator.getInstance(secretKeyType);
keyGen.init(new SecureRandom());
SecretKey key = keyGen.generateKey();
Cipher cipher = Cipher.getInstance(secretCipherType);
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, key);

Apparently, OFB ciphers only wanted to be called with ENCRYPT_MODE.

I kind of understand the technical reason for this, but from a user
interface point of view, it's all wrong.

It's not that an OFB cipher doesn't do decryption, it's that for an
OFB cipher, encryption and decryption are the same thing.

I can imagine a user utility package that has things like:

byte[] encryptObject(cipherType, Key, Object)
Object decryptObject(byte[], cipherType, Key)

Is the decryptObject supposed to call

cipher.init(javax.crypto.Cipher.DECRYPT_MODE, key);
or cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key); ?

>From a logical point of view, I'm decrypting. And I don't want to have
to parse the cipher type.

The fact that stream ciphers happen to decrypt by using the engine in an
enciphering mode is >>under the hood<<.

== Frank

- Next message: Jan Luehe: "Re: FCS coming up?"
- Previous message: Garrison M. Venn: "Re: CFB mode problems"
- Next in thread: Jan Luehe: "Re: FCS coming up?"