Public Types | Public Member Functions | Protected Attributes

SDWCryptor Class Reference

Decryptor for .sdw files. More...

#include <sdw_cryptor.h>

List of all members.

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]

Detailed Description

Decryptor for .sdw files.


Member Enumeration Documentation

anonymous enum

Maximum length of the password.

Enumerator:
maxPWLen 

Constructor & Destructor Documentation

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

Parameters:
aDate The date given in the file header
aTime Time from file header.

References maxPWLen, and mFilePass.

SDWCryptor::~SDWCryptor (  ) 

Member Function Documentation

void SDWCryptor::Decrypt ( const char *  aEncrypted,
char *  aBuffer,
UT_uint32  aLen = 0 
) const

Decrypts a given string.

Parameters:
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().

void SDWCryptor::SetDateTime ( UT_uint32  aDate,
UT_uint32  aTime 
) [inline]

Sets date and time for verifying the password.

References mDate, and mTime.

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.

Parameters:
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.
Returns:
true on success (also if aFilePass is NULL), false on failure (e.g. invalid password)

References UT_String::c_str(), Encrypt(), gEncode, maxPWLen, mDate, mFilePass, mPassword, mTime, and UT_String_sprintf().

Referenced by IE_Imp_StarOffice::_loadFile().


Member Data Documentation

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().

Referenced by SetDateTime(), and SetPassword().


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