Class TargetBuilder.DirectUserBuilder

java.lang.Object
org.snmp4j.fluent.TargetBuilder.DirectUserBuilder
Enclosing class:
TargetBuilder<A extends Address>

public class TargetBuilder.DirectUserBuilder extends Object
Since:
3.5.0
Author:
Frank Fock
  • Constructor Details

    • DirectUserBuilder

      protected DirectUserBuilder(OctetString securityName)
    • DirectUserBuilder

      protected DirectUserBuilder(OctetString securityName, byte[] authoritativeEngineID)
  • Method Details

    • deferLocalizationUntilFirstUsage

      public TargetBuilder<A>.DirectUserBuilder deferLocalizationUntilFirstUsage()
      This will set the deferLocalizationUntilFirstUsage to true. The target's authoritative engine ID will be resolved while Snmp.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 the TargetBuilder.timeout(long) and TargetBuilder.retries(int) values. If set to false (which is the default), then the target's authoritative engine ID will be resolved when done() is being executed.
      Returns:
      this.
      Since:
      3.9.3
    • auth

      public TargetBuilder<A>.DirectUserBuilder auth(TargetBuilder.AuthProtocol authenticationProtocol)
    • auth

      public TargetBuilder<A>.DirectUserBuilder auth(String authenticationProtocol)
      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 to TargetBuilder.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

      public TargetBuilder<A>.DirectUserBuilder priv(String privacyProtocol)
      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 to TargetBuilder.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

      public TargetBuilder<A>.DirectUserBuilder authPassphrase(String authPassword)
    • authPassphrase

      public TargetBuilder<A>.DirectUserBuilder authPassphrase(OctetString authPassword)
    • privPassphrase

      public TargetBuilder<A>.DirectUserBuilder privPassphrase(String privPassword)
    • privPassphrase

      public TargetBuilder<A>.DirectUserBuilder privPassphrase(OctetString privPassword)
    • authKey

      public TargetBuilder<A>.DirectUserBuilder authKey(byte[] 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

      public TargetBuilder<A>.DirectUserBuilder privKey(byte[] 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

      public TargetBuilder<A> 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().