# latest on initialisation vectors...

David Hook (dgh@aba.net.au)
Mon, 10 Aug 1998 12:00:21 +1000

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Antonello Di Gioia: "Download troubleshooting"
- Previous message: Greg Wolff: "Upgrade keystore from 1.2beta2 to 1.2beta4"

    Date: Mon, 10 Aug 1998 12:00:21 +1000

    From: David Hook <dgh@aba.net.au>

    To: java-security@java.sun.com, dgh@aba.net.au

    Subject: latest on initialisation vectors...

I've been trying to find a sensible way to deal with IV's which are inline (ie. at
the start of the encyrpted stream, possibly encrypted themselves). In the light
of the latest release I've been reevaluating what I did previously, and am now
heading this way...

I've defined a class InlineIvParameterSpec, as follows:

/**
* specfies that the IV is in the encrypted stream, and how we calculate it.
*/
public class InlineIvParameterSpec implements AlgorthmParameterSpec
{
private boolean encrypted;

public InlineIvParameterSpec()
{
encrypted = false;
}

public InlineIvParameterSpec(
boolean encrypted)
{
this.encrypted = encrypted;
}

public boolean isEncryptedIv()
{
return encrypted;
}
}

The presence of the class in the algorithm parameters for the cipher tells the cipher
to swallow the first block and use it as an IV, possibly decrypting it first. If the cipher
is encrypting the IV gets written out before anything else, possibly being encrypted.
I use the new getParameters call when I have to propogate the information.

It took a few tries but it seems to work in the spirit of things. Comments anyone?

Thanks,

David.

- Next message: Antonello Di Gioia: "Download troubleshooting"
- Previous message: Greg Wolff: "Upgrade keystore from 1.2beta2 to 1.2beta4"