Skip to content

Commit

Permalink
add encrypt metadata for algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
tuichenchuxin committed Jan 16, 2024
1 parent b5907d7 commit 2b1a34b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public EncryptRule(final String databaseName, final CompatibleEncryptRuleConfigu

private void checkEncryptorType(final EncryptColumnRuleConfiguration columnRuleConfig, final Map<String, EncryptAlgorithm> encryptors) {
ShardingSpherePreconditions.checkState(encryptors.containsKey(columnRuleConfig.getCipher().getEncryptorName())
&& encryptors.get(columnRuleConfig.getCipher().getEncryptorName()).getMetaData().isSupportDecrypt(),
&& encryptors.get(columnRuleConfig.getCipher().getEncryptorName()).getMetaData().isSupportDecrypt(),
() -> new MismatchedEncryptAlgorithmTypeException(databaseName, "Cipher", columnRuleConfig.getCipher().getEncryptorName(), "decrypt"));
columnRuleConfig.getAssistedQuery().ifPresent(optional -> ShardingSpherePreconditions.checkState(encryptors.containsKey(optional.getEncryptorName())
&& encryptors.get(optional.getEncryptorName()).getMetaData().isSupportEquivalentFilter(),
() -> new MismatchedEncryptAlgorithmTypeException(databaseName, "Assisted query", columnRuleConfig.getCipher().getEncryptorName(), "equivalent filter")));
columnRuleConfig.getLikeQuery().ifPresent(optional -> ShardingSpherePreconditions.checkState(encryptors.containsKey(optional.getEncryptorName())
&& encryptors.get(optional.getEncryptorName()).getMetaData().isSupportLike(),
&& encryptors.get(optional.getEncryptorName()).getMetaData().isSupportLike(),
() -> new MismatchedEncryptAlgorithmTypeException(databaseName, "Like query", columnRuleConfig.getCipher().getEncryptorName(), "like")));
}

Expand Down

0 comments on commit 2b1a34b

Please sign in to comment.