blob: 471bc7734b55144d67066168e0d06a0a33f70ae6 (
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
41
42
43
|
package org.bouncycastle.jcajce;
import javax.crypto.SecretKey;
import org.bouncycastle.crypto.PBEParametersGenerator;
public class PKCS12Key
implements SecretKey
{
private final char[] password;
/**
* Basic constructor for a password based key - secret key generation parameters will be passed separately..
*
* @param password password to use.
*/
public PKCS12Key(char[] password)
{
this.password = new char[password.length];
System.arraycopy(password, 0, this.password, 0, password.length);
}
public char[] getPassword()
{
return password;
}
public String getAlgorithm()
{
return "PKCS12";
}
public String getFormat()
{
return "RAW";
}
public byte[] getEncoded()
{
return PBEParametersGenerator.PKCS12PasswordToBytes(password);
}
}
|