| | | 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 | | using System.Linq; |
| | | 7 | | |
| | | 8 | | namespace Microsoft.Azure.KeyVault.WebKey |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Supported JsonWebKey algorithms |
| | | 12 | | /// </summary> |
| | | 13 | | public static class JsonWebKeySignatureAlgorithm |
| | | 14 | | { |
| | | 15 | | public const string RS256 = "RS256"; |
| | | 16 | | public const string RS384 = "RS384"; |
| | | 17 | | public const string RS512 = "RS512"; |
| | | 18 | | public const string RSNULL = "RSNULL"; |
| | | 19 | | |
| | | 20 | | // RSASSA-PSS using SHA-256 and MGF1 with SHA-256 |
| | | 21 | | // defined https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms |
| | | 22 | | public const string PS256 = "PS256"; |
| | | 23 | | // RSASSA-PSS using SHA-384 and MGF1 with SHA-384 |
| | | 24 | | public const string PS384 = "PS384"; |
| | | 25 | | // RSASSA-PSS using SHA-512 and MGF1 with SHA-512 |
| | | 26 | | public const string PS512 = "PS512"; |
| | | 27 | | |
| | | 28 | | // ECDSA using P-256 and SHA-256 |
| | | 29 | | public const string ES256 = "ES256"; |
| | | 30 | | // ECDSA using P-384 and SHA-384 |
| | | 31 | | public const string ES384 = "ES384"; |
| | | 32 | | // ECDSA using P-521 and SHA-512 |
| | | 33 | | public const string ES512 = "ES512"; |
| | | 34 | | // ECDSA using P-256K and SHA-256 (SECP256K1) |
| | | 35 | | public const string ES256K = "ES256K"; |
| | | 36 | | |
| | 0 | 37 | | public static string[] AllRsaAlgorithms => new[] { RS256, RS384, RS512, RSNULL, PS256, PS384, PS512 }; |
| | | 38 | | |
| | 0 | 39 | | public static string[] AllEcAlgorithms => new[] { ES256, ES384, ES512, ES256K }; |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// All algorithms names. Use clone to avoid FxCop violation |
| | | 43 | | /// </summary> |
| | 0 | 44 | | public static string[] AllAlgorithms => AllRsaAlgorithms.Concat(AllEcAlgorithms).ToArray(); |
| | | 45 | | } |
| | | 46 | | } |