spi 添加秘钥加解密支持
This commit is contained in:
parent
88fb26cfc6
commit
f1484e9f22
@ -61,7 +61,7 @@ public class EncryptionHandler {
|
||||
EncryptionPluginService encryptionPluginService = optional.get();
|
||||
String secretKey = encryptionPluginService.generateSecretKey();
|
||||
String encrypt = encryptionPluginService.encrypt(secretKey, content);
|
||||
return Pair.with(secretKey, encrypt);
|
||||
return Pair.with(secretKey, encryptionPluginService.encryptSecretKey(encrypt));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,8 +84,9 @@ public class EncryptionHandler {
|
||||
return Pair.with("", content);
|
||||
}
|
||||
EncryptionPluginService encryptionPluginService = optional.get();
|
||||
String decrypt = encryptionPluginService.decrypt(secretKey, content);
|
||||
return Pair.with(secretKey, decrypt);
|
||||
String decryptSecretKey = encryptionPluginService.decryptSecretKey(secretKey);
|
||||
String decryptContent = encryptionPluginService.decrypt(decryptSecretKey, content);
|
||||
return Pair.with(decryptSecretKey, decryptContent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,4 +54,18 @@ public interface EncryptionPluginService {
|
||||
* @return name
|
||||
*/
|
||||
String algorithmName();
|
||||
|
||||
/**
|
||||
* encrypt secretKey.
|
||||
* @param secretKey secretKey
|
||||
* @return encrypted secretKey
|
||||
*/
|
||||
String encryptSecretKey(String secretKey);
|
||||
|
||||
/**
|
||||
* decrypt secretKey.
|
||||
* @param secretKey secretKey
|
||||
* @return decrypted secretKey
|
||||
*/
|
||||
String decryptSecretKey(String secretKey);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user