| | 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 | | internal struct KeyWrapParameters : IJsonSerializable |
| | 9 | | { |
| 2 | 10 | | private static readonly JsonEncodedText s_algorithmPropertyNameBytes = JsonEncodedText.Encode("alg"); |
| 2 | 11 | | private static readonly JsonEncodedText s_keyPropertyNameBytes = JsonEncodedText.Encode("value"); |
| | 12 | |
|
| 204 | 13 | | public string Algorithm { get; set; } |
| | 14 | |
|
| 204 | 15 | | public byte[] Key { get; set; } |
| | 16 | |
|
| | 17 | | void IJsonSerializable.WriteProperties(Utf8JsonWriter json) |
| | 18 | | { |
| 68 | 19 | | if (Algorithm != null) |
| | 20 | | { |
| 68 | 21 | | json.WriteString(s_algorithmPropertyNameBytes, Algorithm); |
| | 22 | | } |
| 68 | 23 | | if (Key != null) |
| | 24 | | { |
| 68 | 25 | | json.WriteString(s_keyPropertyNameBytes, Base64Url.Encode(Key)); |
| | 26 | | } |
| 68 | 27 | | } |
| | 28 | | } |
| | 29 | | } |