0

我在使用 HlsContentProtection 时收到此错误

1.这就是我创建加密密钥的方式##

public static void main(String[] args) {
    AWSKMS kmsClient = AWSKMSClientBuilder.defaultClient();
    // Encrypt a data key
    //
    // Replace the following fictitious CMK ARN with a valid CMK ID 
  or ARN
    String keyId = "arn:aws:kms:us-east- 
 1:864624737976:key/*********************************";
    ByteBuffer plaintext = 
  ByteBuffer.wrap("a2V5a2V5a2V5a2V5a2V5aw==".getBytes());

    EncryptRequest req = new EncryptRequest().withKeyId(keyId).withPlaintext(plaintext);
    ByteBuffer ciphertext = kmsClient.encrypt(req).getCiphertextBlob();
    String encKey=new String(Base64.encode(ciphertext.array()));
    System.out.println(encKey);

}

2.这就是我生成 KeyMD5 的方式

public static String GenerateKeyMD5(String encryptionKey) {
    byte[] b = Base64.decode(encryptionKey.getBytes());
    byte[] x = Md5Utils.computeMD5Hash(b);
    byte[] nj = Base64.encode(x);
    String keyMD5 = new String(nj);
    System.out.println("keyMD5 is:" + keyMD5);
    return keyMD5;
}

3.现在我正在创建 HLSContentProtection 如下

String k="AQICAHiJNZmP67ofdfAWfNjDhl+TTPW7kWLUYnHXQocyT+iPgAGp2tnvx6GOF6OvQyJR/kNJAAAAdjB0BgkqhkiG9w0BBwagZzBlAgEAMGAGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMRDuCopOoxFBcs/YsAgEQgDOYcO2BHJbRACWo4Cgp+vAXAuxyE+UeZtWGUmOJwx5wJ4J1zYCbb9FrRaKro7njkcL7Vck=";
    //secure content
          HlsContentProtection hlsContentProtection =new HlsContentProtection()
          .withKeyStoragePolicy("NoStore")
          .withMethod(METHOD)
          .withLicenseAcquisitionUrl("https://s3.amazonaws.com/license-1452/plain.key")
          .withInitializationVector("MTIzNDU2Nzg5MDEyMzQ1Ng==")
         .withKey(k)
         .withKeyMd5(TranscoderSampleUtilities.GenerateKeyMD5(k));

我收到此错误

4018 533bc5aa-ed4d-4014-8a0a-083da9890cef:Amazon Elastic Transcoder 无法使用 MD5=wJForaVS6T5wok/80E4RYg== 解密加密密钥。

4

0 回答 0