Encryption Algorithm

Background

Encryption algorithms are the algorithms used 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

MD5 Encrypt Algorithm

Type: MD5

Attributes: None

AES Encrypt Algorithm

Type: AES

Attributes:

NameDataTypeDescription
aes-key-valueStringAES KEY

RC4 Encrypt Algorithm

Type: RC4

Attributes:

NameDataTypeDescription
rc4-key-valueStringRC4 KEY

SM3 Encrypt Algorithm

Type: SM3

Attributes:

NameDataTypeDescription
sm3-saltStringSM3 SALT (should be blank or 8 bytes long)

SM4 Encrypt Algorithm

Type: SM4

Attributes:

NameDataTypeDescription
sm4-keyStringSM4 KEY (should be 16 bytes)
sm4-modeStringSM4 MODE (should be CBC or ECB)
sm4-ivStringSM4 IV (should be specified on CBC, 16 bytes long)
sm4-paddingStringSM4 PADDING (should be PKCS5Padding or PKCS7Padding, NoPadding excepted)

Operating Procedures

  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. plainColumn: username_plain
  8. cipherColumn: username
  9. encryptorName: name-encryptor
  10. encryptors:
  11. name-encryptor:
  12. type: AES
  13. props:
  14. aes-key-value: 123456abc