Share via


ProtectedKey.CreateFromPlaintextKey Method

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Constructor method use to create a new ProtectedKey from a plaintext symmetric key. The caller of this method is responsible for clearing the byte array containing the plaintext key after calling this method.

Namespace:  Microsoft.Practices.EnterpriseLibrary.Security.Cryptography
Assembly:  Microsoft.Practices.EnterpriseLibrary.Security.Cryptography (in Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll)

Syntax

'Declaration
PublicSharedFunctionCreateFromPlaintextKey ( _
    plaintextKeyAs Byte(), _
    dataProtectionScopeAs DataProtectionScope _
) As ProtectedKey
publicstatic ProtectedKey CreateFromPlaintextKey(
    byte[] plaintextKey,
    DataProtectionScope dataProtectionScope
)
public:
static ProtectedKey^ CreateFromPlaintextKey(
    array<unsigned char>^ plaintextKey, 
    DataProtectionScope dataProtectionScope
)
publicstaticfunctionCreateFromPlaintextKey(
    plaintextKey : byte[], 
    dataProtectionScope : DataProtectionScope
) : ProtectedKey

Parameters

  • plaintextKey
    Type: array<System.Byte>
    Plaintext key to protect. The caller of this method is responsible for clearing the byte array containing the plaintext key after calling this method.

Return Value

Initialized ProtectedKey containing the plaintext key protected with DPAPI.

See Also

ProtectedKey Class

Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Namespace

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.