Amazon.S3.Encryption.EncryptionUtils.GenerateInstructions C# (CSharp) Метод

GenerateInstructions() статический приватный Метод

Generates an instruction that will be used to encrypt an object.
static private GenerateInstructions ( EncryptionMaterials materials ) : EncryptionInstructions
materials EncryptionMaterials /// The encryption materials to be used to encrypt and decrypt data. ///
Результат EncryptionInstructions
        internal static EncryptionInstructions GenerateInstructions(EncryptionMaterials materials)
        {
            Aes AesObject = Aes.Create();
            byte[] encryptedEnvelopeKey = EncryptEnvelopeKey(AesObject.Key, materials);
            return new EncryptionInstructions(EncryptionMaterials.EmptyMaterialsDescription, AesObject.Key, encryptedEnvelopeKey, AesObject.IV);
        }

Usage Example

        /// <summary>
        /// Updates the request where the metadata contains encryption information
        /// and the input stream contains the encrypted object contents.
        /// </summary>
        /// <param name="putObjectRequest">
        /// The request whose contents are to be encrypted.
        /// </param>
        private void GenerateEncryptedObjectRequestUsingMetadata(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);

            // Update the metadata
            EncryptionUtils.UpdateMetadataWithEncryptionInstructions(putObjectRequest, instructions);
        }
All Usage Examples Of Amazon.S3.Encryption.EncryptionUtils::GenerateInstructions