# Re: FCS coming up?

Jan Luehe (Jan.Luehe@Eng)
Mon, 8 Mar 1999 20:17:57 -0800 (PST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: David Brownell: "Re: FCS coming up?"
- Previous message: Frank Yellin: "FCS coming up?"
- Maybe in reply to: Frank Yellin: "FCS coming up?"
- Next in thread: David Brownell: "Re: FCS coming up?"

    Date: Mon, 8 Mar 1999 20:17:57 -0800 (PST)

    From: Jan Luehe <Jan.Luehe@Eng>

    Subject: Re: FCS coming up?

    To: java-security@java.sun.com, Frank.Yellin@Eng

Frank:

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

Only if you have any major issues.
JCE 1.2 has been out in pre-FCS state for too long,
so we really want to ship it now, and a lot of cutomers
are pushing for it.

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

No, the issue here is that you are trying to initialize for decryption
in OFB mode. OFB mode requires an IV. You did not supply one.
Therefore, you get an exception.

If you look at the spec, it says (for Cipher.init(mode, key)):

* <p>If this cipher requires any algorithm parameters that cannot be
* derived from the given <code>key</code>, the underlying cipher
* implementation is supposed to generate the required parameters itself
* (using provider-specific default or random values) if it is being
* initialized for encryption, and raise an
* <code>InvalidKeyException</code> if it is being
* initialized for decryption.

Jan

- Next message: David Brownell: "Re: FCS coming up?"
- Previous message: Frank Yellin: "FCS coming up?"
- Maybe in reply to: Frank Yellin: "FCS coming up?"
- Next in thread: David Brownell: "Re: FCS coming up?"