retdec
Private Types | Private Attributes | List of all members
retdec::fileformat::RichHeader Class Reference

#include <rich_header.h>

Collaboration diagram for retdec::fileformat::RichHeader:
Collaboration graph
[legend]

Public Member Functions

Getters
std::string getSignature () const
 
std::size_t getSignatureLength () const
 
bool getOffset (unsigned long long &richOffset) const
 
bool getKey (unsigned long long &richKey) const
 
std::size_t getNumberOfRecords () const
 
const LinkerInfogetRecord (std::size_t recordIndex) const
 
const LinkerInfogetLastRecord () const
 
bool getValidStructure () const
 
bool getSuspicious () const
 
const std::vector< std::uint8_t > & getBytes () const
 
Setters
void setSignature (std::string richSignature)
 
void setOffset (unsigned long long richOffset)
 
void setKey (unsigned long long richKey)
 
void setValidStructure (bool richValidStructure)
 
void setSuspicious (bool richSuspicious)
 
void setBytes (const std::vector< std::uint8_t > &richHeaderBytes)
 
Iterators
richHeaderIterator begin () const
 
richHeaderIterator end () const
 
Other methods
void clear ()
 
void invalidateOffset ()
 
void invalidateKey ()
 
void addRecord (LinkerInfo &record)
 
bool hasRecords () const
 
void dump (std::string &dumpHeader) const
 

Private Types

using richHeaderIterator = std::vector< LinkerInfo >::const_iterator
 

Private Attributes

std::string signature
 header in string representation More...
 
unsigned long long offset = 0
 offset of rich header in file More...
 
unsigned long long key = 0
 key for decryption More...
 
std::vector< LinkerInfoheader
 all records in header More...
 
bool isOffsetValid = false
 true if offset is valid More...
 
bool isKeyValid = false
 true if key is valid More...
 
bool isValidStructure = false
 true if header has valid structure More...
 
bool isSuspicious = false
 true if content of header is suspicious More...
 
std::vector< std::uint8_t > bytes
 decrypted content of rich header More...
 

Detailed Description

Rich header

Member Typedef Documentation

◆ richHeaderIterator

using retdec::fileformat::RichHeader::richHeaderIterator = std::vector<LinkerInfo>::const_iterator
private

Member Function Documentation

◆ addRecord()

void retdec::fileformat::RichHeader::addRecord ( LinkerInfo record)

Add new record

Parameters
recordRecord which will be added

◆ begin()

RichHeader::richHeaderIterator retdec::fileformat::RichHeader::begin ( ) const

Get begin of records

Returns
Begin of rich header records

◆ clear()

void retdec::fileformat::RichHeader::clear ( )

Reset rich header and delete all records from it

◆ dump()

void retdec::fileformat::RichHeader::dump ( std::string &  dumpHeader) const

Dump information about rich header

Parameters
dumpHeaderInto this parameter is stored dump of rich header in an LLVM style

◆ end()

RichHeader::richHeaderIterator retdec::fileformat::RichHeader::end ( ) const

Get end of records

Returns
End of rich header records

◆ getBytes()

const std::vector< std::uint8_t > & retdec::fileformat::RichHeader::getBytes ( ) const

Returns the decrypted bytes of the rich header.

Returns
Decrypted bytes of rich header.

◆ getKey()

bool retdec::fileformat::RichHeader::getKey ( unsigned long long &  richKey) const

Get key for decryption of header

Parameters
richKeyInto this parameter is stored key of rich header
Returns
true if key of rich header is detected, false otherwise

If method returns false, richKey is left unchanged

◆ getLastRecord()

const LinkerInfo * retdec::fileformat::RichHeader::getLastRecord ( ) const

Get last record from header

Returns
Pointer to the last record from rich header

◆ getNumberOfRecords()

std::size_t retdec::fileformat::RichHeader::getNumberOfRecords ( ) const

Get number of records in header

Returns
Number of records in header

◆ getOffset()

bool retdec::fileformat::RichHeader::getOffset ( unsigned long long &  richOffset) const

