def test_stdin_to_file_to_stdout_cycle(tmpdir):
ciphertext_file = tmpdir.join('ciphertext')
plaintext = os.urandom(1024)
encrypt_args = 'aws-encryption-cli ' + encrypt_args_template(decode=True).format(
source='-',
target=str(ciphertext_file)
)
decrypt_args = 'aws-encryption-cli ' + decrypt_args_template(encode=True).format(
source=str(ciphertext_file),
target='-'
)
proc = Popen(shlex.split(encrypt_args, posix=not is_windows()), stdout=PIPE, stdin=PIPE, stderr=PIPE)
_stdout, _stderr = proc.communicate(input=base64.b64encode(plaintext))
proc = Popen(shlex.split(decrypt_args, posix=not is_windows()), stdout=PIPE, stdin=PIPE, stderr=PIPE)
decrypted_stdout, _stderr = proc.communicate()
assert base64.b64decode(decrypted_stdout) == plaintext
test_i_aws_encryption_sdk_cli.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录