Logo
Encryption

Encryption #

Configuration Item Explanation #

Namespace: http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encrypt-5.1.0.xsd

<encrypt:rule />

NameTypeDescriptionDefault Value
idAttributeSpring Bean Id
queryWithCipherColumn (?)AttributeWhether query with cipher column for data encrypt. User you can use plaintext to query if havetrue
table (+)TagEncrypt table configuration

<encrypt:table />

NameTypeDescription
nameAttributeEncrypt table name
column (+)TagEncrypt column configuration
query-with-cipher-column(?)AttributeWhether query with cipher column for data encrypt. User you can use plaintext to query if have

<encrypt:column />

NameTypeDescription
logic-columnAttributeEncrypted column logical name
data-type(?)AttributeLogical column type
cipher-columnAttributeEncrypted column name
cipher-data-type(?)AttributeEncrypted column type
assisted-query-column (?)AttributeQuery auxiliary column name
assisted-query-data-type(?)AttributeQuery auxiliary column type
plain-column (?)AttributePlaintext column name
plain-data-type(?)AttributePlaintext column type
encrypt-algorithm-refAttributeEncryption algorithm name

<encrypt:encrypt-algorithm />

NameTypeDescription
idAttributeEncrypt algorithm name
typeAttributeEncrypt algorithm type
props (?)TagEncrypt algorithm properties

Example #

<encrypt:encrypt-algorithm id="name_encryptor" type="AES">
    <props>
        <prop key="aes-key-value">123456</prop>
    </props>
</encrypt:encrypt-algorithm>

<encrypt:rule id="encryptRule">
    <encrypt:table name="t_user">
        <encrypt:column logic-column="pwd" cipher-column="pwd_encrypt" data-type="VARCHAR(20) NOT NULL" cipher-data-type="VARCHAR(200) NOT NULL" plain-column="pwd_plain" plain-data-type="VARCHAR(20) NOT NULL" assisted-query-column="pwd_assisted" assisted-query-data-type="VARCHAR(20) NOT NULL" encrypt-algorithm-ref="name_encryptor" />
    </encrypt:table>
</encrypt:rule>

Please refer to Built-in Encrypt Algorithm List for more details about type of algorithm.