LibreOffice Module filter (master) 1
Public Member Functions | Private Attributes | List of all members
msfilter::MSCodec_CryptoAPI Class Referencefinal

#include <mscodec.hxx>

Inheritance diagram for msfilter::MSCodec_CryptoAPI:
[legend]
Collaboration diagram for msfilter::MSCodec_CryptoAPI:
[legend]

Public Member Functions

 MSCodec_CryptoAPI ()
 
virtual void InitKey (const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16]) override
 Initializes the algorithm with the specified password and document ID. More...
 
virtual bool InitCipher (sal_uInt32 nCounter) override
 Rekeys the codec using the specified counter. More...
 
virtual void GetDigestFromSalt (const sal_uInt8 *pSaltData, sal_uInt8 *pDigest) override
 
virtual css::uno::Sequence< css::beans::NamedValue > GetEncryptionData () override
 Retrieves the encryption data. More...
 
- Public Member Functions inherited from msfilter::MSCodec97
 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])
 

Private Attributes

css::uno::Sequence< sal_Int8m_aStd97Key
 

Additional Inherited Members

- Protected Attributes inherited from msfilter::MSCodec97
OUString m_sEncKeyName
 
size_t m_nHashLen
 
rtlCipher m_hCipher
 
std::vector< sal_uInt8m_aDocId
 
std::vector< sal_uInt8m_aDigestValue
 

Detailed Description

Definition at line 399 of file mscodec.hxx.

Constructor & Destructor Documentation

◆ MSCodec_CryptoAPI()

msfilter::MSCodec_CryptoAPI::MSCodec_CryptoAPI ( )

Definition at line 267 of file mscodec.cxx.

Member Function Documentation

◆ GetDigestFromSalt()

void msfilter::MSCodec_CryptoAPI::GetDigestFromSalt ( const sal_uInt8 pSaltData,
sal_uInt8 pDigest 
)
overridevirtual

◆ GetEncryptionData()

uno::Sequence< beans::NamedValue > msfilter::MSCodec_CryptoAPI::GetEncryptionData ( )
overridevirtual

Retrieves the encryption data.

Returns
The sequence contains the necessary data to initialize the codec.

Reimplemented from msfilter::MSCodec97.

Definition at line 489 of file mscodec.cxx.

References comphelper::SequenceAsHashMap::getAsConstNamedValueList(), msfilter::MSCodec97::GetEncryptionData(), and m_aStd97Key.

◆ InitCipher()

bool msfilter::MSCodec_CryptoAPI::InitCipher ( sal_uInt32  nCounter)
overridevirtual

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.

Parameters
nCounterBlock counter used to rekey the cipher.

Implements msfilter::MSCodec97.

Definition at line 470 of file mscodec.cxx.

References comphelper::Hash::calculateHash(), msfilter::ENCRYPT_KEY_SIZE_AES_128, msfilter::MSCodec97::m_aDigestValue, msfilter::MSCodec97::m_hCipher, and result.

◆ InitKey()

void msfilter::MSCodec_CryptoAPI::InitKey ( const sal_uInt16  pPassData[16],
const sal_uInt8  pDocId[16] 
)
overridevirtual

Initializes the algorithm with the specified password and document ID.

Parameters
pPassDataWide character array containing the password. Must be zero terminated, which results in a maximum length of 15 characters.
pDocIdUnique document identifier read from or written to the file.

Implements msfilter::MSCodec97.

Definition at line 363 of file mscodec.cxx.

References comphelper::Hash::calculateHash(), comphelper::DocPasswordHelper::GenerateStd97Key(), msfilter::lcl_PrintDigest(), msfilter::MSCodec97::m_aDigestValue, msfilter::MSCodec97::m_aDocId, and m_aStd97Key.

Member Data Documentation

◆ m_aStd97Key

css::uno::Sequence<sal_Int8> msfilter::MSCodec_CryptoAPI::m_aStd97Key
private

Definition at line 402 of file mscodec.hxx.

Referenced by GetEncryptionData(), and InitKey().


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