the main class to read/. More...
#include <StarEncryption.hxx>
Public Member Functions | |
StarEncryption () | |
constructor | |
StarEncryption (std::string const &password) | |
constructor knowing the original password | |
virtual | ~StarEncryption () |
destructor | |
bool | decode (std::vector< uint8_t > &data) const |
decodes a string | |
bool | checkPassword (uint32_t date, uint32_t time, std::vector< uint8_t > const &cryptDateTime) const |
checks that the password is correct | |
bool | guessPassword (uint32_t date, uint32_t time, std::vector< uint8_t > const &cryptDateTime) |
tries to guess the password, assuming that the user's password has at most 15 characters. | |
Static Public Member Functions | |
static STOFFInputStreamPtr | decodeStream (STOFFInputStreamPtr input, uint8_t mask) |
decode a zone given a mask | |
static uint8_t | getMaskToDecodeStream (uint8_t src, uint8_t dest) |
retrieves a mask needed to decode a stream knowing a src and dest bytes | |
Static Protected Member Functions | |
static bool | decode (std::vector< uint8_t > &data, std::vector< uint8_t > const &cryptPasswd) |
decodes a string | |
static bool | findEncryptedPassword (std::vector< uint8_t > const &src, std::vector< uint8_t > const &dest, uint8_t c0c1, std::vector< uint8_t > &crypter) |
try to find the crypter knowing the original data(16 bytes), the final data(16 bytes) and the value of c0+c1 | |
Protected Attributes | |
std::vector< uint8_t > | m_password |
the crypted password | |
the main class to read/.
. some basic encryption in StarOffice documents
StarEncryption::StarEncryption | ( | ) |
constructor
|
explicit |
constructor knowing the original password
|
virtual |
destructor
bool StarEncryption::checkPassword | ( | uint32_t | date, |
uint32_t | time, | ||
std::vector< uint8_t > const & | cryptDateTime | ||
) | const |
checks that the password is correct
|
inline |
decodes a string
Referenced by checkPassword(), decode(), guessPassword(), and StarEncryption().
|
staticprotected |
decodes a string
|
static |
decode a zone given a mask
Referenced by StarObjectSpreadsheet::readCalcDocument(), and StarObjectDraw::readDrawDocument().
|
staticprotected |
try to find the crypter knowing the original data(16 bytes), the final data(16 bytes) and the value of c0+c1
Referenced by guessPassword().
|
static |
retrieves a mask needed to decode a stream knowing a src and dest bytes
Moreover as this method is used to crypt a StarCalcDocument stream, and we know that a valid StarCalcDocument stream must begin by XX42, we can easily retrieve the password mask and use it to uncrypt this stream...
Referenced by StarObjectSpreadsheet::readCalcDocument(), and StarObjectDraw::readDrawDocument().
bool StarEncryption::guessPassword | ( | uint32_t | date, |
uint32_t | time, | ||
std::vector< uint8_t > const & | cryptDateTime | ||
) |
tries to guess the password, assuming that the user's password has at most 15 characters.
As the StarOffice's algorithm adds trailing spaces if the password does not contain 16 characters, this may give almost alway good result if the user has not chosen a password with 16 characters.
If we success, we store the encrypted password to be used for further encryption.
|
protected |
the crypted password
Referenced by decode(), guessPassword(), and StarEncryption().