Class TargetBuilder.DirectUserBuilder
java.lang.Object
org.snmp4j.fluent.TargetBuilder.DirectUserBuilder
- Enclosing class:
TargetBuilder<A extends Address>
- Since:
- 3.5.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDirectUserBuilder(OctetString securityName) protectedDirectUserBuilder(OctetString securityName, byte[] authoritativeEngineID) -
Method Summary
Modifier and TypeMethodDescriptionSets the authentication protocol to use for the DirectUserTarget.auth(TargetBuilder.AuthProtocol authenticationProtocol) authKey(byte[] authKey) Sets the authentication key to use for the DirectUserTarget.authPassphrase(String authPassword) authPassphrase(OctetString authPassword) This will set thedeferLocalizationUntilFirstUsagetotrue.done()Finalizes the configuration of the DirectUserTarget and returns the enclosing TargetBuilder instance.Sets the privacy protocol to use for the DirectUserTarget.priv(TargetBuilder.PrivProtocol privacyProtocol) privKey(byte[] privKey) Sets the privacy key to use for the DirectUserTarget.privPassphrase(String privPassword) privPassphrase(OctetString privPassword)
-
Constructor Details
-
DirectUserBuilder
-
DirectUserBuilder
-
-
Method Details
-
deferLocalizationUntilFirstUsage
This will set thedeferLocalizationUntilFirstUsagetotrue. The target's authoritative engine ID will be resolved whileSnmp.sendMessage(PDU, Target, TransportMapping, PduHandleCallback)is being executed then. Thus, the computing-intensive localization of the provided passphrases to localized keys will be done while sending the message, not when the target is created. This might need adjustment to theTargetBuilder.timeout(long)andTargetBuilder.retries(int)values. If set tofalse(which is the default), then the target's authoritative engine ID will be resolved whendone()is being executed.- Returns:
- this.
- Since:
- 3.9.3
-
auth
-
auth
Sets the authentication protocol to use for the DirectUserTarget. Matching is case-insensitive and hyphens are ignored, so "SHA256", "SHA-256", and "hmac192sha256" all resolve toTargetBuilder.AuthProtocol.hmac192sha256.- Parameters:
authenticationProtocol- one of "MD5", "SHA-1" (or "SHA1"), "SHA-224" (or "SHA224"), "SHA-256" (or "SHA256"), "SHA-384" (or "SHA384"), "SHA-512" (or "SHA512"), or the enum constant name (e.g. "hmac192sha256")- Returns:
- this.
- Throws:
IllegalArgumentException- if the protocol name is not recognised- Since:
- 3.11.0
-
priv
-
priv
Sets the privacy protocol to use for the DirectUserTarget. Matching is case-insensitive and hyphens are ignored, so "AES128", "AES-128", and "aes128" all resolve toTargetBuilder.PrivProtocol.aes128.- Parameters:
privacyProtocol- one of "DES", "3DES", "AES-128" (or "AES128"), "AES-192" (or "AES192"), "AES-256" (or "AES256"), "AES-192-3DESkeyext", "AES-256-3DESkeyext", or the enum constant name (e.g. "aes128")- Returns:
- this.
- Throws:
IllegalArgumentException- if the protocol name is not recognised- Since:
- 3.11.0
-
authPassphrase
-
authPassphrase
-
privPassphrase
-
privPassphrase
-
authKey
Sets the authentication key to use for the DirectUserTarget.- Parameters:
authKey- localized (with authoritative engine ID) authentication key. Providing a passphrase overrides a provided key.- Returns:
- this.
- Since:
- 3.11.0
-
privKey
Sets the privacy key to use for the DirectUserTarget.- Parameters:
privKey- localized (with authoritative engine ID) privacy key. Provided as a byte array. Providing a passphrase overrides a provided key.- Returns:
- this.
- Since:
- 3.11.0
-
done
Finalizes the configuration of the DirectUserTarget and returns the enclosing TargetBuilder instance. This method processes the necessary information, such as security protocols, passwords, and engine IDs, to construct a DirectUserTarget with appropriate security attributes. If the authoritative engine ID is not provided explicitly and localization is not deferred until the first usage, it attempts to discover the engine ID. The method also handles generating authentication and privacy keys if required.- Returns:
- The enclosing TargetBuilder instance, allowing actually building the target with
TargetBuilder.build().
-