java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.BlindingInfoMessage
- All Implemented Interfaces:
I2CPMessage
Advise the router that the endpoint is blinded. Client to router. There is no reply. Preliminary - subject to change - See proposal 123.
Field Summary
Modifier and TypeFieldDescriptionprivate intThe authorization type of the destination.private BlindDataThe blind data built from the message.private SigTypeThe signature type of the blinded key.private DestinationThe blinded destination.private intThe endpoint type of the blinded destination.private longWhen the blind data expires.private HashThe hash of the blinded destination.private StringThe host offering the destination.private PrivateKeyThe authorization private key, if any.private SigningPublicKeyThe blinded signing public key.private StringThe secret code required to use the destination.private SessionIdThe session id of the blinded destination.private static final intMask of the authorization type bits.private static final intFlag that a secret code is required.static final intThe message type.static final intEndpoint type for destination.static final intEndpoint type for hash.static final intEndpoint type for hostname.static final intEndpoint type for key.Constructor Summary
ModifierConstructorDescriptionCreates 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.privateBlindingInfoMessage(SessionId id, long expiration, int authType, SigType blindType, PrivateKey privKey, String secret) Builds the message from its parsed parts.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
Public MethodsModifier and TypeMethodDescriptionprotected voiddoReadMessage(InputStream in, int size) Read in the payload part of the message (after the initial 4 byte size and 1 byte type).protected byte[]Write out the payload part of the message (not including the 4 byte size and 1 byte type).intGets the authentication type.Gets the computed blind data.Gets the destination for dest-type endpoints.intThe endpoint type selector.getHash()Gets the hash for hash-type endpoints.Gets the hostname for host-type endpoints.Gets the private key for key-type endpoints.Gets the secret for PSK authentication.Returns the session ID for this message.Gets the signing public key for key-type endpoints.longGets the timeout for the blinding info.intgetType()Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages.Return the SessionId for this message.toString()Methods inherited from class I2CPMessageImpl
readBytes, readMessage, readMessage, writeBytes, writeMessageModifier and TypeMethodDescriptionvoidreadBytes(InputStream in) Read the message from the stream, wrapping I2CPMessageException inDataFormatException.voidValidate the type and size of the message, and then read the message into the data structures.voidreadMessage(InputStream in, int length, int type) Read the body into the data structures.voidwriteBytes(OutputStream out) Write the message to the stream, wrapping I2CPMessageException in DataFormatException.voidwriteMessage(OutputStream out) Write out the full message to the stream, including the 4 byte size and 1 byte type header.
Field Details
MESSAGE_TYPE
_sessionId
The session id of the blinded destination._endpointType
private int _endpointTypeThe endpoint type of the blinded destination._authType
private int _authTypeThe authorization type of the destination._blindType
The signature type of the blinded key._expiration
private long _expirationWhen the blind data expires._hash
The hash of the blinded destination._host
The host offering the destination._dest
The blinded destination._pubkey
The blinded signing public key._privkey
The authorization private key, if any._secret
The secret code required to use the destination._blindData
The blind data built from the message.FLAG_AUTH
private static final int FLAG_AUTHMask of the authorization type bits.- See Also:
FLAG_SECRET
private static final int FLAG_SECRETFlag that a secret code is required.- See Also:
TYPE_HASH
TYPE_HOST
TYPE_DEST
TYPE_KEY
Constructor Details
BlindingInfoMessage
public BlindingInfoMessage()Creates an empty BlindingInfoMessage for reading.BlindingInfoMessage
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-nullid- the session IDexpiration- ms from now or 0 for foreverauthType- 0 (none), 1 (DH), 3 (PSK)blindType- the blinded signature typeprivKey- null for auth none, non-null for DH/PSKsecret- 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 keyid- the session IDexpiration- ms from now or 0 for foreverauthType- 0 (none), 1 (DH), 3 (PSK)blindType- the blinded signature typeprivKey- null for auth none, non-null for DH/PSKsecret- 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 destinationexpiration- when the blind data expiresauthType- the authorization typeblindType- the signature type of the blinded keyprivKey- the authorization private key, null if nonesecret- the secret code, null if none
Method Details
getSessionId
sessionId
Return the SessionId for this message.- Specified by:
sessionIdin interfaceI2CPMessage- Overrides:
sessionIdin classI2CPMessageImpl- 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
Gets the hash for hash-type endpoints.- Returns:
- only valid if endpoint type == 0 or 2
getHostname
Gets the hostname for host-type endpoints.- Returns:
- only valid if endpoint type == 1
getDestination
Gets the destination for dest-type endpoints.- Returns:
- only valid if endpoint type == 2
getSigningPublicKey
Gets the signing public key for key-type endpoints.- Returns:
- only valid if endpoint type == 2 or 3
getPrivateKey
Gets the private key for key-type endpoints.- Returns:
- private key or null
getSecret
getBlindData
Gets the computed blind data.- Returns:
- blind data or null if not enough info
doReadMessage
Description copied from class:I2CPMessageImplRead in the payload part of the message (after the initial 4 byte size and 1 byte type).- Specified by:
doReadMessagein classI2CPMessageImpl- Parameters:
in- positioned just past the 4 byte size and 1 byte type headersize- how many payload bytes remain to be read- Throws:
I2CPMessageException- if the message format is invalidIOException- if there's an error reading from the stream
doWriteMessage
Description copied from class:I2CPMessageImplWrite out the payload part of the message (not including the 4 byte size and 1 byte type).- Specified by:
doWriteMessagein classI2CPMessageImpl- Returns:
- byte array
- Throws:
I2CPMessageException- if the message cannot be writtenIOException- if there's an error writing to the stream
getType
public int getType()Description copied from interface:I2CPMessageReturn 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