This project has retired. For details please refer to its
Attic page.
AES256Cryptor xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.v3.client.cryptor;
18
19 import java.io.UnsupportedEncodingException;
20 import java.security.InvalidAlgorithmParameterException;
21 import java.security.InvalidKeyException;
22 import java.security.NoSuchAlgorithmException;
23 import java.security.spec.InvalidKeySpecException;
24
25 import javax.crypto.BadPaddingException;
26 import javax.crypto.IllegalBlockSizeException;
27 import javax.crypto.NoSuchPaddingException;
28
29
30
31
32
33
34
35 public class AES256Cryptor extends AESCryptorAbstract {
36
37
38
39
40 public AES256Cryptor()
41 throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException {
42 super();
43 }
44
45 @Override
46 protected String getKey() {
47
48 String key = CryptorFactory.loadKeyFromFile("AES256Cryptor");
49 if (key != null) {
50 return key;
51 } else {
52 return "ef057ce3abd9dd9a161a2888c9d7025f104a42eceda5947b083186e7190fcc46";
53 }
54 }
55
56 @Override
57 public String encrypt(String str) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
58 return super.encrypt(str);
59 }
60
61 @Override
62 public String decrypt(String str) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
63 return super.decrypt(str);
64 }
65
66 @Override
67 public String newKey() {
68 return GEN(256);
69
70 }
71 }