IEncryptor.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.ruoyi.common.encrypt;
  2. import com.ruoyi.common.enums.AlgorithmType;
  3. import com.ruoyi.common.enums.EncodeType;
  4. /**
  5. * 加解者
  6. *
  7. * @author 老马
  8. * @date 2023-01-10 16:08
  9. */
  10. public interface IEncryptor {
  11. /**
  12. * 获得当前算法
  13. *
  14. * @return com.ruoyi.common.enums.AlgorithmType
  15. * @author 老马
  16. * @date 2023/1/11 11:18
  17. */
  18. AlgorithmType algorithm();
  19. /**
  20. * 加密
  21. *
  22. * @param value 待加密字符串
  23. * @param encodeType 加密后的编码格式
  24. * @return java.lang.String 加密后的字符串
  25. * @throws Exception 抛出异常
  26. * @author 老马
  27. * @date 2023/1/10 16:38
  28. */
  29. String encrypt(String value, EncodeType encodeType) throws Exception;
  30. /**
  31. * 解密
  32. *
  33. * @param value 待加密字符串
  34. * @param encodeType 加密后的编码格式
  35. * @return java.lang.String 解密后的字符串
  36. * @throws Exception 抛出异常
  37. * @author 老马
  38. * @date 2023/1/10 16:38
  39. */
  40. String decrypt(String value, EncodeType encodeType) throws Exception;
  41. }