EncryptField.java 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.ruoyi.common.annotation;
  2. import com.ruoyi.common.enums.AlgorithmType;
  3. import com.ruoyi.common.enums.EncodeType;
  4. import java.lang.annotation.*;
  5. /**
  6. * 字段加密注解
  7. *
  8. * @author 老马
  9. */
  10. @Documented
  11. @Inherited
  12. @Target({ElementType.FIELD})
  13. @Retention(RetentionPolicy.RUNTIME)
  14. public @interface EncryptField {
  15. /**
  16. * 加密算法
  17. */
  18. AlgorithmType algorithm() default AlgorithmType.DEFAULT;
  19. /**
  20. * 秘钥。AES、SM4需要
  21. */
  22. String password() default "";
  23. /**
  24. * 公钥。RSA、SM2需要
  25. */
  26. String publicKey() default "";
  27. /**
  28. * 公钥。RSA、SM2需要
  29. */
  30. String privateKey() default "";
  31. /**
  32. * 编码方式。对加密算法为BASE64的不起作用
  33. */
  34. EncodeType encode() default EncodeType.DEFAULT;
  35. }