import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;

public class tt {
    public static void main(String[] args) {
        System.out.println("rabbit mq");
        System.out.println(stringEncryptor().decrypt("wzLl97TCYFfD1dyWwBJfftESIaV+bxWMAgqHBBc5tbTs/fkyj6y4xMWSqBldkABH"));
        System.out.println(stringEncryptor().decrypt("eMyFn4FXhmxdbLf51ESbXP8YAC3FF5VpgzjfZVEuubIUrgfW3OgerHtjPHJ4Zs3B!"));

        System.out.println("database");

        System.out.println(stringEncryptor().decrypt("wzLl97TCYFfD1dyWwBJfftESIaV+bxWMAgqHBBc5tbTs/fkyj6y4xMWSqBldkABH"));
        System.out.println(stringEncryptor().decrypt("eMyFn4FXhmxdbLf51ESbXP8YAC3FF5VpgzjfZVEuubIUrgfW3OgerHtjPHJ4Zs3B"));
        System.out.println(stringEncryptor().decrypt("5kEEccFF4g1CgmI70JI9CzPfxzks7/CAWjZNhcQChVvFn3NT2aip8rHAWrkbL7w+AXcO8XGXbMIqTS6kYYt61nIqYGEyeEYVFBqGFQflqCb/UzxIoqz+t5l7Gq314IM/"));

        System.out.println(stringEncryptor().encrypt("jdbc:log4jdbc:postgresql://hmsn.ink:35432/talk"));
    }

    public static StringEncryptor stringEncryptor() {
        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();

        config.setPassword("kospo2024"); // 암호화키
        config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); // 알고리즘
        config.setKeyObtentionIterations("1000"); // 반복할 해싱 회수
        config.setPoolSize("1"); // 인스턴스 pool
        config.setProviderName("SunJCE");
        config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // salt 생성 클래스
        config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
        config.setStringOutputType("base64"); //인코딩 방식
        encryptor.setConfig(config);
        return encryptor;
    }
}
