HostedEmailProtectedDataStore Class

 

Protects and stores data using an encryption scheme.

Namespace:   Microsoft.WindowsServerSolutions.HostedEmail
Assembly:  Wssg.HostedEmailBase (in Wssg.HostedEmailBase.dll)

System::Object
  Microsoft.WindowsServerSolutions.HostedEmail::HostedEmailProtectedDataStore

public ref class HostedEmailProtectedDataStore 

NameDescription
System_CAPS_pubmethodHostedEmailProtectedDataStore(Guid, array<Byte>^)

Creates a new instance of the HostedEmailProtectedDataStore object, using the specified data store properties.

NameDescription
System_CAPS_pubpropertyItem[String^]

Retrieves or sets the data.

NameDescription
System_CAPS_pubmethodDestroy()

Destroys the protected data store.

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

All data stored in the class is encrypted using a password defined in the constructor, as well as the machine key of the system.

For more information about using the protected data store, see How to: Store Passwords and Other Sensitive Data.

The following code describes how to use the protected data store. For the complete code sample, see Quickstart: Creating a Hosted Email Adapter

internal static class CredentialManager
{
    private const string adminUserNameKey = "adminUserName";
    private const string adminPasswordKey = "adminPassword";
    // This is copied from ContosoHostedEmail.addin
    private const string addinId = "3983E9AC-B6D1-4A2A-881C-4B1CEFCA5266";
    // The following line is the result of executing the code 'Encoding.Unicode.GetBytes("P@ssw0rd");'
    static byte[] optionalEntropy = new byte[] { 80, 0, 64, 0, 115, 0, 115, 0, 119, 0, 48, 0, 114, 0, 100, 0 };
    static HostedEmailProtectedDataStore store = new HostedEmailProtectedDataStore(Guid.Parse(addinId), optionalEntropy);

    public static string AdminUserName
    {
        get
        {
            return store[adminUserNameKey];
        }
        set
        {
            store[adminUserNameKey] = value;
        }
    }

    public static string AdminPassword
    {
        get
        {
            return store[adminPasswordKey];
        }
        set
        {
            store[adminPasswordKey] = value;
        }
    }

    public static void ClearAll()
    {
        if (store != null) store.Destroy();
    }
}

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top

Community Additions

ADD
Show: