-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
KeyInfoEncryptedKey.cs
48 lines (40 loc) · 1.5 KB
/
KeyInfoEncryptedKey.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using System.Xml;
namespace System.Security.Cryptography.Xml
{
[RequiresDynamicCode(CryptoHelpers.XsltRequiresDynamicCodeMessage)]
[RequiresUnreferencedCode(CryptoHelpers.CreateFromNameUnreferencedCodeMessage)]
public class KeyInfoEncryptedKey : KeyInfoClause
{
private EncryptedKey? _encryptedKey;
public KeyInfoEncryptedKey() { }
public KeyInfoEncryptedKey(EncryptedKey encryptedKey)
{
_encryptedKey = encryptedKey;
}
public EncryptedKey? EncryptedKey
{
get { return _encryptedKey; }
set { _encryptedKey = value; }
}
public override XmlElement GetXml()
{
if (_encryptedKey == null)
throw new CryptographicException(SR.Cryptography_Xml_InvalidElement, "KeyInfoEncryptedKey");
return _encryptedKey.GetXml();
}
internal override XmlElement GetXml(XmlDocument xmlDocument)
{
if (_encryptedKey == null)
throw new CryptographicException(SR.Cryptography_Xml_InvalidElement, "KeyInfoEncryptedKey");
return _encryptedKey.GetXml(xmlDocument);
}
public override void LoadXml(XmlElement value)
{
_encryptedKey = new EncryptedKey();
_encryptedKey.LoadXml(value);
}
}
}