package admin.server.decryptlog;


import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;

public class ShiperKey implements ShiperInter {

    private String key;
    private final String initVector = "fhDN7oxj$dfymY3n";
    private final String algorithm = "AES/CBC/PKCS5Padding";

    @Override
    public IvParameterSpec getIvKey() throws UnsupportedEncodingException {
        IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8")); // initVector
        return iv;
    }

    @Override
    public SecretKeySpec getSkeySpec() throws UnsupportedEncodingException {
        SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");

        return skeySpec;
    }

    @Override
    public String getAlgorithm() {
        return algorithm;
    }

    @Override
    public String setMetKey(String key) {
        return this.key = key;
    }
}