Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

111 lines
8.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<Type Name="ProtectedData" FullName="System.Security.Cryptography.ProtectedData">
<TypeSignature Language="C#" Value="public sealed class ProtectedData" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ProtectedData extends System.Object" />
<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>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This class provides access to the Data Protection API (DPAPI) available in Microsoft Windows 2000 and later operating systems. This is a service that is provided by the operating system and does not require additional libraries. It provides protection using the user or machine credentials to encrypt or decrypt data.</para>
<para>The class consists of two wrappers for the unmanaged DPAPI, <see cref="M:System.Security.Cryptography.ProtectedData.Protect(System.Byte[],System.Byte[],System.Security.Cryptography.DataProtectionScope)" /> and <see cref="M:System.Security.Cryptography.ProtectedData.Unprotect(System.Byte[],System.Byte[],System.Security.Cryptography.DataProtectionScope)" />. These two methods can be used to encrypt and decrypt data such as passwords, keys, and connection strings.</para>
<para>If you use these methods during impersonation, you may receive the following error: "Key not valid for use in specified state." This occurs because the DPAPI stores the key data in user profiles. If the profile is not loaded, DPAPI wont be able to perform the decryption. To prevent this error, load the profile of the user you want to impersonate before calling either method. Using DPAPI with impersonation can incur significant complication and requires careful design choices.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Provides methods for encrypting and decrypting data. This class cannot be inherited.</para>
</summary>
</Docs>
<Members>
<Member MemberName="Protect">
<MemberSignature Language="C#" Value="public static byte[] Protect (byte[] userData, byte[] optionalEntropy, System.Security.Cryptography.DataProtectionScope scope);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig unsigned int8[] Protect(unsigned int8[] userData, unsigned int8[] optionalEntropy, valuetype System.Security.Cryptography.DataProtectionScope scope) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Byte[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="userData" Type="System.Byte[]" />
<Parameter Name="optionalEntropy" Type="System.Byte[]" />
<Parameter Name="scope" Type="System.Security.Cryptography.DataProtectionScope" />
</Parameters>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This method can be used to encrypt data such as passwords, keys, or connection strings. The <paramref name="optionalEntropy" /> parameter enables you to add data to increase the complexity of the encryption; specify null for no additional complexity. If provided, this information must also be used when decrypting the data using the <see cref="M:System.Security.Cryptography.ProtectedData.Unprotect(System.Byte[],System.Byte[],System.Security.Cryptography.DataProtectionScope)" /> method.</para>
<block subset="none" type="note">
<para>If you use this method during impersonation, you may receive the following error: "Key not valid for use in specified state." To prevent this error, load the profile of the user you want to impersonate before calling the method.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Encrypts the data in a specified byte array and returns a byte array that contains the encrypted data.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A byte array representing the encrypted data.</para>
</returns>
<param name="userData">
<attribution license="cc4" from="Microsoft" modified="false" />A byte array that contains data to encrypt. </param>
<param name="optionalEntropy">
<attribution license="cc4" from="Microsoft" modified="false" />An optional additional byte array used to increase the complexity of the encryption, or null for no additional complexity.</param>
<param name="scope">
<attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the scope of encryption. </param>
</Docs>
</Member>
<Member MemberName="Unprotect">
<MemberSignature Language="C#" Value="public static byte[] Unprotect (byte[] encryptedData, byte[] optionalEntropy, System.Security.Cryptography.DataProtectionScope scope);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig unsigned int8[] Unprotect(unsigned int8[] encryptedData, unsigned int8[] optionalEntropy, valuetype System.Security.Cryptography.DataProtectionScope scope) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Byte[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="encryptedData" Type="System.Byte[]" />
<Parameter Name="optionalEntropy" Type="System.Byte[]" />
<Parameter Name="scope" Type="System.Security.Cryptography.DataProtectionScope" />
</Parameters>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This method can be used to unprotect data that was encrypted using the <see cref="M:System.Security.Cryptography.ProtectedData.Protect(System.Byte[],System.Byte[],System.Security.Cryptography.DataProtectionScope)" /> method. If the <paramref name="optionalEntropy" /> parameter was used during encryption, it must be supplied to unencrypt the data.</para>
<block subset="none" type="note">
<para>If you use this method during impersonation, you may receive the following error: "Key not valid for use in specified state." To prevent this error, load the profile of the user you want to impersonate before calling the method.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A byte array representing the decrypted data.</para>
</returns>
<param name="encryptedData">
<attribution license="cc4" from="Microsoft" modified="false" />A byte array containing data encrypted using the <see cref="M:System.Security.Cryptography.ProtectedData.Protect(System.Byte[],System.Byte[],System.Security.Cryptography.DataProtectionScope)" /> method. </param>
<param name="optionalEntropy">
<attribution license="cc4" from="Microsoft" modified="false" />An optional additional byte array that was used to encrypt the data, or null if the additional byte array was not used.</param>
<param name="scope">
<attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the scope of data protection that was used to encrypt the data. </param>
</Docs>
</Member>
</Members>
</Type>