| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Text.Json; |
| | 5 | |
|
| | 6 | | namespace Azure.Security.KeyVault.Keys.Cryptography |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Represents information about a verify operation. |
| | 10 | | /// </summary> |
| | 11 | | public class VerifyResult : IJsonDeserializable |
| | 12 | | { |
| | 13 | | private const string KeyIdPropertyName = "kid"; |
| | 14 | | private const string ValidPropertyName = "value"; |
| | 15 | |
|
| 250 | 16 | | internal VerifyResult() |
| | 17 | | { |
| 250 | 18 | | } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to verify. |
| | 22 | | /// </summary> |
| 500 | 23 | | public string KeyId { get; internal set; } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Gets a value indicating whether the specified signature is valid. |
| | 27 | | /// </summary> |
| 484 | 28 | | public bool IsValid { get; internal set; } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Gets the <see cref="SignatureAlgorithm"/>. |
| | 32 | | /// </summary> |
| 484 | 33 | | public SignatureAlgorithm Algorithm { get; internal set; } |
| | 34 | |
|
| | 35 | | void IJsonDeserializable.ReadProperties(JsonElement json) |
| | 36 | | { |
| 880 | 37 | | foreach (JsonProperty prop in json.EnumerateObject()) |
| | 38 | | { |
| 228 | 39 | | switch (prop.Name) |
| | 40 | | { |
| | 41 | | case KeyIdPropertyName: |
| 16 | 42 | | KeyId = prop.Value.GetString(); |
| 16 | 43 | | break; |
| | 44 | | case ValidPropertyName: |
| 212 | 45 | | IsValid = prop.Value.GetBoolean(); |
| | 46 | | break; |
| | 47 | | } |
| | 48 | | } |
| 212 | 49 | | } |
| | 50 | | } |
| | 51 | | } |