| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | namespace Azure.Storage.Cryptography |
| | 5 | | { |
| | 6 | | internal static class ClientSideEncryptionOptionsExtensions |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Extension method to clone an instance of <see cref="ClientSideEncryptionOptions"/>. |
| | 10 | | /// </summary> |
| | 11 | | /// <param name="options"></param> |
| | 12 | | /// <returns></returns> |
| | 13 | | public static ClientSideEncryptionOptions Clone(this ClientSideEncryptionOptions options) |
| | 14 | | { |
| 0 | 15 | | var newOptions = new ClientSideEncryptionOptions(options.EncryptionVersion); |
| 0 | 16 | | CopyOptions(options, newOptions); |
| 0 | 17 | | return newOptions; |
| | 18 | | } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Copies all properties from one instance to another. It cannot copy |
| | 22 | | /// <see cref="ClientSideEncryptionOptions.EncryptionVersion"/>; |
| | 23 | | /// that is the responsibility of the caller who made the instance. |
| | 24 | | /// </summary> |
| | 25 | | /// <param name="source">Object to copy from.</param> |
| | 26 | | /// <param name="destination">Object to copy to.</param> |
| | 27 | | /// <remarks> |
| | 28 | | /// This functionality has been pulled out to be accessible by other |
| | 29 | | /// clone methods available on subclasses. They need the ability to |
| | 30 | | /// instantiate the subclass destination first before copying over the |
| | 31 | | /// properties. |
| | 32 | | /// </remarks> |
| | 33 | | internal static void CopyOptions(ClientSideEncryptionOptions source, ClientSideEncryptionOptions destination) |
| | 34 | | { |
| 0 | 35 | | destination.KeyEncryptionKey = source.KeyEncryptionKey; |
| 0 | 36 | | destination.KeyResolver = source.KeyResolver; |
| 0 | 37 | | destination.KeyWrapAlgorithm = source.KeyWrapAlgorithm; |
| 0 | 38 | | } |
| | 39 | | } |
| | 40 | | } |