| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | | // |
| | 5 | |
|
| | 6 | | namespace Microsoft.Azure.KeyVault.WebKey |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Supported JsonWebKey operations |
| | 10 | | /// </summary> |
| | 11 | | public static class JsonWebKeyOperation |
| | 12 | | { |
| | 13 | | public const string Encrypt = "encrypt"; |
| | 14 | | public const string Decrypt = "decrypt"; |
| | 15 | | public const string Sign = "sign"; |
| | 16 | | public const string Verify = "verify"; |
| | 17 | | public const string Wrap = "wrapKey"; |
| | 18 | | public const string Unwrap = "unwrapKey"; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// All operations names. |
| | 22 | | /// </summary> |
| 24 | 23 | | public static string[] AllOperations => (string[]) _allOperations.Clone(); |
| | 24 | |
|
| 4 | 25 | | private static readonly string[] _allOperations = {Encrypt, Decrypt, Sign, Verify, Wrap, Unwrap}; |
| | 26 | |
|
| | 27 | | public static bool IsValidOperation( string operation ) |
| | 28 | | { |
| 0 | 29 | | foreach ( var validOperation in _allOperations ) |
| 0 | 30 | | if ( operation == validOperation ) |
| 0 | 31 | | return true; |
| 0 | 32 | | return false; |
| | 33 | | } |
| | 34 | | } |
| | 35 | | } |