AquaLogic Interaction Development Kit (IDK) 6.0.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 (Admin, Community, CommunityPortlet, Portlet, Session, or 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 ortlet. 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: The `CreateDecryptor` method on the same `CryptoServiceProvider` should be used to decrypt the value in `IPortletRequest.GetEncryptedSettingValue`.

#### Exceptions

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

#### See Also

IPortletResponse Interface | Plumtree.Remote.Portlet Namespace