#include <mscodec.hxx>
Public Member Functions | |
| MSCodec_Std97 () | |
| ~MSCodec_Std97 () | |
| void | InitKey (const sal_uInt16 pPassData[16], const sal_uInt8 pUnique[16]) |
| Initializes the algorithm with the specified password and document ID. | |
| bool | VerifyKey (const sal_uInt8 pSaltData[16], const sal_uInt8 pSaltDigest[16]) |
| Verifies the validity of the password using the passed salt data. | |
| bool | InitCipher (sal_uInt32 nCounter) |
| Rekeys the codec using the specified counter. | |
| bool | CreateSaltDigest (const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16]) |
| Creates an MD5 digest of salt digest. | |
| bool | Encode (const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) |
| Encodes a block of memory. | |
| bool | Decode (const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) |
| Decodes a block of memory. | |
| bool | Skip (sal_Size nDatLen) |
| Lets the cipher skip a specific amount of bytes. | |
| void | GetEncryptKey (const sal_uInt8 pSalt[16], sal_uInt8 pSaltData[16], sal_uInt8 pSaltDigest[16]) |
| Gets salt data and salt digest. | |
Private Member Functions | |
| void | GetDigestFromSalt (const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16]) |
| SVX_DLLPRIVATE | MSCodec_Std97 (const MSCodec_Std97 &) |
| SVX_DLLPRIVATE MSCodec_Std97 & | operator= (const MSCodec_Std97 &) |
Private Attributes | |
| rtlCipher | m_hCipher |
| rtlDigest | m_hDigest |
| sal_uInt8 | m_pDigestValue [RTL_DIGEST_LENGTH_MD5] |
This is a wrapper class around low level cryptographic functions from RTL. Implementation is based on the wvDecrypt package by Caolan McNamara: http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
Definition at line 182 of file mscodec.hxx.
| svx::MSCodec_Std97::MSCodec_Std97 | ( | ) | [explicit] |
| svx::MSCodec_Std97::~MSCodec_Std97 | ( | ) |
| SVX_DLLPRIVATE svx::MSCodec_Std97::MSCodec_Std97 | ( | const MSCodec_Std97 & | ) | [private] |
| void svx::MSCodec_Std97::InitKey | ( | const sal_uInt16 | pPassData[16], | |
| const sal_uInt8 | pUnique[16] | |||
| ) |
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. | |
| pUnique | Unique document identifier read from or written to the file. |
Definition at line 279 of file mscodec.cxx.
References svx::lcl_PrintDigest(), svx::lcl_PrintKeyData(), m_hDigest, and m_pDigestValue.
| bool svx::MSCodec_Std97::VerifyKey | ( | const sal_uInt8 | pSaltData[16], | |
| const sal_uInt8 | pSaltDigest[16] | |||
| ) |
Verifies the validity of the password using the passed salt data.
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 340 of file mscodec.cxx.
References GetDigestFromSalt(), InitCipher(), svx::lcl_PrintDigest(), and m_hCipher.
| bool svx::MSCodec_Std97::InitCipher | ( | sal_uInt32 | nCounter | ) |
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.
The codec must be initialized with InitKey() before this function can be used.
| nCounter | Block counter used to rekey the cipher. |
Definition at line 374 of file mscodec.cxx.
References m_hCipher, m_hDigest, and m_pDigestValue.
Referenced by CreateSaltDigest(), GetEncryptKey(), and VerifyKey().
| bool svx::MSCodec_Std97::CreateSaltDigest | ( | const sal_uInt8 | nSaltData[16], | |
| sal_uInt8 | nSaltDigest[16] | |||
| ) |
Creates an MD5 digest of salt digest.
Definition at line 411 of file mscodec.cxx.
References GetDigestFromSalt(), InitCipher(), svx::lcl_PrintDigest(), and m_hCipher.
| bool svx::MSCodec_Std97::Encode | ( | const void * | pData, | |
| sal_Size | nDatLen, | |||
| sal_uInt8 * | pBuffer, | |||
| sal_Size | nBufLen | |||
| ) |
Encodes a block of memory.
| 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 432 of file mscodec.cxx.
References m_hCipher.
| bool svx::MSCodec_Std97::Decode | ( | const void * | pData, | |
| sal_Size | nDatLen, | |||
| sal_uInt8 * | pBuffer, | |||
| sal_Size | nBufLen | |||
| ) |
Decodes a block of memory.
| 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 444 of file mscodec.cxx.
References m_hCipher.
Referenced by Skip().
| bool svx::MSCodec_Std97::Skip | ( | sal_Size | 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().
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 456 of file mscodec.cxx.
References Decode().
| void svx::MSCodec_Std97::GetEncryptKey | ( | const sal_uInt8 | pSalt[16], | |
| sal_uInt8 | pSaltData[16], | |||
| sal_uInt8 | pSaltDigest[16] | |||
| ) |
Gets salt data and salt digest.
The codec must be initialized with InitKey() before this function can be used.
| pSalt | Salt, a random number. | |
| pSaltData | Salt data block generated from the salt. | |
| pSaltDigest | Salt digest generated from the salt. |
Definition at line 499 of file mscodec.cxx.
References InitCipher(), m_hCipher, and m_hDigest.
| void svx::MSCodec_Std97::GetDigestFromSalt | ( | const sal_uInt8 | pSaltData[16], | |
| sal_uInt8 | pDigest[16] | |||
| ) | [private] |
Definition at line 472 of file mscodec.cxx.
References m_hCipher, and m_hDigest.
Referenced by CreateSaltDigest(), and VerifyKey().
| SVX_DLLPRIVATE MSCodec_Std97& svx::MSCodec_Std97::operator= | ( | const MSCodec_Std97 & | ) | [private] |
rtlCipher svx::MSCodec_Std97::m_hCipher [private] |
Definition at line 330 of file mscodec.hxx.
Referenced by CreateSaltDigest(), Decode(), Encode(), GetDigestFromSalt(), GetEncryptKey(), InitCipher(), MSCodec_Std97(), VerifyKey(), and ~MSCodec_Std97().
rtlDigest svx::MSCodec_Std97::m_hDigest [private] |
Definition at line 331 of file mscodec.hxx.
Referenced by GetDigestFromSalt(), GetEncryptKey(), InitCipher(), InitKey(), MSCodec_Std97(), and ~MSCodec_Std97().
sal_uInt8 svx::MSCodec_Std97::m_pDigestValue[RTL_DIGEST_LENGTH_MD5] [private] |
Definition at line 332 of file mscodec.hxx.
Referenced by InitCipher(), InitKey(), MSCodec_Std97(), and ~MSCodec_Std97().
1.5.6