-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
ProtectedMemory.xml
165 lines (140 loc) · 11.7 KB
/
ProtectedMemory.xml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<Type Name="ProtectedMemory" FullName="System.Security.Cryptography.ProtectedMemory">
<TypeSignature Language="C#" Value="public sealed class ProtectedMemory" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ProtectedMemory extends System.Object" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5" />
<TypeSignature Language="DocId" Value="T:System.Security.Cryptography.ProtectedMemory" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class ProtectedMemory" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5" />
<TypeSignature Language="F#" Value="type ProtectedMemory = class" />
<TypeSignature Language="C++ CLI" Value="public ref class ProtectedMemory sealed" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5" />
<TypeSignature Language="C#" Value="public static class ProtectedMemory" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit ProtectedMemory extends System.Object" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<TypeSignature Language="VB.NET" Value="Public Class ProtectedMemory" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<TypeSignature Language="C++ CLI" Value="public ref class ProtectedMemory abstract sealed" FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<AssemblyInfo>
<AssemblyName>System.Security</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides methods for protecting and unprotecting memory. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This class provides access to the Data Protection API (DPAPI) available in the Windows XP and later operating systems. This is a service that is provided by the operating system and does not require additional libraries. It provides encryption for sensitive data in memory.
The class consists of two wrappers for the unmanaged DPAPI, <xref:System.Security.Cryptography.ProtectedMemory.Protect%2A> and <xref:System.Security.Cryptography.ProtectedMemory.Unprotect%2A>. These two methods can be used to encrypt and decrypt data in memory.
## Examples
The following example shows how to use data protection.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Security.Cryptography/MemoryProtectionScope/Overview/memoryprotectionsample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/vb/memoryprotectionsample.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName="Protect">
<MemberSignature Language="C#" Value="public static void Protect (byte[] userData, System.Security.Cryptography.MemoryProtectionScope scope);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Protect(unsigned int8[] userData, valuetype System.Security.Cryptography.MemoryProtectionScope scope) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.Cryptography.ProtectedMemory.Protect(System.Byte[],System.Security.Cryptography.MemoryProtectionScope)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Protect (userData As Byte(), scope As MemoryProtectionScope)" />
<MemberSignature Language="F#" Value="static member Protect : byte[] * System.Security.Cryptography.MemoryProtectionScope -> unit" Usage="System.Security.Cryptography.ProtectedMemory.Protect (userData, scope)" />
<MemberSignature Language="C++ CLI" Value="public:
 static void Protect(cli::array <System::Byte> ^ userData, System::Security::Cryptography::MemoryProtectionScope scope);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Security</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="userData" Type="System.Byte[]" />
<Parameter Name="scope" Type="System.Security.Cryptography.MemoryProtectionScope" />
</Parameters>
<Docs>
<param name="userData">The byte array containing data in memory to protect. The array must be a multiple of 16 bytes.</param>
<param name="scope">One of the enumeration values that specifies the scope of memory protection.</param>
<summary>Protects the specified data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to protect data in memory. Note that the method does not make a copy of the data, but encrypts the byte array in place. The `userData` parameter must be 16 bytes in length or a multiple of 16 bytes.
Support for this method is available in the Windows XP and later operating systems.
## Examples
The following code example shows how to use data protection.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Security.Cryptography/MemoryProtectionScope/Overview/memoryprotectionsample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/vb/memoryprotectionsample.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.Security.Cryptography.CryptographicException">
<paramref name="userData" /> must be 16 bytes in length or in multiples of 16 bytes.</exception>
<exception cref="T:System.NotSupportedException">The operating system does not support this method. This method can be used only with the Windows 2000 or later operating systems.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="userData" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Unprotect">
<MemberSignature Language="C#" Value="public static void Unprotect (byte[] encryptedData, System.Security.Cryptography.MemoryProtectionScope scope);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Unprotect(unsigned int8[] encryptedData, valuetype System.Security.Cryptography.MemoryProtectionScope scope) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.Cryptography.ProtectedMemory.Unprotect(System.Byte[],System.Security.Cryptography.MemoryProtectionScope)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Unprotect (encryptedData As Byte(), scope As MemoryProtectionScope)" />
<MemberSignature Language="F#" Value="static member Unprotect : byte[] * System.Security.Cryptography.MemoryProtectionScope -> unit" Usage="System.Security.Cryptography.ProtectedMemory.Unprotect (encryptedData, scope)" />
<MemberSignature Language="C++ CLI" Value="public:
 static void Unprotect(cli::array <System::Byte> ^ encryptedData, System::Security::Cryptography::MemoryProtectionScope scope);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Security</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="encryptedData" Type="System.Byte[]" />
<Parameter Name="scope" Type="System.Security.Cryptography.MemoryProtectionScope" />
</Parameters>
<Docs>
<param name="encryptedData">The byte array in memory to unencrypt.</param>
<param name="scope">One of the enumeration values that specifies the scope of memory protection.</param>
<summary>Unprotects data in memory that was protected using the <see cref="M:System.Security.Cryptography.ProtectedMemory.Protect(System.Byte[],System.Security.Cryptography.MemoryProtectionScope)" /> method.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method can be used to unencrypt data in memory that was encrypted using the <xref:System.Security.Cryptography.ProtectedMemory.Protect%2A> method.
Support for this method is available in the Windows XP and later operating systems.
## Examples
The following example shows how to use data protection.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Security.Cryptography/MemoryProtectionScope/Overview/memoryprotectionsample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/vb/memoryprotectionsample.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.NotSupportedException">The operating system does not support this method. This method can be used only with the Windows 2000 or later operating systems.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="encryptedData" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
<paramref name="encryptedData" /> is empty.
-or-
This call was not implemented.
-or-
NTSTATUS contains an error.</exception>
</Docs>
</Member>
</Members>
</Type>