Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
rosbag::AesCbcEncryptor Class Reference

#include <aes_encryptor.h>

Inheritance diagram for rosbag::AesCbcEncryptor:
Inheritance graph
[legend]

Public Member Functions

void addFieldsToFileHeader (ros::M_string &header_fields) const
 Add encryptor information to bag file header. More...
 
 AesCbcEncryptor ()
 
void decryptChunk (ChunkHeader const &chunk_header, Buffer &decrypted_chunk, ChunkedFile &file) const
 Decrypt chunk. More...
 
uint32_t encryptChunk (const uint32_t chunk_size, const uint64_t chunk_data_pos, ChunkedFile &file)
 Encrypt chunk. More...
 
void initialize (Bag const &bag, std::string const &gpg_key_user)
 Initialize encryptor. More...
 
bool readEncryptedHeader (boost::function< bool(ros::Header &)>, ros::Header &header, Buffer &header_buffer, ChunkedFile &)
 Read encrypted header from bag file. More...
 
void readFieldsFromFileHeader (ros::M_string const &header_fields)
 Read encryptor information from bag file header. More...
 
void writeEncryptedHeader (boost::function< void(ros::M_string const &)>, ros::M_string const &header_fields, ChunkedFile &)
 Write encrypted header to bag file. More...
 
 ~AesCbcEncryptor ()
 
- Public Member Functions inherited from rosbag::EncryptorBase
virtual ~EncryptorBase ()
 

Static Public Attributes

static const std::string ENCRYPTED_KEY_FIELD_NAME = "encrypted_key"
 
static const std::string GPG_USER_FIELD_NAME = "gpg_user"
 

Private Member Functions

void buildSymmetricKey ()
 

Private Attributes

AES_KEY aes_decrypt_key_
 
AES_KEY aes_encrypt_key_
 
std::string encrypted_symmetric_key_
 
std::string gpg_key_user_
 
std::basic_string< unsigned char > symmetric_key_
 

Additional Inherited Members

- Protected Member Functions inherited from rosbag::EncryptorBase
 EncryptorBase ()
 

Detailed Description

Definition at line 77 of file aes_encryptor.h.

Constructor & Destructor Documentation

◆ AesCbcEncryptor()

rosbag::AesCbcEncryptor::AesCbcEncryptor ( )
inline

Definition at line 116 of file aes_encryptor.h.

◆ ~AesCbcEncryptor()

rosbag::AesCbcEncryptor::~AesCbcEncryptor ( )
inline

Definition at line 117 of file aes_encryptor.h.

Member Function Documentation

◆ addFieldsToFileHeader()

void rosbag::AesCbcEncryptor::addFieldsToFileHeader ( ros::M_string header_fields) const
virtual

Add encryptor information to bag file header.

Parameters
header_fieldsThe header fields of the bag

Called for a bag being written, this method adds encryptor-specific fields to the bag file header. Those fields are used when decrypting the bag. ENCRYPTOR_FIELD_NAME must be specified in the header except for NoEncryptor.

Implements rosbag::EncryptorBase.

Definition at line 274 of file aes_encryptor.cpp.

◆ buildSymmetricKey()

void rosbag::AesCbcEncryptor::buildSymmetricKey ( )
private

Definition at line 345 of file aes_encryptor.cpp.

◆ decryptChunk()

void rosbag::AesCbcEncryptor::decryptChunk ( ChunkHeader const &  chunk_header,
Buffer decrypted_chunk,
ChunkedFile file 
) const
virtual

Decrypt chunk.

Parameters
chunk_headerThe header of the encrypted chunk
decrypted_chunkThe buffer where decrypted chunk is written to
fileThe bag file stream from which the encrypted chunk is read

This method reads the encrypted chunk from file stream, decrypts, and writes it to decrypted_chunk.

Implements rosbag::EncryptorBase.

Definition at line 251 of file aes_encryptor.cpp.

◆ encryptChunk()

uint32_t rosbag::AesCbcEncryptor::encryptChunk ( const uint32_t  chunk_size,
const uint64_t  chunk_data_pos,
ChunkedFile file 
)
virtual

