siebertm (owner)

Revisions

gist: 127096 Download_button fork
public
Public Clone URL: git://gist.github.com/127096.git
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class Key {
    protected SecretKey key;
 
    public Key(String password, String salt) throws NoSuchAlgorithmException, InvalidKeySpecException {
        PBEKeySpec ks = new PBEKeySpec(password.toCharArray(), salt.getBytes(), 1000);
        SecretKeyFactory kf = SecretKeyFactory.getInstance("PBEWithSHA1AndDESede");
        key = kf.generateSecret(ks);
 
    }
 
    public SecretKey getKey() {
        return key;
    }
}