| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.IdentityModel.Tokens.Saml |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Represents the EncryptedKey Element of X509Data as per: https://www.w3.org/TR/2001/PR-xmldsig-core-20010820/#se |
| | | 10 | | /// </summary> |
| | | 11 | | public class EncryptedKey |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Creates an EncryptedKey |
| | | 15 | | /// </summary> |
| | 0 | 16 | | public EncryptedKey(string encryptionMethod, Microsoft.IdentityModel.Xml.KeyInfo keyInfo, string cipherData) |
| | | 17 | | { |
| | 0 | 18 | | EncryptionMethod = encryptionMethod; |
| | 0 | 19 | | KeyInfo = keyInfo; |
| | 0 | 20 | | CipherData = cipherData; |
| | 0 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the SecurityKeyIdentifier |
| | | 25 | | /// </summary> |
| | 0 | 26 | | public string EncryptionMethod { get; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// encryptedKey |
| | | 30 | | /// </summary> |
| | 0 | 31 | | public Microsoft.IdentityModel.Xml.KeyInfo KeyInfo { get; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// |
| | | 35 | | /// </summary> |
| | 0 | 36 | | public string CipherData { get; } |
| | | 37 | | |
| | | 38 | | public override bool Equals(object obj) |
| | | 39 | | { |
| | 0 | 40 | | if (obj is not EncryptedKey other) |
| | 0 | 41 | | return false; |
| | 0 | 42 | | if (other is null) |
| | 0 | 43 | | return false; |
| | 0 | 44 | | if (ReferenceEquals(this, other)) |
| | 0 | 45 | | return true; |
| | 0 | 46 | | return string.Equals(EncryptionMethod, other.EncryptionMethod) && |
| | 0 | 47 | | Equals(KeyInfo, other.KeyInfo) && |
| | 0 | 48 | | string.Equals(CipherData, other.CipherData); |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | public override int GetHashCode() |
| | | 52 | | { |
| | 0 | 53 | | return HashCode.Combine(EncryptionMethod, KeyInfo, CipherData); |
| | | 54 | | } |
| | | 55 | | } |
| | | 56 | | } |