net.i2p.data.i2cp

## Class BlindingInfoMessage

- java.lang.Object
- - net.i2p.data.i2cp.I2CPMessageImpl
  - - net.i2p.data.i2cp.BlindingInfoMessage

- All Implemented Interfaces:
    I2CPMessage

      public class BlindingInfoMessage
      extends I2CPMessageImpl

  Advise the router that the endpoint is blinded. Client to router. There is no reply. Preliminary - subject to change - See proposal 123.
  See Also:
    `BlindData`, `Blinding`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MESSAGE_TYPE` The message type
    `static int` | `TYPE_DEST` Endpoint type for destination
    `static int` | `TYPE_HASH` Endpoint type for hash
    `static int` | `TYPE_HOST` Endpoint type for hostname
    `static int` | `TYPE_KEY` Endpoint type for key

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlindingInfoMessage()` Creates an empty BlindingInfoMessage for reading
    `BlindingInfoMessage(BlindData bd, SessionId id)` This is the constructor used by I2CP client-side.
    `BlindingInfoMessage(Destination d, SessionId id, int expiration, int authType, SigType blindType, PrivateKey privKey, String secret)` Creates a BlindingInfoMessage for a destination.
    `BlindingInfoMessage(SigningPublicKey s, SessionId id, int expiration, int authType, SigType blindType, PrivateKey privKey, String secret)` Creates a BlindingInfoMessage for a signing public key.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doReadMessage(InputStream in, int size)` Read in the payload part of the message (after the initial 4 byte size and 1 byte type)
    `protected byte[]` | `doWriteMessage()` Write out the payload part of the message (not including the 4 byte size and 1 byte type)
    `int` | `getAuthType()` Gets the authentication type.
    `BlindData` | `getBlindData()` Gets the computed blind data.
    `String` | `getDestination()` Gets the destination for dest-type endpoints.
    `int` | `getEndpointType()` Gets the endpoint type.
    `Hash` | `getHash()` Gets the hash for hash-type endpoints.
    `String` | `getHostname()` Gets the hostname for host-type endpoints.
    `PrivateKey` | `getPrivateKey()` Gets the private key for key-type endpoints.
    `String` | `getSecret()` Gets the secret for PSK authentication.
    `SessionId` | `getSessionId()` Returns the session ID for this message.
    `SigningPublicKey` | `getSigningPublicKey()` Gets the signing public key for key-type endpoints.
    `long` | `getTimeout()` Gets the timeout for the blinding info.
    `int` | `getType()` Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages
    `SessionId` | `sessionId()` Return the SessionId for this message.
    `String` | `toString()`

    - ### Methods inherited from class net.i2p.data.i2cp.I2CPMessageImpl

      `readBytes, readMessage, readMessage, writeBytes, writeMessage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### MESSAGE_TYPE

          public static final int MESSAGE_TYPE

      The message type
      See Also:
        Constant Field Values

    - #### TYPE_DEST

          public static final int TYPE_DEST

      Endpoint type for destination
      See Also:
        Constant Field Values

    - #### TYPE_HASH

          public static final int TYPE_HASH

      Endpoint type for hash
      See Also:
        Constant Field Values

    - #### TYPE_HOST

          public static final int TYPE_HOST

      Endpoint type for hostname
      See Also:
        Constant Field Values

    - #### TYPE_KEY

          public static final int TYPE_KEY

      Endpoint type for key
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BlindingInfoMessage

          public BlindingInfoMessage()

      Creates an empty BlindingInfoMessage for reading

    - #### BlindingInfoMessage

          public BlindingInfoMessage(BlindData bd,
                                     SessionId id)

      This is the constructor used by I2CP client-side. Will create a DEST or KEY message type, depending on whether BlindData has the full destination.
      Parameters:
        `bd` - the blinded data
        `id` - the session ID

    - #### BlindingInfoMessage

          public BlindingInfoMessage(Destination d,
                                     SessionId id,
                                     int expiration,
                                     int authType,
                                     SigType blindType,
                                     PrivateKey privKey,
                                     String secret)

      Creates a BlindingInfoMessage for a destination.
      Parameters:
        `d` - the destination
        `id` - the session ID
        `expiration` - ms from now or 0 for forever
        `authType` - 0 (none), 1 (DH), 3 (PSK)
        `blindType` - the blinded signature type
        `privKey` - null for auth none, non-null for DH/PSK
        `secret` - may be null, 255 UTF-8 bytes max
      Throws:
        `IllegalArgumentException` - on invalid inputs

    - #### BlindingInfoMessage

          public BlindingInfoMessage(SigningPublicKey s,
                                     SessionId id,
                                     int expiration,
                                     int authType,
                                     SigType blindType,
                                     PrivateKey privKey,
                                     String secret)

      Creates a BlindingInfoMessage for a signing public key.
      Parameters:
        `s` - the signing public key
        `id` - the session ID
        `expiration` - ms from now or 0 for forever
        `authType` - 0 (none), 1 (DH), 3 (PSK)
        `blindType` - the blinded signature type
        `privKey` - null for auth none, non-null for DH/PSK
        `secret` - may be null, 255 UTF-8 bytes max
      Throws:
        `IllegalArgumentException` - on invalid inputs

  - ### Method Detail

    - #### doReadMessage

          protected void doReadMessage(InputStream in,
                                       int size)
                                throws I2CPMessageException,
                                       IOException

      Description copied from class: `I2CPMessageImpl`
      Read in the payload part of the message (after the initial 4 byte size and 1 byte type)
      Specified by:
        `doReadMessage` in class `I2CPMessageImpl`
      Parameters:
        `in` - InputStream
        `size` - payload size
      Throws:
        `I2CPMessageException` - if the message format is invalid
        `IOException` - if there's an error reading from the stream

    - #### doWriteMessage

          protected byte[] doWriteMessage()
                                   throws I2CPMessageException,
                                          IOException

      Description copied from class: `I2CPMessageImpl`
      Write out the payload part of the message (not including the 4 byte size and 1 byte type)
      Specified by:
        `doWriteMessage` in class `I2CPMessageImpl`
      Returns:
        byte array
      Throws:
        `I2CPMessageException` - if the message cannot be written
        `IOException` - if there's an error writing to the stream

    - #### getAuthType

          public int getAuthType()

      Gets the authentication type.
      Returns:
        0 (none), 1 (DH), 3 (PSK)

    - #### getBlindData

          public BlindData getBlindData()

      Gets the computed blind data.
      Returns:
        blind data or null if not enough info

    - #### getDestination

          public String getDestination()

      Gets the destination for dest-type endpoints.
      Returns:
        only valid if endpoint type == 2

    - #### getEndpointType

          public int getEndpointType()

      Gets the endpoint type.
      Returns:
        0 (hash) or 1 (host) or 2 (dest) or 3 (key)

    - #### getHash

          public Hash getHash()

      Gets the hash for hash-type endpoints.
      Returns:
        only valid if endpoint type == 0 or 2

    - #### getHostname

          public String getHostname()

      Gets the hostname for host-type endpoints.
      Returns:
        only valid if endpoint type == 1

    - #### getPrivateKey

          public PrivateKey getPrivateKey()

      Gets the private key for key-type endpoints.
      Returns:
        private key or null

    - #### getSecret

          public String getSecret()

      Gets the secret for PSK authentication.
      Returns:
        secret or null

    - #### getSessionId

          public SessionId getSessionId()

      Returns the session ID for this message.
      Returns:
        the session ID

    - #### getSigningPublicKey

          public SigningPublicKey getSigningPublicKey()

      Gets the signing public key for key-type endpoints.
      Returns:
        only valid if endpoint type == 2 or 3

    - #### getTimeout

          public long getTimeout()

      Gets the timeout for the blinding info.
      Returns:
        ms 1 to 2**32 - 1

    - #### getType

          public int getType()

      Description copied from interface: `I2CPMessage`
      Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages
      Returns:
        unique identifier for this type of message

    - #### sessionId

          public SessionId sessionId()

      Return the SessionId for this message.
      Specified by:
        `sessionId` in interface `I2CPMessage`
      Overrides:
        `sessionId` in class `I2CPMessageImpl`
      Returns:
        null always. Extending classes with a SessionId must override.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`