aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/java/org/spongycastle/crypto/params/TweakableBlockCipherParameters.java
blob: 2a12186eadd36eba5c669d495802718beaabc57e (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.spongycastle.crypto.params;

import org.spongycastle.crypto.CipherParameters;
import org.spongycastle.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;
    }
}