vod普通加密
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user