| | 1 | | // <auto-generated> |
| | 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 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.KeyVault.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Microsoft.Rest.Serialization; |
| | 15 | | using Newtonsoft.Json; |
| | 16 | | using System.Linq; |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// The key verify parameters. |
| | 20 | | /// </summary> |
| | 21 | | public partial class KeyVerifyParameters |
| | 22 | | { |
| | 23 | | /// <summary> |
| | 24 | | /// Initializes a new instance of the KeyVerifyParameters class. |
| | 25 | | /// </summary> |
| 28 | 26 | | public KeyVerifyParameters() |
| | 27 | | { |
| | 28 | | CustomInit(); |
| 28 | 29 | | } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Initializes a new instance of the KeyVerifyParameters class. |
| | 33 | | /// </summary> |
| | 34 | | /// <param name="algorithm">The signing/verification algorithm. For |
| | 35 | | /// more information on possible algorithm types, see |
| | 36 | | /// Microsoft.Azure.KeyVault.WebKey.JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', |
| | 37 | | /// 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', |
| | 38 | | /// 'ES384', 'ES512', 'ES256K'</param> |
| | 39 | | /// <param name="digest">The digest used for signing.</param> |
| | 40 | | /// <param name="signature">The signature to be verified.</param> |
| 0 | 41 | | public KeyVerifyParameters(string algorithm, byte[] digest, byte[] signature) |
| | 42 | | { |
| 0 | 43 | | Algorithm = algorithm; |
| 0 | 44 | | Digest = digest; |
| 0 | 45 | | Signature = signature; |
| | 46 | | CustomInit(); |
| 0 | 47 | | } |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// An initialization method that performs custom operations like setting defaults |
| | 51 | | /// </summary> |
| | 52 | | partial void CustomInit(); |
| | 53 | |
|
| | 54 | | /// <summary> |
| | 55 | | /// Gets or sets the signing/verification algorithm. For more |
| | 56 | | /// information on possible algorithm types, see |
| | 57 | | /// Microsoft.Azure.KeyVault.WebKey.JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', |
| | 58 | | /// 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', |
| | 59 | | /// 'ES384', 'ES512', 'ES256K' |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "alg")] |
| 56 | 62 | | public string Algorithm { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets the digest used for signing. |
| | 66 | | /// </summary> |
| | 67 | | [JsonConverter(typeof(Base64UrlJsonConverter))] |
| | 68 | | [JsonProperty(PropertyName = "digest")] |
| 56 | 69 | | public byte[] Digest { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets or sets the signature to be verified. |
| | 73 | | /// </summary> |
| | 74 | | [JsonConverter(typeof(Base64UrlJsonConverter))] |
| | 75 | | [JsonProperty(PropertyName = "value")] |
| 56 | 76 | | public byte[] Signature { get; set; } |
| | 77 | |
|
| | 78 | | /// <summary> |
| | 79 | | /// Validate the object. |
| | 80 | | /// </summary> |
| | 81 | | /// <exception cref="ValidationException"> |
| | 82 | | /// Thrown if validation fails |
| | 83 | | /// </exception> |
| | 84 | | public virtual void Validate() |
| | 85 | | { |
| 0 | 86 | | if (Algorithm == null) |
| | 87 | | { |
| 0 | 88 | | throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm"); |
| | 89 | | } |
| 0 | 90 | | if (Digest == null) |
| | 91 | | { |
| 0 | 92 | | throw new ValidationException(ValidationRules.CannotBeNull, "Digest"); |
| | 93 | | } |
| 0 | 94 | | if (Signature == null) |
| | 95 | | { |
| 0 | 96 | | throw new ValidationException(ValidationRules.CannotBeNull, "Signature"); |
| | 97 | | } |
| 0 | 98 | | if (Algorithm != null) |
| | 99 | | { |
| 0 | 100 | | if (Algorithm.Length < 1) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.MinLength, "Algorithm", 1); |
| | 103 | | } |
| | 104 | | } |
| 0 | 105 | | } |
| | 106 | | } |
| | 107 | | } |