PowerSNMP for .NET
RetainPasswords Property




Controls whether to retain the authentication and privacy passwords in memory or not.
Syntax
<DefaultValueAttribute(True)>
Public Property RetainPasswords As Boolean
Dim instance As User
Dim value As Boolean
 
instance.RetainPasswords = value
 
value = instance.RetainPasswords
[DefaultValue(true)]
public bool RetainPasswords {get; set;}
[DefaultValue(true)]
public: __property bool get_RetainPasswords();
public: __property void set_RetainPasswords( 
   bool value
);
[DefaultValue(true)]
public:
property bool RetainPasswords {
   bool get();
   void set (    bool value);
}
Remarks
This is a security feature that can be used to minimize the amount of time sensitive password information is stored in memory. SNMPv3 USM requires local security keys created with the password and the authoritative Engine's ID. This potentially allows for the the use of a single username and password across many SNMP entities while each entity has a unique key for communications. If an entity's local key is leaked, the EngineID can be changed instead of the user password. The new Engine ID can be obtained via SNMPv3 discovery by entities that were previously in contact with the affected entity to resume communications. Setting this to false will essentially disable the SNMPv3 discovery mechanism as new keys can not be generated without the passwords. When set to true the passwords will remain in memory for the lifetime of the object or until this property is set to false. Doing so will allow the User to be reused for multiple SNMP Entities and allow for local security keys to be generated as needed but can increase the risk of password exposure. This is the default setting for this property. When set to false, the byte arrays for the authenticaion and privacy passwords, will be zeroed out and set to null if at least one local key exists in the LocalAuthenticationKeys or LocalPrivacyKeys collections. If there are no keys then they will be zereoed out and set to null when the first set of the local keys are generated. Contacting a different SNMP entity after this will lead to an SNMPv3 Discovery failure as new keys can not be calculated. Upon disposing the User object, the underlying byte arrays for both authentication and privacy passwords will be zeroed out and set to null regardless of this value.
See Also

Reference

User Class
User Members


PowerSNMP for .NET Documentation Version 8.1
© 2026 Dart Communications. All Rights Reserved.
Send comments on this topic