CryptProtectDataHex protects the data with a user or machine key and returns hex-encoded value of the data.
<Binary Id="Cryptography" SourceFile="relative path to Cryptography.dll"/>
<Property Id="CRYPTPROTECT_DATA" Hidden="yes" />
<Property Id="CRYPTPROTECT_FLAGS" Value="CRYPTPROTECT_LOCAL_MACHINE|CRYPTPROTECT_UI_FORBIDDEN" />
<CustomAction Id="EncryptPassword" BinaryKey="Cryptography" DllEntry="CryptProtectDataHex"Execute="immediate" />
<CustomAction Id="SetDBUSERsPASSWORDForEncryption"Property="CRYPTPROTECT_DATA" Value="[PASSWORD]" />
<InstallExecuteSequence>
<Custom Action="SetDBUSERsPASSWORDForEncryption" After="InstallInitialize" />
<Custom Action="EncryptPassword" After="SetDBUSERsPASSWORDForEncryption" />
</InstallExecuteSequence>