Encrypt chunk.

Returns
The byte size of the encrypted chunk
Parameters
chunk_sizeThe byte size of the original chunk
chunk_data_posThe start position of the chunk data in bag file stream
fileThe bag file stream

This method reads the original chunk from [chunk_data_pos, chunk_data_pos+chunk_size), encrypts it, and writes back to the file stream starting at chunk_data_pos.

Implements rosbag::EncryptorBase.

Definition at line 228 of file aes_encryptor.cpp.

◆ initialize()

void rosbag::AesCbcEncryptor::initialize ( Bag const &  bag,
std::string const &  plugin_param 
)
virtual

Initialize encryptor.

Parameters
bagThe Bag instance
plugin_paramThe string parameter used while initializing the encryptor

This method is called by setEncryptorPlugin, which loads an encryptor plugin.

Implements rosbag::EncryptorBase.

Definition at line 207 of file aes_encryptor.cpp.

◆ readEncryptedHeader()

bool rosbag::AesCbcEncryptor::readEncryptedHeader ( boost::function< bool(ros::Header &)>  read_header,
ros::Header header,
Buffer header_buffer,
ChunkedFile file 
)
virtual

Read encrypted header from bag file.

Parameters
read_headerThe functor reading unencrypted header
headerThe header object read
header_bufferThe header buffer read
fileThe bag file stream

This method reads and decrypts encrypted header to output header object (header) and buffer (header_buffer).

Implements rosbag::EncryptorBase.

Definition at line 317 of file aes_encryptor.cpp.

◆ readFieldsFromFileHeader()

void rosbag::AesCbcEncryptor::readFieldsFromFileHeader ( ros::M_string const &  header_fields)
virtual

Read encryptor information from bag file header.

Parameters
header_fieldsThe header fields of the bag

Called for a bag being read, this method reads encryptor-specific fields from the bag file header.

Implements rosbag::EncryptorBase.

Definition at line 280 of file aes_encryptor.cpp.

◆ writeEncryptedHeader()

void rosbag::AesCbcEncryptor::writeEncryptedHeader ( boost::function< void(ros::M_string const &)>  write_header,
ros::M_string const &  header_fields,
ChunkedFile file 
)
virtual

Write encrypted header to bag file.

Parameters
write_headerThe functor writing unencrypted header
header_fieldsThe header fields to be written
fileThe bag file stream

This method encrypts given header fields, and writes them to the bag file.

Implements rosbag::EncryptorBase.

Definition at line 293 of file aes_encryptor.cpp.

Member Data Documentation

◆ aes_decrypt_key_

AES_KEY rosbag::AesCbcEncryptor::aes_decrypt_key_
private

Definition at line 139 of file aes_encryptor.h.

◆ aes_encrypt_key_

AES_KEY rosbag::AesCbcEncryptor::aes_encrypt_key_
private

Definition at line 138 of file aes_encryptor.h.

◆ ENCRYPTED_KEY_FIELD_NAME

const std::string rosbag::AesCbcEncryptor::ENCRYPTED_KEY_FIELD_NAME = "encrypted_key"
static

Definition at line 113 of file aes_encryptor.h.

◆ encrypted_symmetric_key_

std::string rosbag::AesCbcEncryptor::encrypted_symmetric_key_
private

Definition at line 136 of file aes_encryptor.h.

◆ gpg_key_user_

std::string rosbag::AesCbcEncryptor::gpg_key_user_
private

Definition at line 132 of file aes_encryptor.h.

◆ GPG_USER_FIELD_NAME

const std::string rosbag::AesCbcEncryptor::GPG_USER_FIELD_NAME = "gpg_user"
static

Definition at line 112 of file aes_encryptor.h.

◆ symmetric_key_

std::basic_string<unsigned char> rosbag::AesCbcEncryptor::symmetric_key_
private

Definition at line 134 of file aes_encryptor.h.


The documentation for this class was generated from the following files:


rosbag_storage
Author(s): Dirk Thomas , Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:52