tuweni / org.apache.tuweni.rlpx / RLPxConnectionFactory

RLPxConnectionFactory

class RLPxConnectionFactory (source)

Factory creating RLPxConnection, either from initiating a handshake or responding to a handshake request.

Constructors

<init>

Factory creating RLPxConnection, either from initiating a handshake or responding to a handshake request.

RLPxConnectionFactory()

Functions

createConnection

Creates a RLPxConnection based off the complete handshake exchange.

static fun createConnection(initiator: Boolean, initiatorMessage: Bytes!, responderMessage: Bytes!, ourEphemeralPrivateKey: SecretKey!, peerEphemeralPublicKey: PublicKey!, initiatorNonce: Bytes32!, responderNonce: Bytes32!, ourPublicKey: PublicKey!, peerPublicKey: PublicKey!): RLPxConnection!

createHandshake

Creates a complete interaction to run a handshake with a remote peer.

static fun createHandshake(keyPair: KeyPair!, remotePublicKey: PublicKey!, initAndResponse: Function<Bytes!, AsyncResult<Bytes!>!>!): AsyncResult<RLPxConnection!>!

generateRandomBytes32

Generates a new random 32 byte array.

static fun generateRandomBytes32(): Bytes32!

init

Creates a handshake initiation message using ephemeral keys and a random nonce.

static fun init(keyPair: KeyPair!, remotePublicKey: PublicKey!, ephemeralKeyPair: KeyPair!, initiatorNonce: Bytes32!): Bytes!

messageSize

Identify the size of a handshake message based on elements of the common MAC.

static fun messageSize(msgBytes: Bytes!): Int

readResponse

Decrypts the handshake response using our private key.

static fun readResponse(response: Bytes!, privateKey: SecretKey!): HandshakeMessage!

respondToHandshake

Creates a RLPxConnection in response to a handshake initiation message.

static fun respondToHandshake(initiatorMessageBytes: Bytes!, keyPair: KeyPair!, responseHandler: Consumer<Bytes!>!): RLPxConnection!