Decryptor for .sdw files. More...
#include <sdw_cryptor.h>
Public Types | |
| enum | { maxPWLen = 16 } |
Maximum length of the password. More... | |
Public Member Functions | |
| SDWCryptor (UT_uint32 aDate=0, UT_uint32 aTime=0, const UT_uint8 *aFilePass=NULL) | |
| Intializes the cryptor. | |
| ~SDWCryptor () | |
| void | SetDateTime (UT_uint32 aDate, UT_uint32 aTime) |
| Sets date and time for verifying the password. | |
| bool | SetPassword (const char *aPassword) |
| Sets the password that will be used for decrypting. | |
| void | Decrypt (const char *aEncrypted, char *aBuffer, UT_uint32 aLen=0) const |
| Decrypts a given string. | |
| void | Encrypt (const char *aDecrypted, char *aBuffer, UT_uint32 aLen=0) const |
| Encrypts a string. | |
Protected Attributes | |
| UT_uint32 | mDate |
| UT_uint32 | mTime |
| char | mPassword [maxPWLen] |
| UT_uint8 | mFilePass [maxPWLen] |
Decryptor for .sdw files.
| SDWCryptor::SDWCryptor | ( | UT_uint32 | aDate = 0, |
|
| UT_uint32 | aTime = 0, |
|||
| const UT_uint8 * | aFilePass = NULL | |||
| ) |
Intializes the cryptor.
The arguments are used to verify that the password is correct. A date and time of zero tells the cryptor to not use these values. If you give aDate and aTime, you really should also give aFilePass - results might not be what you expect otherwise
| aDate | The date given in the file header | |
| aTime | Time from file header. |
| SDWCryptor::~SDWCryptor | ( | ) |
| void SDWCryptor::Decrypt | ( | const char * | aEncrypted, | |
| char * | aBuffer, | |||
| UT_uint32 | aLen = 0 | |||
| ) | const |
Decrypts a given string.
| aEncrypted | The string to decrypt | |
| aBuffer | Decrypted string will be put here. Needs to be at least strlen(aEncrypted) bytes large. Can be the same as aEncrypted. | |
| aLen | Length of the string to be encrypted, if 0 or not given strlen(aEncrypted) is used. |
References maxPWLen, and mPassword.
Referenced by Encrypt().
| void SDWCryptor::Encrypt | ( | const char * | aDecrypted, | |
| char * | aBuffer, | |||
| UT_uint32 | aLen = 0 | |||
| ) | const [inline] |
Encrypts a string.
Works the same as SDWCryptor::Decrypt
References Decrypt().
Referenced by SetPassword().
| bool SDWCryptor::SetPassword | ( | const char * | aPassword | ) |
Sets the password that will be used for decrypting.
Even if the password is invalid, the current password will be modified.
| aPassword | The password to use | |
| aFilePass | The password given in the file header to check if the given password is correct or NULL if no check should be performed. |
References UT_String::c_str(), Encrypt(), gEncode, maxPWLen, mDate, mFilePass, mPassword, mTime, and UT_String_sprintf().
Referenced by IE_Imp_StarOffice::_loadFile().
UT_uint32 SDWCryptor::mDate [protected] |
Referenced by SetDateTime(), and SetPassword().
UT_uint8 SDWCryptor::mFilePass[maxPWLen] [protected] |
Referenced by SDWCryptor(), and SetPassword().
char SDWCryptor::mPassword[maxPWLen] [protected] |
Referenced by Decrypt(), and SetPassword().
UT_uint32 SDWCryptor::mTime [protected] |
Referenced by SetDateTime(), and SetPassword().
1.7.1