Class CryptoTransform

Class Documentation

class CryptoTransform

Public Functions

inline virtual ~CryptoTransform()
virtual bool encode_serialized_payload(SerializedPayload_t &encoded_payload, std::vector<uint8_t> &extra_inline_qos, const SerializedPayload_t &payload, DatawriterCryptoHandle &sending_datawriter_crypto, SecurityException &exception) = 0

Serializes the payload sent by the user with a Datawriter.

Parameters:
  • encoded_payload – (out) Result of the encryption

  • extra_inline_qos – (out) Contains additional parameters to be added to the inlineQos of the submessage

  • payload – Plain input buffer

  • sending_datawriter_crypto – Returned by a prior call to register_local_datawriter

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual bool encode_datawriter_submessage(CDRMessage_t &encoded_rtps_submessage, const CDRMessage_t &plain_rtps_submessage, DatawriterCryptoHandle &sending_datawriter_crypto, std::vector<std::shared_ptr<DatareaderCryptoHandle>> &receiving_datareader_crypto_list, SecurityException &exception) = 0

Encodes a Data, DataFrag, Gap, Heartbeat or HeartBeatFrag

Parameters:
  • encoded_rtps_submessage – (out) Result of the encryption

  • plain_rtps_submessage – Plain input buffer

  • sending_datawriter_crypto – Crypto of the datawriter that sends the message

  • receiving_datareader_crypto_list – Crypto of the datareaders the message is aimed at

  • exception – (out) Security exception

Returns:

TRUE is successful

virtual bool encode_datareader_submessage(CDRMessage_t &encoded_rtps_submessage, const CDRMessage_t &plain_rtps_submessage, DatareaderCryptoHandle &sending_datareader_crypto, std::vector<std::shared_ptr<DatawriterCryptoHandle>> &receiving_datawriter_crypto_list, SecurityException &exception) = 0

Encodes an AckNack or NackFrag

Parameters:
  • encoded_rtps_submessage – (out) Result of the encryption

  • plain_rtps_submessage – Plain input buffer

  • sending_datareader_crypto – Crypto of the sending datareader

  • receiving_datawriter_crypto_list – List with Crypto of the intended datawriter recipients

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual bool encode_rtps_message(CDRMessage_t &encoded_rtps_message, const CDRMessage_t &plain_rtps_message, ParticipantCryptoHandle &sending_crypto, std::vector<std::shared_ptr<ParticipantCryptoHandle>> &receiving_crypto_list, SecurityException &exception) = 0

Encodes a full rtps message

Parameters:
  • encoded_rtps_message – (out) Result of the encryption

  • plain_rtps_message – Plain input buffer

  • sending_crypto – Crypto of the Participant where the message originates from

  • receiving_crypto_list – Crypto of the Partipants the message is intended towards

  • exception – (out) Security expcetion

Returns:

TRUE if successful

virtual bool decode_rtps_message(CDRMessage_t &plain_buffer, const CDRMessage_t &encoded_buffer, const ParticipantCryptoHandle &receiving_crypto, const ParticipantCryptoHandle &sending_crypto, SecurityException &exception) = 0

Reverses the transformation performed by encode_rtps_message. Decrypts the contents and veryfies MACs or digital signatures.

Parameters:
  • plain_buffer – (out) Decoded message

  • encoded_buffer – Encoded message

  • receiving_crypto – Crypto of the Participant that receives the message

  • sending_crypto – Crypto of the Participant that wrote the message

  • exception – (out) Security exception

Returns:

TRUE is successful

virtual bool preprocess_secure_submsg(DatawriterCryptoHandle **datawriter_crypto, DatareaderCryptoHandle **datareader_crypto, SecureSubmessageCategory_t &secure_submessage_category, const CDRMessage_t &encoded_rtps_submessage, ParticipantCryptoHandle &receiving_crypto, ParticipantCryptoHandle &sending_crypto, SecurityException &exception) = 0

Determines whether the secure submessage comes from a datawriter or a data reader and extracts the required CryptoHandle to decode it.

Parameters:
  • datawriter_crypto – (out) Crypto of the sending datawriter, if applicable

  • datareader_crypto – (out) Crypto of the sending datareader, if applicable

  • secure_submessage_category – (out) Specifies whether the message comes from a datawriter or from a datareader

  • encoded_rtps_submessage – encoded input submessage

  • receiving_crypto – Crypto of the Participant that receives the message

  • sending_crypto – Crypto of the Participant that sent the message

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual bool decode_datawriter_submessage(CDRMessage_t &plain_rtps_submessage, CDRMessage_t &encoded_rtps_submessage, DatareaderCryptoHandle &receiving_datareader_crypto, DatawriterCryptoHandle &sending_datawriter_crypto, SecurityException &exception) = 0

Called after prprocess_secure_submessage when the submessage category is DATAWRITER_SUBMESSAGE

Parameters:
  • plain_rtps_submessage – (out) Result of the decryption

  • encoded_rtps_submessage – Encoded message

  • receiving_datareader_crypto – Crypto of the target datareader

  • sending_datawriter_crypto – Crypto of the datawriter that sent the message

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual bool decode_datareader_submessage(CDRMessage_t &plain_rtps_submessage, CDRMessage_t &encoded_rtps_submessage, DatawriterCryptoHandle &receiving_datawriter_crypto, DatareaderCryptoHandle &sending_datareader_crypto, SecurityException &exception) = 0

Called after preprocess_secure_submessage when the submessage category is DATAREADER_SUBMESSAGE

Parameters:
  • plain_rtps_submessage – (out) Result of the decryption

  • encoded_rtps_submessage – Encoded message

  • receiving_datawriter_crypto – Crypto of the target datawriter

  • sending_datareader_crypto – Crypto of the datareader that sent the message

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual bool decode_serialized_payload(SerializedPayload_t &plain_payload, const SerializedPayload_t &encoded_payload, const std::vector<uint8_t> &inline_qos, DatareaderCryptoHandle &receiving_datareader_crypto, DatawriterCryptoHandle &sending_datawriter_crypto, SecurityException &exception) = 0

Undoes the decryption transformation made on the writer side.

Parameters:
  • plain_payload – (out) Result of the decryption

  • encoded_payload – Encoded input buffer

  • inline_qos – Coming from the data message that carries the target payload

  • receiving_datareader_crypto – Crypto of the target datareader

  • sending_datawriter_crypto – Crypto of the datawriter that sent the message

  • exception – (out) Security exception

Returns:

TRUE if successful

virtual uint32_t calculate_extra_size_for_rtps_message(uint32_t number_discovered_participants) const = 0
virtual uint32_t calculate_extra_size_for_rtps_submessage(uint32_t number_discovered_readers) const = 0
virtual uint32_t calculate_extra_size_for_encoded_payload(uint32_t number_discovered_readers) const = 0