package com.common.core.crypto;
|
|
|
import com.common.core.utils.SM4Utils;
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @author 廖振钦
|
* @Date 2022-01-11 19:02
|
* */
|
|
@Slf4j
|
public class ColumnHandler implements CryptoHandler<String, String>{
|
|
public String encrypto(String src){
|
if(null == src){
|
return null;
|
}
|
try{
|
return SM4Utils.encryptStr(src);
|
}
|
catch(Exception e){
|
log.error(e.getMessage(), e);
|
throw new RuntimeException(e.getMessage());
|
}
|
}
|
|
public String decrypto(String src){
|
if(null == src){
|
return null;
|
}
|
try{
|
return SM4Utils.decryptStr(src);
|
}
|
catch(Exception e){
|
log.error(e.getMessage(), e);
|
throw new RuntimeException(e.getMessage());
|
}
|
}
|
|
}
|