diff --git a/src/com/belkast/soap/secretProcessor.java b/src/com/belkast/soap/secretProcessor.java deleted file mode 100644 index f09ac45..0000000 --- a/src/com/belkast/soap/secretProcessor.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.belkast.soap; - -import java.util.Base64; -import java.security.Key; -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; - -public class secretProcessor - { - private static final String ALGORITHM = "AES"; - - public static byte[] encrypt(String thisKey, String valueToEnc) throws Exception - { - byte[] varKey = thisKey.getBytes(); - Key key = generateKey(varKey); - Cipher c = Cipher.getInstance(ALGORITHM); - c.init(1, key); - byte[] encValue = c.doFinal(valueToEnc.getBytes()); - return encValue; - } - - public static String decrypt(String thisKey, byte[] encryptedValue) throws Exception - { - byte[] varKey = thisKey.getBytes(); - Key key = generateKey(varKey); - Cipher c = Cipher.getInstance(ALGORITHM); - c.init(2, key); - byte[] decValue = c.doFinal(encryptedValue); - String decryptedValue = new String(decValue); - return decryptedValue; - } - - public static String encode(byte[] value) throws Exception - { - String encryptedValue = Base64.getEncoder().encodeToString(value); - return encryptedValue; - } - - public static byte[] decode(String encryptedValue) throws Exception - { - byte[] decordedValue = Base64.getDecoder().decode(encryptedValue); - return decordedValue; - } - - private static Key generateKey(byte[] varKey) throws Exception - { - Key key = new SecretKeySpec(varKey, "AES"); - return key; - } - } \ No newline at end of file