版本

版本

我想将加密的视频上传到 S3 并使用 Elastic Transcoder 对其进行转码。这是我目前正在做的事情,但根本不起作用。我用它openssl来加密我的视频文件。我使用的命令是:

PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c16)
openssl enc -aes-256-cbc -pass pass:$PASSWORD -p -in VIDEO.mkv -out VIDEO.enc.mkv

这回显了我的盐、密钥和 IV hex

salt=BBE61C94DD1B3395
key=03A4C8AB06A09C924947FC865415FE58E1AFC6C998FA7CA8B9DE8E5C232CE0E9
iv =9325C43C36A7868957613EF80FEED569

然后我使用命令行实用程序将该加密文件上传到 S3 aws s3

AWS Elastic Transcoder 告诉我:

Decryption Key: The Base64 encoded encrypted key that you want Elastic Transcoder to use to decrypt the input.
Decryption Key MD5: The Base64 encoded MD5 digest of the encrypted key that you want Elastic Transcoder to use for a key checksum.
Decryption Initialization Vector: The Base64 encoded initialization vector that you want Elastic Transcoder to use to decrypt the input.

然后我这样做:

OUTPUT=$(echo '[KEY]' | xxd -r -p | base64 -i -)
aws kms encrypt --plaintext $OUTPUT --key-id [MY KEY]

这将返回一个CiphertextBlob,然后我可以将其粘贴到我的中Decryption Parameters -> Decryption Key

对于Decryption Key MD5“我愿意”:

echo '[KEY]' | xxd -r -p | md5 | base64 -i -

我将其粘贴于Decryption Parameters -> Decryption Key MD5

静脉注射是通过以下方式完成的:

echo '[IV]' | xxd -r -p | base64 -i -

然后我将其粘贴在Decryption Parameters -> Decryption Initialization Vector

完成所有这些步骤并创建作业后,AWS 返回此错误:

The MD5 hash of the base64-decoded value for ''Encryption:Key'' must equal the base64-decoded value for ''Encryption:KeyMd5''. (Service: AmazonElasticTranscoder; Status Code: 400; Error Code: ValidationException; Request ID: xxxx)

版本

openssl version
OpenSSL 0.9.8zg 14 July 2015

aws --version
aws-cli/1.9.2 Python/2.7.10 Darwin/15.0.0 botocore/1.3.2

xxd -v
xxd V1.10 27oct98 by Juergen Weigert

md5 -x
MD5 test suite:
MD5 ("") = d41d8cd98f00b204e9800998ecf8427e - verified correct
MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 - verified correct
MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 - verified correct
MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 - verified correct
MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b - verified correct
MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f - verified correct
MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a - verified correct
MD5 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = b50663f41d44d92171cb9976bc118538 - verified correct

base64 -h       
base64: invalid option -- h
Usage:  base64 [-dhvD] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -D, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

总结

我想使用 Elastic Transcoder 对来自 S3 的客户端加密文件进行转码,但我无法让密钥发挥作用。

相关内容