Documentation Center

Migrating older Audience Manager passwords to encrypted passwords

The sample webpages provided in a previous version of Audience Manager stored passwords in plain text. After upgrading to the current version, we recommend that you use the utility methods that are now provided in the API to encrypt passwords using one-way hash values.

Converting plain text passwords to hash values
The Audience Manager API (.NET) provides access to Audience Manager item types (Contacts and Segments) on the Content Manager. If you already have Contacts with plain text passwords, you can convert these passwords to one-way hash values using the DigestPassword() and CheckPassword() methods in the Tridion.AudienceManagement.API namespace.
To upgrade Contacts that have a password (and ignore passwords that are empty):
var someAddressBook = new StaticAddressBook(new TcmUri(addressBookId), userContext);
IEnumerable<Contact> contacts = Contact.GetContacts(userContext, new ContactFilter(userContext), someAddressBook);
foreach (var contact in contacts)
{
	contact.ReloadReadOnlyContact(); // Fully load the contact 
	string password = (string)contact.ExtendedDetails["password"].Value;

	if (password == null) continue;

	password = Digests.DigestPassword(password);
	contact.ExtendedDetails["password"].Value = password;
	contact.Save();
}
Encrypting passwords to hash values
If your website uses Java, encrypt passwords using the DigestPassword() and CheckPassword() methods in the com.tridion.marketingsolution.utilities package (Outbound E-mail Content Delivery (Java) API).
If your website uses .NET, encrypt passwords using the DigestPassword() and CheckPassword() methods in the Tridion.OutboundEmail.ContentDelivery.Utilities namespace (Outbound E-mail Content Delivery (.NET) API).