Plumtree EDK (Enterprise Web Development Kit) 5.4.0 |

# IPortletResponse.SetEncryptedSettingValue Method

Uses the cryptographer supplied by the client to encrypt and set a new value for a setting.

void SetEncryptedSettingValue(
SettingType type,
string name,
string newValue,
ICryptoTransform crypto
);

#### Parameters

type
  the type of setting (e.g., Admin, Portlet, User)
name
  the name of the setting
newValue
  the new value to set for this setting
crypto
  the cryptographer that should be used to encrypt the setting value

#### Remarks

To retrieve an encrypted setting, the Portlet must use `IPortletRequest.GetEncryptedSettingValue()` with the same cryptographer. Note: UserInfo settings cannot be set by a Portlet. For example:

IPortletResponse portletResponse = ...;

byte[] secretKey = new byte[8] { 1,2,3,4,5,6,7,8 };

byte[] initVector new byte[8] { 1,2,3,4,5,6,7,8 };

ICryptoTransform cryptoTransform = new DESCryptoServiceProvider().CreateEncryptor(secretKey, initVector);

portletResponse.SetEncryptedSettingValue(SettingType.Admin, "password", "secretpassword",cryptoTransform);

Note that the CreateDecryptor method on the same CryptoServiceProvider should be used to decrypt the value in IPortletRequest.GetEncryptedSettingValue

#### Exceptions

Exception Type | Condition
--- | ---
NotGatewayedException | if the request is not gatewayed
ArgumentException | if the user tries to set a UserInfo setting
CryptoException | if there is an error encrypting the setting value

#### See Also

IPortletResponse Interface | Plumtree.Remote.Portlet Namespace