spi 添加秘钥加解密支持
This commit is contained in:
parent
88fb26cfc6
commit
f1484e9f22
@ -61,7 +61,7 @@ public class EncryptionHandler {
|
|||||||
EncryptionPluginService encryptionPluginService = optional.get();
|
EncryptionPluginService encryptionPluginService = optional.get();
|
||||||
String secretKey = encryptionPluginService.generateSecretKey();
|
String secretKey = encryptionPluginService.generateSecretKey();
|
||||||
String encrypt = encryptionPluginService.encrypt(secretKey, content);
|
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);
|
return Pair.with("", content);
|
||||||
}
|
}
|
||||||
EncryptionPluginService encryptionPluginService = optional.get();
|
EncryptionPluginService encryptionPluginService = optional.get();
|
||||||
String decrypt = encryptionPluginService.decrypt(secretKey, content);
|
String decryptSecretKey = encryptionPluginService.decryptSecretKey(secretKey);
|
||||||
return Pair.with(secretKey, decrypt);
|
String decryptContent = encryptionPluginService.decrypt(decryptSecretKey, content);
|
||||||
|
return Pair.with(decryptSecretKey, decryptContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,4 +54,18 @@ public interface EncryptionPluginService {
|
|||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
String algorithmName();
|
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