vod普通加密

This commit is contained in:
wangjinlei
2024-07-19 09:46:02 +08:00
parent 10796fe6c6
commit 2228ed148d
7 changed files with 122 additions and 13 deletions

View File

@@ -1,20 +1,39 @@
package com.peanut.modules.sys.controller;
import com.aliyun.vod20170321.models.DecryptKMSDataKeyResponseBody;
import com.peanut.common.utils.PlayToken;
import com.peanut.common.utils.SpdbUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/sys/vodAli")
public class VodAliController {
@Autowired
private PlayToken playToken;
@GetMapping("/vodAliVideoRe")
public String vodAliVideoRe(@RequestParam("CipherText") String cipherText,
@RequestParam("MtsHlsUriToken") String mtsHlsUriToken){
@RequestMapping("/vodAliVideoRe")
public void vodAliVideoRe(@RequestBody Map<String,Object> map){
boolean validRe = false;
try {
validRe = playToken.validateToken(mtsHlsUriToken);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (!validRe) {
return "Illegal access";
}
if (null == cipherText)
return "Illegal access";
DecryptKMSDataKeyResponseBody decryptKMSDataKeyResponseBody = SpdbUtil.enKMS(cipherText);
return decryptKMSDataKeyResponseBody.getPlaintext();
}
}