~brian-thomason/+junk/bouncycastle

« back to all changes in this revision

Viewing changes to jce/src/javax/crypto/spec/PBEParameterSpec.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 javax.crypto.spec;
 
2
 
 
3
import java.security.spec.AlgorithmParameterSpec;
 
4
 
 
5
/**
 
6
 * This class specifies the set of parameters used with password-based encryption (PBE), as defined in the
 
7
 * <a href="http://www.rsa.com/rsalabs/pubs/PKCS/html/pkcs-5.html">PKCS #5</a> standard.
 
8
 */
 
9
public class PBEParameterSpec
 
10
    implements AlgorithmParameterSpec
 
11
{
 
12
    private byte[]  salt;
 
13
    private int     iterationCount;
 
14
 
 
15
    /**
 
16
     * Constructs a parameter set for password-based encryption as defined in
 
17
     * the PKCS #5 standard.
 
18
     *
 
19
     * @param salt the salt.
 
20
     * @param iterationCount the iteration count.
 
21
     */
 
22
    public PBEParameterSpec(
 
23
        byte[]  salt,
 
24
        int     iterationCount)
 
25
    {
 
26
        this.salt = new byte[salt.length];
 
27
        System.arraycopy(salt, 0, this.salt, 0, salt.length);
 
28
 
 
29
        this.iterationCount = iterationCount;
 
30
    }
 
31
 
 
32
    /**
 
33
     * Returns the salt.
 
34
     *
 
35
     * @return the salt
 
36
     */
 
37
    public byte[] getSalt()
 
38
    {
 
39
        byte[]  tmp = new byte[salt.length];
 
40
 
 
41
        System.arraycopy(salt, 0, tmp, 0, salt.length);
 
42
 
 
43
        return tmp;
 
44
    }
 
45
 
 
46
    /**
 
47
     * Returns the iteration count.
 
48
     *
 
49
     * @return the iteration count
 
50
     */
 
51
    public int getIterationCount()
 
52
    {
 
53
        return iterationCount;
 
54
    }
 
55
}