1package org.bouncycastle.crypto.params;
2
3import org.bouncycastle.crypto.CipherParameters;
4
5public class AEADParameters
6    implements CipherParameters
7{
8    private byte[] associatedText;
9    private byte[] nonce;
10    private KeyParameter key;
11    private int macSize;
12
13    /**
14     * Base constructor.
15     *
16     * @param key key to be used by underlying cipher
17     * @param macSize macSize in bits
18     * @param nonce nonce to be used
19     */
20   public AEADParameters(KeyParameter key, int macSize, byte[] nonce)
21    {
22       this(key, macSize, nonce, null);
23    }
24
25    /**
26     * Base constructor.
27     *
28     * @param key key to be used by underlying cipher
29     * @param macSize macSize in bits
30     * @param nonce nonce to be used
31     * @param associatedText initial associated text, if any
32     */
33    public AEADParameters(KeyParameter key, int macSize, byte[] nonce, byte[] associatedText)
34    {
35        this.key = key;
36        this.nonce = nonce;
37        this.macSize = macSize;
38        this.associatedText = associatedText;
39    }
40
41    public KeyParameter getKey()
42    {
43        return key;
44    }
45
46    public int getMacSize()
47    {
48        return macSize;
49    }
50
51    public byte[] getAssociatedText()
52    {
53        return associatedText;
54    }
55
56    public byte[] getNonce()
57    {
58        return nonce;
59    }
60}
61