LibreOffice Module filter (master) 1
|
#include <mscodec.hxx>
Public Member Functions | |
MSCodec97 (size_t nHashLen, OUString aEncKeyName) | |
virtual | ~MSCodec97 () |
bool | InitCodec (const css::uno::Sequence< css::beans::NamedValue > &aData) |
Initializes the algorithm with the encryption data. More... | |
virtual css::uno::Sequence< css::beans::NamedValue > | GetEncryptionData () |
Retrieves the encryption data. More... | |
virtual void | InitKey (const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16])=0 |
Initializes the algorithm with the specified password and document ID. More... | |
bool | VerifyKey (const sal_uInt8 *pSaltData, const sal_uInt8 *pSaltDigest) |
Verifies the validity of the password using the passed salt data. More... | |
virtual void | GetDigestFromSalt (const sal_uInt8 *pSaltData, sal_uInt8 *pDigest)=0 |
virtual bool | InitCipher (sal_uInt32 nCounter)=0 |
Rekeys the codec using the specified counter. More... | |
bool | Encode (const void *pData, std::size_t nDatLen, sal_uInt8 *pBuffer, std::size_t nBufLen) |
Encodes a block of memory. More... | |
bool | Decode (const void *pData, std::size_t nDatLen, sal_uInt8 *pBuffer, std::size_t nBufLen) |
Decodes a block of memory. More... | |
bool | Skip (std::size_t nDatLen) |
Lets the cipher skip a specific amount of bytes. More... | |
void | GetDocId (sal_uInt8 pDocId[16]) |
Protected Attributes | |
OUString | m_sEncKeyName |
size_t | m_nHashLen |
rtlCipher | m_hCipher |
std::vector< sal_uInt8 > | m_aDocId |
std::vector< sal_uInt8 > | m_aDigestValue |
Private Member Functions | |
MSCodec97 (const MSCodec97 &)=delete | |
MSCodec97 & | operator= (const MSCodec97 &)=delete |
Definition at line 179 of file mscodec.hxx.
msfilter::MSCodec97::MSCodec97 | ( | size_t | nHashLen, |
OUString | aEncKeyName | ||
) |
Definition at line 250 of file mscodec.cxx.
References m_hCipher.
|
virtual |
Definition at line 272 of file mscodec.cxx.
References m_aDigestValue, m_aDocId, and m_hCipher.
|
privatedelete |
bool msfilter::MSCodec97::Decode | ( | const void * | pData, |
std::size_t | nDatLen, | ||
sal_uInt8 * | pBuffer, | ||
std::size_t | nBufLen | ||
) |
Decodes a block of memory.
@precond The codec must be initialized with InitKey() before this function can be used. The destination buffer must be able to take all encoded data from the source buffer (usually this means it must be as long as or longer than the source buffer).
pData | Encrypted source data block. |
nDatLen | Size of the passed source data block. |
pBuffer | Destination buffer for the decrypted data. |
nBufLen | Size of the destination buffer. |
Definition at line 525 of file mscodec.cxx.
References m_hCipher, pData, and result.
Referenced by Skip().
bool msfilter::MSCodec97::Encode | ( | const void * | pData, |
std::size_t | nDatLen, | ||
sal_uInt8 * | pBuffer, | ||
std::size_t | nBufLen | ||
) |
Encodes a block of memory.
@precond The codec must be initialized with InitKey() before this function can be used. The destination buffer must be able to take all unencoded data from the source buffer (usually this means it must be as long as or longer than the source buffer).
pData | Unencrypted source data block. |
nDatLen | Size of the passed source data block. |
pBuffer | Destination buffer for the encrypted data. |
nBufLen | Size of the destination buffer. |
Definition at line 515 of file mscodec.cxx.
|
pure virtual |
Implemented in msfilter::MSCodec_Std97, and msfilter::MSCodec_CryptoAPI.
Referenced by VerifyKey().
void msfilter::MSCodec97::GetDocId | ( | sal_uInt8 | pDocId[16] | ) |
Definition at line 610 of file mscodec.cxx.
References m_aDocId.
|
virtual |
Retrieves the encryption data.
Reimplemented in msfilter::MSCodec_CryptoAPI.
Definition at line 330 of file mscodec.cxx.
References comphelper::SequenceAsHashMap::getAsConstNamedValueList(), m_aDigestValue, m_aDocId, m_nHashLen, and m_sEncKeyName.
Referenced by msfilter::MSCodec_CryptoAPI::GetEncryptionData().
|
pure virtual |
Rekeys the codec using the specified counter.
After reading a specific amount of data the cipher algorithm needs to be rekeyed using a counter that counts the data blocks.
The block size is for example 512 Bytes for Word files and 1024 Bytes for Excel files.
@precond The codec must be initialized with InitKey() before this function can be used.
nCounter | Block counter used to rekey the cipher. |
Implemented in msfilter::MSCodec_Std97, and msfilter::MSCodec_CryptoAPI.
Referenced by VerifyKey().
bool msfilter::MSCodec97::InitCodec | ( | const css::uno::Sequence< css::beans::NamedValue > & | aData | ) |
Initializes the algorithm with the encryption data.
aData | The sequence contains the necessary data to initialize the codec. |
Definition at line 298 of file mscodec.cxx.
References aData, comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), msfilter::lcl_PrintDigest(), m_aDigestValue, m_aDocId, m_nHashLen, and m_sEncKeyName.
|
pure virtual |
Initializes the algorithm with the specified password and document ID.
pPassData | Wide character array containing the password. Must be zero terminated, which results in a maximum length of 15 characters. |
pDocId | Unique document identifier read from or written to the file. |
Implemented in msfilter::MSCodec_Std97, and msfilter::MSCodec_CryptoAPI.
bool msfilter::MSCodec97::Skip | ( | std::size_t | nDatLen | ) |
Lets the cipher skip a specific amount of bytes.
This function sets the cipher to the same state as if the specified amount of data has been decoded with one or more calls of Decode().
@precond The codec must be initialized with InitKey() before this function can be used.
nDatLen | Number of bytes to be skipped (cipher "seeks" forward). |
Definition at line 535 of file mscodec.cxx.
References Decode().
Verifies the validity of the password using the passed salt data.
@precond The codec must be initialized with InitKey() before this function can be used.
pSaltData | Salt data block read from the file. |
pSaltDigest | Salt digest read from the file. |
Definition at line 395 of file mscodec.cxx.
References aBuffer, GetDigestFromSalt(), InitCipher(), msfilter::lcl_PrintDigest(), m_hCipher, m_nHashLen, and result.
|
protected |
Definition at line 325 of file mscodec.hxx.
Referenced by GetEncryptionData(), msfilter::MSCodec_Std97::InitCipher(), msfilter::MSCodec_CryptoAPI::InitCipher(), InitCodec(), msfilter::MSCodec_Std97::InitKey(), msfilter::MSCodec_CryptoAPI::InitKey(), and ~MSCodec97().
|
protected |
Definition at line 324 of file mscodec.hxx.
Referenced by GetDocId(), GetEncryptionData(), InitCodec(), msfilter::MSCodec_Std97::InitKey(), msfilter::MSCodec_CryptoAPI::InitKey(), and ~MSCodec97().
|
protected |
Definition at line 323 of file mscodec.hxx.
Referenced by msfilter::MSCodec_Std97::CreateSaltDigest(), Decode(), Encode(), msfilter::MSCodec_Std97::GetDigestFromSalt(), msfilter::MSCodec_CryptoAPI::GetDigestFromSalt(), msfilter::MSCodec_Std97::GetEncryptKey(), msfilter::MSCodec_Std97::InitCipher(), msfilter::MSCodec_CryptoAPI::InitCipher(), MSCodec97(), VerifyKey(), and ~MSCodec97().
|
protected |
Definition at line 322 of file mscodec.hxx.
Referenced by GetEncryptionData(), InitCodec(), and VerifyKey().
|
protected |
Definition at line 321 of file mscodec.hxx.
Referenced by GetEncryptionData(), and InitCodec().