java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.BlindingInfoMessage
All Implemented Interfaces:
I2CPMessage

public class BlindingInfoMessageextends 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:
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      The message type.
      See Also:
    • _sessionId

      private SessionId _sessionId
      The session id of the blinded destination.
    • _endpointType

      private int _endpointType
      The endpoint type of the blinded destination.
    • _authType

      private int _authType
      The authorization type of the destination.
    • _blindType

      private SigType _blindType
      The signature type of the blinded key.
    • _expiration

      private long _expiration
      When the blind data expires.
    • _hash

      private Hash _hash
      The hash of the blinded destination.
    • _host

      private String _host
      The host offering the destination.
    • _dest

      private Destination _dest
      The blinded destination.
    • _pubkey

      private SigningPublicKey _pubkey
      The blinded signing public key.
    • _privkey

      private PrivateKey _privkey
      The authorization private key, if any.
    • _secret

      private String _secret
      The secret code required to use the destination.
    • _blindData

      private BlindData _blindData
      The blind data built from the message.
    • FLAG_AUTH

      private static final int FLAG_AUTH
      Mask of the authorization type bits.
      See Also:
    • FLAG_SECRET

      private static final int FLAG_SECRET
      Flag that a secret code is required.
      See Also:
    • TYPE_HASH

      public static final int TYPE_HASH
      Endpoint type for hash.
      See Also:
    • TYPE_HOST

      public static final int TYPE_HOST
      Endpoint type for hostname.
      See Also:
    • TYPE_DEST

      public static final int TYPE_DEST
      Endpoint type for destination.
      See Also:
    • TYPE_KEY

      public static final int TYPE_KEY
      Endpoint type for key.
      See Also:
  • Constructor Details

    • 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 being blinded, must be non-null
      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
    • BlindingInfoMessage

      private BlindingInfoMessage(SessionId id, long expiration, int authType, SigType blindType, PrivateKey privKey, String secret)
      Builds the message from its parsed parts.
      Parameters:
      id - the session id of the destination
      expiration - when the blind data expires
      authType - the authorization type
      blindType - the signature type of the blinded key
      privKey - the authorization private key, null if none
      secret - the secret code, null if none
  • Method Details

    • getSessionId

      public SessionId getSessionId()
      Returns the session ID for this message.
      Returns:
      the session ID
    • 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.
    • getTimeout

      public long getTimeout()
      Gets the timeout for the blinding info.
      Returns:
      ms 1 to 2**32 - 1
    • getAuthType

      public int getAuthType()
      Gets the authentication type.
      Returns:
      0 (none), 1 (DH), 3 (PSK)
    • getEndpointType

      public int getEndpointType()
      The endpoint type selector.
      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
    • getDestination

      public String getDestination()
      Gets the destination for dest-type endpoints.
      Returns:
      only valid if endpoint type == 2
    • getSigningPublicKey

      public SigningPublicKey getSigningPublicKey()
      Gets the signing public key for key-type endpoints.
      Returns:
      only valid if endpoint type == 2 or 3
    • 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
    • getBlindData

      public BlindData getBlindData()
      Gets the computed blind data.
      Returns:
      blind data or null if not enough info
    • 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 - positioned just past the 4 byte size and 1 byte type header
      size - how many payload bytes remain to be read
      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
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object