| | | 1 | | // |
| | | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | | 4 | | // license information. |
| | | 5 | | // |
| | | 6 | | |
| | | 7 | | using System.Security.Cryptography; |
| | | 8 | | |
| | | 9 | | namespace Microsoft.Azure.KeyVault.Cryptography |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Abstract Encryption Algorithm |
| | | 13 | | /// </summary> |
| | | 14 | | public abstract class EncryptionAlgorithm : Algorithm |
| | | 15 | | { |
| | | 16 | | protected EncryptionAlgorithm( string name ) : base( name ) |
| | | 17 | | { |
| | | 18 | | } |
| | | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Abstract Asymmetric Encryption Algorithm |
| | | 23 | | /// </summary> |
| | | 24 | | public abstract class AsymmetricEncryptionAlgorithm : EncryptionAlgorithm |
| | | 25 | | { |
| | | 26 | | protected AsymmetricEncryptionAlgorithm( string name ) |
| | | 27 | | : base( name ) |
| | | 28 | | { |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Create an encryptor for the specified key |
| | | 33 | | /// </summary> |
| | | 34 | | /// <param name="key">The key used to create the encryptor</param> |
| | | 35 | | /// <returns>An ICryptoTransform for encrypting data</returns> |
| | | 36 | | public abstract ICryptoTransform CreateEncryptor( AsymmetricAlgorithm key ); |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Create a decryptor for the specified key |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="key">The key used to create decryptor</param> |
| | | 42 | | /// <returns>An ICryptoTransform for encrypting data</returns> |
| | | 43 | | public abstract ICryptoTransform CreateDecryptor( AsymmetricAlgorithm key ); |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Abstract SymmetricEncryption Algorithm |
| | | 48 | | /// </summary> |
| | | 49 | | public abstract class SymmetricEncryptionAlgorithm : EncryptionAlgorithm |
| | | 50 | | { |
| | | 51 | | protected SymmetricEncryptionAlgorithm( string name ) |
| | 26 | 52 | | : base( name ) |
| | | 53 | | { |
| | 26 | 54 | | } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Create an encryptor for the specified key |
| | | 58 | | /// </summary> |
| | | 59 | | /// <param name="key">The key material to be used</param> |
| | | 60 | | /// <param name="iv">The initialization vector to be used</param> |
| | | 61 | | /// <param name="authenticationData">The authentication data to be used with authenticating encryption algorithm |
| | | 62 | | /// <returns>An ICryptoTranform for encrypting data</returns> |
| | | 63 | | public abstract ICryptoTransform CreateEncryptor( byte[] key, byte[] iv, byte[] authenticationData ); |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Create a decryptor for the specified key |
| | | 67 | | /// </summary> |
| | | 68 | | /// <param name="key">The key material to be used</param> |
| | | 69 | | /// <param name="iv">The initialization vector to be used</param> |
| | | 70 | | /// <param name="authenticationData">The authentication data to be used with authenticating encryption algorithm |
| | | 71 | | /// <param name="authenticationTag">The authentication tag to verify when using authenticating encryption algori |
| | | 72 | | /// <returns>An ICryptoTransform for decrypting data</returns> |
| | | 73 | | public abstract ICryptoTransform CreateDecryptor( byte[] key, byte[] iv, byte[] authenticationData, byte[] authe |
| | | 74 | | } |
| | | 75 | | } |