Data Protection Provider ProtectAsync

Syntax
dataProtectionProvider.protectAsync(data).done( /* Your success and error handlers */ );
Parameters
dataType: IBuffer
Data to protect.
Return value
Type: IAsyncOperation
Represents an asynchronous operation.
Remarks
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, myweb.com"
Examples
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; }
Requirements
Minimum supported client |
Windows 8 |
---|---|
Minimum supported server |
Windows Server 2012 |
Minimum supported phone |
Windows Phone 8.1 [Windows Runtime apps only] |
Namespace |
Windows.Security.Cryptography.DataProtection Windows::Security::Cryptography::DataProtection [C++] |
Metadata |
Windows.winmd |
You might also like
Dont rely on Uncle Sams help for retirement
by RetirementWarningTwenty 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 complexrequiring years of planning, a well-thought-out strategy, and a phase to be put off as much as possible.
Were 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. todays 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.”.