vod普通加密

This commit is contained in:
wangjinlei
2024-07-19 13:53:35 +08:00
parent 3dc4f41813
commit 4e206884a6
5 changed files with 88 additions and 46 deletions

View File

@@ -6,6 +6,7 @@ import com.peanut.common.utils.SpdbUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.apache.commons.codec.binary.Base64;
@Slf4j
@RestController
@@ -15,7 +16,7 @@ public class VodAliController {
private PlayToken playToken;
@GetMapping("/vodAliVideoRe")
public String vodAliVideoRe(@RequestParam("CipherText") String cipherText,
public byte[] vodAliVideoRe(@RequestParam("CipherText") String cipherText,
@RequestParam("MtsHlsUriToken") String mtsHlsUriToken){
boolean validRe = false;
@@ -25,13 +26,13 @@ public class VodAliController {
throw new RuntimeException(e);
}
if (!validRe) {
return "Illegal access";
return Base64.decodeBase64("Illegal access");
}
if (null == cipherText) {
return Base64.decodeBase64("Illegal access !");
}
if (null == cipherText)
return "Illegal access !";
DecryptKMSDataKeyResponseBody decryptKMSDataKeyResponseBody = SpdbUtil.enKMS(cipherText);
return decryptKMSDataKeyResponseBody.getPlaintext();
return Base64.decodeBase64(decryptKMSDataKeyResponseBody.getPlaintext());
}