summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/crypto/params/TweakableBlockCipherParameters.java
blob: fa16facdb2ace2e5970d30dd206d8bc5401ce6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.bouncycastle.crypto.params;

import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.util.Arrays;

/**
 * Parameters for tweakable block ciphers.
 */
public class TweakableBlockCipherParameters
    implements CipherParameters
{
    private final byte[] tweak;
    private final KeyParameter key;

    public TweakableBlockCipherParameters(final KeyParameter key, final byte[] tweak)
    {
        this.key = key;
        this.tweak = Arrays.clone(tweak);
    }

    /**
     * Gets the key.
     *
     * @return the key to use, or <code>null</code> to use the current key.
     */
    public KeyParameter getKey()
    {
        return key;
    }

    /**
     * Gets the tweak value.
     *
     * @return the tweak to use, or <code>null</code> to use the current tweak.
     */
    public byte[] getTweak()
    {
        return tweak;
    }
}