I chose "no store" when transcoding my audio file using aws elastic transcoder. now I have Encryption Key - xxxxxxxxxxxxxxxxxx Encryption Key MD5- xxxxxxxxxxxxx Encryption Initialization Vector-xxxxxxxxxx
so I used awskms to decrypt the encryption key using this code
public ByteBuffer decryptAes(String aes) {
Map<String, String> enccontext = new HashMap<>();
enccontext.put("service", "elastictranscoder.amazonaws.com");
ByteBuffer encrypted = getBytebuffer(Base64.getDecoder().decode(aes));
DecryptRequest reqq = new DecryptRequest().withCiphertextBlob(encrypted).withEncryptionContext(enccontext);
ByteBuffer buf = awskms.decrypt(reqq).withKeyId(keyId).getPlaintext();
return buf;
}
and i have a the m3u8 file with a key of #EXT-X-KEY:METHOD=AES-128,URI="https://[mysite]/api/public/amazoncode",IV=0xdbe2882930b143e62b3e6e587a2269f8
so my confusion is how do I send the decrypting key to the m3u8?, I've this so far but it doesn't seem to work
// this is the endpoint for https://[mysite]/api/public/amazoncode
@GetMapping(value = "amazoncode")
public ByteBuffer getAmazonCode(){
return amazonClient.decryptAes([the encryption code that i got from amazon]);
}
so what is the appropriate responsebody to send the decryted bytebuffer so that my m3u8 can start playing by getting the decrypting data key from my endpoint?
For anyone going through the same problems that I was,I have figured it out after a while, all I had to do was after getting the byteBuffer, convert it to an input stream and create a key file from it. and make it downloadable through the Licence acquisition URL. here is the code:
and now it works like a charm.