· 7 years ago · Nov 21, 2018, 10:02 PM
1/**
2 * Encrypts/Decrypts a string
3 *
4 * @author Leo Przybylski (leo [at] rsmart.com)
5 */
6public class EncryptionService {
7 public final static String ALGORITHM = "DES/ECB/PKCS5Padding";
8 public final static String HASH_ALGORITHM = "SHA";
9
10 private final static String CHARSET = "UTF-8";
11
12 protected SecretKey unwrapEncodedKey() throws Exception {
13 final byte[] bytes = new byte[] {-20, -128, -70, -29, 14, -92, 0, 0, 0};
14
15 final SecretKeyFactory desFactory = SecretKeyFactory.getInstance("DES");
16
17 final DESKeySpec keyspec = new DESKeySpec(bytes);
18 final SecretKey k = desFactory.generateSecret(keyspec);
19
20 return k;
21 }
22...
23...
24}