Encryption Algorithm

Background

Encryption algorithms are by the encryption features of Apache ShardingSphere. A variety of algorithms are built-in to make it easy for users to fully leverage the feature.

Parameters

Standard Encrypt Algorithm

AES Encrypt Algorithm

Type: AES

Attributes:

NameDataTypeDescription
aes-key-valueStringAES KEY
digest-algorithm-nameStringAES KEY DIGEST ALGORITHM (optional, default: SHA-1)

Assisted Encrypt Algorithm

MD5 Assisted Encrypt Algorithm

Type: MD5

Attributes:

NameDataTypeDescription
saltStringSalt value(optional)

Operating Procedure

  1. Configure encryptors in an encryption rule.
  2. Use relevant algorithm types in encryptors.

Configuration Examples

  1. rules:
  2. - !ENCRYPT
  3. tables:
  4. t_user:
  5. columns:
  6. username:
  7. cipher:
  8. name: username
  9. encryptorName: name_encryptor
  10. assistedQuery:
  11. name: assisted_username
  12. encryptorName: assisted_encryptor
  13. encryptors:
  14. name_encryptor:
  15. type: AES
  16. props:
  17. aes-key-value: 123456abc
  18. assisted_encryptor:
  19. type: MD5
  20. props:
  21. salt: 123456