Data Protection Provider ProtectAsync // IT Management Solutions

Data Protection Provider ProtectAsync

Data Protection Provider


dataProtectionProvider.protectAsync(data).done( /* Your success and error handlers */ );



Type: IBuffer

Data to protect.

Return value

Type: IAsyncOperation

Represents an asynchronous operation.


You must call the DataProtectionProvider(String) constructor before calling this method.

For security descriptors and SDDL strings, you must set the enterprise authentication capability in the manifest. The enterprise authentication capability is restricted to Windows Store apps built with company accounts, and is subject to additional onboarding validation. You should avoid the enterprise authentication capability unless it is absolutely necessary. For more information, see Registering for a Windows Store developer account.

For example, the following SID and SDDL providers require the enterprise authentication capability:

  • "SDDL=O:S-1-5-5-0-290724G:SYD:(A;;CCDC;;;S-1-5-5-0-290724)(A;;DC;;;WD)"

These providers do not require the enterprise authentication capability:

  • "LOCAL=user"
  • "LOCAL=machine"
  • "WEBCREDENTIALS=MyPasswordName"
  • "WEBCREDENTIALS=MyPasswordName,"


The following example shows how to protect static data.

public async Task SampleProtectAsync( String strMsg, String strDescriptor, BinaryStringEncoding encoding) { // Create a DataProtectionProvider object for the specified descriptor. DataProtectionProvider Provider = new DataProtectionProvider(strDescriptor); // Encode the plaintext input message to a buffer. encoding = BinaryStringEncoding.Utf8; IBuffer buffMsg = CryptographicBuffer.ConvertStringToBinary(strMsg, encoding); // Encrypt the message. IBuffer buffProtected = await Provider.ProtectAsync(buffMsg); // Execution of the SampleProtectAsync function resumes here // after the awaited task (Provider.ProtectAsync) completes. return buffProtected; }


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows.Security.Cryptography.DataProtection Windows::Security::Cryptography::DataProtection [C++]



You might also like

Don’t rely on ‘Uncle Sam’s’ help for retirement

by RetirementWarning

Twenty years ago, retirement was a time to look forward to and savor. But, today, we live in uncertain times. So, for most working adults, retirement has become very complex—requiring years of planning, a well-thought-out strategy, and a phase to be put off as much as possible.
We’re living more years in retirement.
Why? Company-sponsored pensions have all but become extinct. Thanks to medical advances and healthier lifestyles, people are living longer. In the early 20th century, life expectancy was 47.3 years vs. today’s life span of nearly 79 years.1 According to data from the Social Security Administration, a man who lives to 65 will live on average to age 84, while women of the same age should live to age 86

Scores of blunders sees Norfolk councils breach data laws over confidential ..  — Norfolk Eastern Daily Press
Information Commissioner Christopher Graham has previously called for councils to take their responsibilities for protecting personal data more seriously. He said in 2012: “There is clearly an underlying problem with data protection in local government.”.

Related Posts

Copyright © . All Rights Reserved