@ApiVersion(value=2.3) @RestController @RequestMapping(value="/open/{version}/keyExchange") public class KeyExchangeController extends Object
1. 前端大写UUID → 后端返回RSA公钥
2. 前端生成RSA密钥对 → 前端通过后端RSA公钥加密前端RSA公钥并传输给后端 → 后端通过私钥解密前端的RSA公钥 → 后端通过前端RSA公钥加密AES密钥响应给前端
好处:1. 最终的对称加密(AES)密钥未在传输过程中泄露
2. 每次会话生命周期中的加密密钥都是随机的
Constructor and Description |
---|
KeyExchangeController() |
Modifier and Type | Method and Description |
---|---|
Result<?> |
addAlias(String storageKey,
String storageKeyAlias)
添加存储key别名
|
Result<?> |
getExchangeKey(String storageKey,
ExchangeKeyEnum exchangeKeyType,
String encryptedClientPublicKey)
获得交换密钥
|
@PostMapping(value="/{storageKey}") public Result<?> getExchangeKey(@PathVariable String storageKey, ExchangeKeyEnum exchangeKeyType, @Nullable String encryptedClientPublicKey)
storageKey
- 密钥存储标识exchangeKeyType
- 交换密钥类型encryptedClientPublicKey
- 服务端公钥加密的客户端公钥(第二步逻辑必填参数)第二次返回:客户端公钥加密的交换密钥
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.