Get offset of header in file

Parameters
richOffsetInto this parameter is stored offset of rich header
Returns
true if offset of rich header is detected, false otherwise

If method returns false, richOffset is left unchanged

◆ getRecord()

const LinkerInfo * retdec::fileformat::RichHeader::getRecord ( std::size_t  recordIndex) const

Get record from header

Parameters
recordIndexIndex of record in header (indexed from 0)
Returns
Pointer to selected record or nullptr if index of record is incorrect

◆ getSignature()

std::string retdec::fileformat::RichHeader::getSignature ( ) const

Get decrypted header as string

Returns
Decrypted header as string

◆ getSignatureLength()

std::size_t retdec::fileformat::RichHeader::getSignatureLength ( ) const

Get length of signature

Returns
Length of signature

◆ getSuspicious()

bool retdec::fileformat::RichHeader::getSuspicious ( ) const

Check if content of rich header is suspicious

Returns
true if content of rich header is suspicious, false otherwise

◆ getValidStructure()

bool retdec::fileformat::RichHeader::getValidStructure ( ) const

Check if header has valid structure

Returns
true if header has valid structure, false otherwise

◆ hasRecords()

bool retdec::fileformat::RichHeader::hasRecords ( ) const

Find out if there are any records

Returns
true if there are some records, false otherwise

◆ invalidateKey()

void retdec::fileformat::RichHeader::invalidateKey ( )

Invalidate key of rich header

Instance method getKey() returns false after invocation of this method. Key is possible to revalidate by invocation of method setKey().

◆ invalidateOffset()

void retdec::fileformat::RichHeader::invalidateOffset ( )

Invalidate offset of rich header

Instance method getOffset() returns false after invocation of this method. Offset is possible to revalidate by invocation of method setOffset().

◆ setBytes()

void retdec::fileformat::RichHeader::setBytes ( const std::vector< std::uint8_t > &  richHeaderBytes)

Sets the decrypted bytes of the rich header.

Parameters
richHeaderBytesRich header bytes of the signature.

◆ setKey()

void retdec::fileformat::RichHeader::setKey ( unsigned long long  richKey)

Set key for decryption of header

Parameters
richKeyKey for decryption of header

◆ setOffset()

void retdec::fileformat::RichHeader::setOffset ( unsigned long long  richOffset)

Set offset of header in file

Parameters
richOffsetOffset of rich header in file

◆ setSignature()

void retdec::fileformat::RichHeader::setSignature ( std::string  richSignature)

Set signature

Parameters
richSignatureDecrypted header

◆ setSuspicious()

void retdec::fileformat::RichHeader::setSuspicious ( bool  richSuspicious)

Set if content of rich header is suspicious

Parameters
richSuspicioustrue if content of rich header is suspicious, false otherwise

◆ setValidStructure()

void retdec::fileformat::RichHeader::setValidStructure ( bool  richValidStructure)

Set if rich header has valid structure

Parameters
richValidStructuretrue if rich header has valid structure, false otherwise

Member Data Documentation

◆ bytes

std::vector<std::uint8_t> retdec::fileformat::RichHeader::bytes
private

decrypted content of rich header

◆ header

std::vector<LinkerInfo> retdec::fileformat::RichHeader::header
private

all records in header

◆ isKeyValid

bool retdec::fileformat::RichHeader::isKeyValid = false
private

true if key is valid

◆ isOffsetValid

bool retdec::fileformat::RichHeader::isOffsetValid = false
private

true if offset is valid

◆ isSuspicious

bool retdec::fileformat::RichHeader::isSuspicious = false
private

true if content of header is suspicious

◆ isValidStructure

bool retdec::fileformat::RichHeader::isValidStructure = false
private

true if header has valid structure

◆ key

unsigned long long retdec::fileformat::RichHeader::key = 0
private

key for decryption

◆ offset

unsigned long long retdec::fileformat::RichHeader::offset = 0
private

offset of rich header in file

◆ signature

std::string retdec::fileformat::RichHeader::signature
private

header in string representation


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