~brian-thomason/+junk/bouncycastle

« back to all changes in this revision

Viewing changes to src/org/bouncycastle/crypto/params/ParametersWithSalt.java

  • Committer: Brian Thomason
  • Date: 2011-12-20 17:20:32 UTC
  • Revision ID: brian.thomason@canonical.com-20111220172032-rdtm13jgdxtksacr
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.bouncycastle.crypto.params;
 
2
 
 
3
import org.bouncycastle.crypto.CipherParameters;
 
4
 
 
5
/**
 
6
 * Cipher parameters with a fixed salt value associated with them.
 
7
 */
 
8
public class ParametersWithSalt
 
9
    implements CipherParameters
 
10
{
 
11
    private byte[]              salt;
 
12
    private CipherParameters    parameters;
 
13
 
 
14
    public ParametersWithSalt(
 
15
        CipherParameters    parameters,
 
16
        byte[]              salt)
 
17
    {
 
18
        this(parameters, salt, 0, salt.length);
 
19
    }
 
20
 
 
21
    public ParametersWithSalt(
 
22
        CipherParameters    parameters,
 
23
        byte[]              salt,
 
24
        int                 saltOff,
 
25
        int                 saltLen)
 
26
    {
 
27
        this.salt = new byte[saltLen];
 
28
        this.parameters = parameters;
 
29
 
 
30
        System.arraycopy(salt, saltOff, this.salt, 0, saltLen);
 
31
    }
 
32
 
 
33
    public byte[] getSalt()
 
34
    {
 
35
        return salt;
 
36
    }
 
37
 
 
38
    public CipherParameters getParameters()
 
39
    {
 
40
        return parameters;
 
41
    }
 
42
}