Fabcoin Core
0.16.2
P2P Digital Currency
|
Encoder/decoder transport for RLPx connection established by RLPXHandshake. More...
#include <RLPXFrameCoder.h>
Public Member Functions | |
RLPXFrameCoder (RLPXHandshake const &_init) | |
Construct; requires instance of RLPXHandshake which has encrypted ECDH key exchange (first two phases of handshake). More... | |
RLPXFrameCoder (bool _originated, h512 const &_remoteEphemeral, h256 const &_remoteNonce, crypto::ECDHE const &_ephemeral, h256 const &_nonce, bytesConstRef _ackCipher, bytesConstRef _authCipher) | |
Construct with external key material. More... | |
~RLPXFrameCoder () | |
void | setup (bool _originated, h512 const &_remoteEphemeral, h256 const &_remoteNonce, crypto::ECDHE const &_ephemeral, h256 const &_nonce, bytesConstRef _ackCipher, bytesConstRef _authCipher) |
Establish shared secrets and setup AES and MAC states. More... | |
void | writeFrame (uint16_t _protocolType, bytesConstRef _payload, bytes &o_bytes) |
Write single-frame payload of packet(s). More... | |
void | writeFrame (uint16_t _protocolType, uint16_t _seqId, bytesConstRef _payload, bytes &o_bytes) |
Write continuation frame of segmented payload. More... | |
void | writeFrame (uint16_t _protocolType, uint16_t _seqId, uint32_t _totalSize, bytesConstRef _payload, bytes &o_bytes) |
Write first frame of segmented or sequence-tagged payload. More... | |
void | writeSingleFramePacket (bytesConstRef _packet, bytes &o_bytes) |
Legacy. Encrypt _packet as ill-defined legacy RLPx frame. More... | |
bool | authAndDecryptHeader (bytesRef io_cipherWithMac) |
Authenticate and decrypt header in-place. More... | |
bool | authAndDecryptFrame (bytesRef io_cipherWithMac) |
Authenticate and decrypt frame in-place. More... | |
h128 | egressDigest () |
Return first 16 bytes of current digest from egress mac. More... | |
h128 | ingressDigest () |
Return first 16 bytes of current digest from ingress mac. More... | |
Protected Member Functions | |
void | writeFrame (RLPStream const &_header, bytesConstRef _payload, bytes &o_bytes) |
void | updateEgressMACWithHeader (bytesConstRef _headerCipher) |
Update state of egress MAC with frame header. More... | |
void | updateEgressMACWithFrame (bytesConstRef _cipher) |
Update state of egress MAC with frame. More... | |
void | updateIngressMACWithHeader (bytesConstRef _headerCipher) |
Update state of ingress MAC with frame header. More... | |
void | updateIngressMACWithFrame (bytesConstRef _cipher) |
Update state of ingress MAC with frame. More... | |
Private Attributes | |
std::unique_ptr< class RLPXFrameCoderImpl > | m_impl |
Friends | |
class | RLPXFrameIOMux |
class | Session |
Encoder/decoder transport for RLPx connection established by RLPXHandshake.
rename to RLPXTranscoder
Remove 'Frame' nomenclature and expect caller to provide RLPXFrame
Remove handshake as friend, remove handshake-based constructor
Thread Safety Distinct Objects: Unsafe. Shared objects: Unsafe.
Definition at line 73 of file RLPXFrameCoder.h.
RLPXFrameCoder::RLPXFrameCoder | ( | RLPXHandshake const & | _init | ) |
Construct; requires instance of RLPXHandshake which has encrypted ECDH key exchange (first two phases of handshake).
Definition at line 80 of file RLPXFrameCoder.cpp.
RLPXFrameCoder::RLPXFrameCoder | ( | bool | _originated, |
h512 const & | _remoteEphemeral, | ||
h256 const & | _remoteNonce, | ||
crypto::ECDHE const & | _ephemeral, | ||
h256 const & | _nonce, | ||
bytesConstRef | _ackCipher, | ||
bytesConstRef | _authCipher | ||
) |
Construct with external key material.
Definition at line 86 of file RLPXFrameCoder.cpp.
RLPXFrameCoder::~RLPXFrameCoder | ( | ) |
Definition at line 77 of file RLPXFrameCoder.cpp.
bool RLPXFrameCoder::authAndDecryptFrame | ( | bytesRef | io_cipherWithMac | ) |
Authenticate and decrypt frame in-place.
Definition at line 220 of file RLPXFrameCoder.cpp.
bool RLPXFrameCoder::authAndDecryptHeader | ( | bytesRef | io_cipherWithMac | ) |
Authenticate and decrypt header in-place.
Definition at line 208 of file RLPXFrameCoder.cpp.
h128 RLPXFrameCoder::egressDigest | ( | ) |
Return first 16 bytes of current digest from egress mac.
Definition at line 231 of file RLPXFrameCoder.cpp.
h128 RLPXFrameCoder::ingressDigest | ( | ) |
Return first 16 bytes of current digest from ingress mac.
Definition at line 239 of file RLPXFrameCoder.cpp.
void RLPXFrameCoder::setup | ( | bool | _originated, |
h512 const & | _remoteEphemeral, | ||
h256 const & | _remoteNonce, | ||
crypto::ECDHE const & | _ephemeral, | ||
h256 const & | _nonce, | ||
bytesConstRef | _ackCipher, | ||
bytesConstRef | _authCipher | ||
) |
Establish shared secrets and setup AES and MAC states.
Definition at line 92 of file RLPXFrameCoder.cpp.
|
protected |
Update state of egress MAC with frame.
Definition at line 252 of file RLPXFrameCoder.cpp.
|
protected |
Update state of egress MAC with frame header.
Definition at line 247 of file RLPXFrameCoder.cpp.
|
protected |
Update state of ingress MAC with frame.
Definition at line 263 of file RLPXFrameCoder.cpp.
|
protected |
Update state of ingress MAC with frame header.
Definition at line 258 of file RLPXFrameCoder.cpp.
void RLPXFrameCoder::writeFrame | ( | uint16_t | _protocolType, |
bytesConstRef | _payload, | ||
bytes & | o_bytes | ||
) |
Write single-frame payload of packet(s).
Definition at line 149 of file RLPXFrameCoder.cpp.
void RLPXFrameCoder::writeFrame | ( | uint16_t | _protocolType, |
uint16_t | _seqId, | ||
bytesConstRef | _payload, | ||
bytes & | o_bytes | ||
) |
Write continuation frame of segmented payload.
Definition at line 158 of file RLPXFrameCoder.cpp.
void RLPXFrameCoder::writeFrame | ( | uint16_t | _protocolType, |
uint16_t | _seqId, | ||
uint32_t | _totalSize, | ||
bytesConstRef | _payload, | ||
bytes & | o_bytes | ||
) |
Write first frame of segmented or sequence-tagged payload.
Definition at line 167 of file RLPXFrameCoder.cpp.
|
protected |
void RLPXFrameCoder::writeSingleFramePacket | ( | bytesConstRef | _packet, |
bytes & | o_bytes | ||
) |
Legacy. Encrypt _packet as ill-defined legacy RLPx frame.
Definition at line 199 of file RLPXFrameCoder.cpp.
|
friend |
Definition at line 75 of file RLPXFrameCoder.h.
|
friend |
Definition at line 76 of file RLPXFrameCoder.h.
|
private |
Definition at line 129 of file RLPXFrameCoder.h.