Amazon.S3.Encryption.AmazonS3EncryptionClient.GenerateEncryptedObjectRequestUsingInstructionFile C# (CSharp) Method

GenerateEncryptedObjectRequestUsingInstructionFile() private method

Updates the request where the instruction file contains encryption information and the input stream contains the encrypted object contents.
private GenerateEncryptedObjectRequestUsingInstructionFile ( PutObjectRequest putObjectRequest ) : void
putObjectRequest Amazon.S3.Model.PutObjectRequest
return void
        private void GenerateEncryptedObjectRequestUsingInstructionFile(PutObjectRequest putObjectRequest)
        {
            // Create instruction
            EncryptionInstructions instructions = EncryptionUtils.GenerateInstructions(this.encryptionMaterials);

            EncryptionUtils.AddUnencryptedContentLengthToMetadata(putObjectRequest);

            // Encrypt the object data with the instruction
            putObjectRequest.InputStream = EncryptionUtils.EncryptRequestUsingInstruction(putObjectRequest.InputStream, instructions);

            // Create request for uploading instruction file 
            PutObjectRequest instructionFileRequest = EncryptionUtils.CreateInstructionFileRequest(putObjectRequest, instructions);

            S3ClientForInstructionFile.PutObject(instructionFileRequest);
        }