LibreOffice Module oox (master) 1
|
#include <AgileEngine.hxx>
Public Member Functions | |
AgileEngine () | |
AgileEncryptionInfo & | getInfo () |
void | setPreset (AgileEncryptionPreset ePreset) |
void | decryptEncryptionKey (OUString const &rPassword) |
bool | decryptAndCheckVerifierHash (OUString const &rPassword) |
bool | generateEncryptionKey (OUString const &rPassword) override |
bool | readEncryptionInfo (css::uno::Reference< css::io::XInputStream > &rxInputStream) override |
bool | decrypt (BinaryXInputStream &aInputStream, BinaryXOutputStream &aOutputStream) override |
bool | checkDataIntegrity () override |
bool | decryptHmacKey () |
bool | decryptHmacValue () |
void | writeEncryptionInfo (BinaryXOutputStream &rStream) override |
void | encrypt (const css::uno::Reference< css::io::XInputStream > &rxInputStream, css::uno::Reference< css::io::XOutputStream > &rxOutputStream, sal_uInt32 nSize) override |
bool | setupEncryption (OUString const &rPassword) override |
bool | generateAndEncryptVerifierHash (OUString const &rPassword) |
bool | encryptHmacKey () |
bool | encryptHmacValue () |
bool | encryptEncryptionKey (OUString const &rPassword) |
void | setupEncryptionParameters (AgileEncryptionParameters const &rAgileEncryptionParameters) |
bool | setupEncryptionKey (OUString const &rPassword) |
Public Member Functions inherited from oox::crypto::CryptoEngine | |
CryptoEngine () | |
virtual | ~CryptoEngine () |
virtual bool | readEncryptionInfo (css::uno::Reference< css::io::XInputStream > &rxInputStream)=0 |
virtual bool | generateEncryptionKey (const OUString &rPassword)=0 |
virtual bool | decrypt (BinaryXInputStream &aInputStream, BinaryXOutputStream &aOutputStream)=0 |
virtual void | writeEncryptionInfo (BinaryXOutputStream &rStream)=0 |
virtual bool | setupEncryption (const OUString &rPassword)=0 |
virtual void | encrypt (const css::uno::Reference< css::io::XInputStream > &rxInputStream, css::uno::Reference< css::io::XOutputStream > &rxOutputStream, sal_uInt32 nSize)=0 |
virtual bool | checkDataIntegrity ()=0 |
Private Member Functions | |
void | calculateHashFinal (const OUString &rPassword, std::vector< sal_uInt8 > &aHashFinal) |
void | calculateBlock (std::vector< sal_uInt8 > const &rBlock, std::vector< sal_uInt8 > &rHashFinal, std::vector< sal_uInt8 > &rInput, std::vector< sal_uInt8 > &rOutput) |
void | encryptBlock (std::vector< sal_uInt8 > const &rBlock, std::vector< sal_uInt8 > &rHashFinal, std::vector< sal_uInt8 > &rInput, std::vector< sal_uInt8 > &rOutput) |
Static Private Member Functions | |
static Crypto::CryptoType | cryptoType (const AgileEncryptionInfo &rInfo) |
Private Attributes | |
AgileEncryptionInfo | mInfo |
AgileEncryptionPreset | meEncryptionPreset |
Additional Inherited Members | |
Protected Attributes inherited from oox::crypto::CryptoEngine | |
std::vector< sal_uInt8 > | mKey |
Definition at line 76 of file AgileEngine.hxx.
oox::crypto::AgileEngine::AgileEngine | ( | ) |
Definition at line 227 of file AgileEngine.cxx.
References oox::crypto::AES_256_SHA512.
|
private |
Definition at line 253 of file AgileEngine.cxx.
References cryptoType(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, mInfo, oox::crypto::AgileEncryptionInfo::saltValue, and oox::crypto::Decrypt::update().
Referenced by decryptAndCheckVerifierHash(), and decryptEncryptionKey().
|
private |
Definition at line 298 of file AgileEngine.cxx.
References comphelper::DocPasswordHelper::GetOoxHashAsVector(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, mInfo, comphelper::Hash::PREPEND, oox::crypto::AgileEncryptionInfo::saltValue, and oox::crypto::AgileEncryptionInfo::spinCount.
Referenced by decryptAndCheckVerifierHash(), decryptEncryptionKey(), encryptEncryptionKey(), and generateAndEncryptVerifierHash().
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 428 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::hmacCalculatedHash, oox::crypto::AgileEncryptionInfo::hmacHash, and mInfo.
|
staticprivate |
Definition at line 231 of file AgileEngine.cxx.
References oox::crypto::Crypto::AES_128_CBC, oox::crypto::Crypto::AES_256_CBC, oox::crypto::AgileEncryptionInfo::cipherAlgorithm, oox::crypto::AgileEncryptionInfo::cipherChaining, oox::crypto::AgileEncryptionInfo::keyBits, and oox::crypto::Crypto::UNKNOWN.
Referenced by calculateBlock(), decrypt(), decryptHmacKey(), decryptHmacValue(), encrypt(), encryptBlock(), encryptHmacKey(), and encryptHmacValue().
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 436 of file AgileEngine.cxx.
References cryptoType(), oox::crypto::CryptoHash::finalize(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacCalculatedHash, oox::crypto::AgileEncryptionInfo::hmacKey, oox::crypto::AgileEncryptionInfo::keyBits, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, p, oox::BinaryXInputStream::readMemory(), oox::BinaryInputStream::readuInt32(), oox::crypto::AgileEncryptionInfo::saltSize, oox::BinaryXInputStream::skip(), oox::crypto::Decrypt::update(), oox::crypto::CryptoHash::update(), oox::ByteOrderConverter::writeLittleEndian(), and oox::BinaryXOutputStream::writeMemory().
bool oox::crypto::AgileEngine::decryptAndCheckVerifierHash | ( | OUString const & | rPassword | ) |
Definition at line 322 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, calculateBlock(), calculateHashFinal(), oox::crypto::AgileEncryptionInfo::encryptedVerifierHashInput, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashValue, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, mInfo, oox::crypto::roundUp(), and oox::crypto::AgileEncryptionInfo::saltSize.
Referenced by generateEncryptionKey().
void oox::crypto::AgileEngine::decryptEncryptionKey | ( | OUString const & | rPassword | ) |
Definition at line 350 of file AgileEngine.cxx.
References calculateBlock(), calculateHashFinal(), oox::crypto::AgileEncryptionInfo::encryptedKeyValue, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, mInfo, and oox::crypto::CryptoEngine::mKey.
Referenced by generateEncryptionKey().
bool oox::crypto::AgileEngine::decryptHmacKey | ( | ) |
Definition at line 377 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::calculateIV(), cryptoType(), eType, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacEncryptedKey, oox::crypto::AgileEncryptionInfo::hmacKey, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, comphelper::SHA1, comphelper::SHA512, and oox::crypto::Decrypt::update().
Referenced by generateEncryptionKey().
bool oox::crypto::AgileEngine::decryptHmacValue | ( | ) |
Definition at line 403 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::calculateIV(), cryptoType(), eType, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacEncryptedValue, oox::crypto::AgileEncryptionInfo::hmacHash, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, comphelper::SHA1, comphelper::SHA512, and oox::crypto::Decrypt::update().
Referenced by generateEncryptionKey().
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 776 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, cryptoType(), encryptHmacValue(), oox::crypto::CryptoHash::finalize(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacHash, oox::crypto::AgileEncryptionInfo::hmacKey, oox::crypto::AgileEncryptionInfo::keyBits, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, p, oox::BinaryXInputStream::readMemory(), oox::crypto::roundUp(), oox::crypto::AgileEncryptionInfo::saltSize, oox::crypto::Encrypt::update(), oox::crypto::CryptoHash::update(), oox::ByteOrderConverter::writeLittleEndian(), and oox::BinaryXOutputStream::writeMemory().
|
private |
Definition at line 275 of file AgileEngine.cxx.
References cryptoType(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, mInfo, oox::crypto::AgileEncryptionInfo::saltValue, and oox::crypto::Encrypt::update().
Referenced by encryptEncryptionKey(), and generateAndEncryptVerifierHash().
bool oox::crypto::AgileEngine::encryptEncryptionKey | ( | OUString const & | rPassword | ) |
Definition at line 657 of file AgileEngine.cxx.
References calculateHashFinal(), encryptBlock(), oox::crypto::AgileEncryptionInfo::encryptedKeyValue, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, mInfo, and oox::crypto::CryptoEngine::mKey.
Referenced by setupEncryptionKey().
bool oox::crypto::AgileEngine::encryptHmacKey | ( | ) |
Definition at line 592 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::calculateIV(), cryptoType(), eType, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacEncryptedKey, oox::crypto::AgileEncryptionInfo::hmacKey, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, oox::crypto::roundUp(), comphelper::SHA1, comphelper::SHA512, and oox::crypto::Encrypt::update().
Referenced by setupEncryptionKey().
bool oox::crypto::AgileEngine::encryptHmacValue | ( | ) |
Definition at line 630 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::calculateIV(), cryptoType(), eType, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacEncryptedValue, oox::crypto::AgileEncryptionInfo::hmacHash, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::CryptoEngine::mKey, oox::crypto::roundUp(), comphelper::SHA1, comphelper::SHA512, and oox::crypto::Encrypt::update().
Referenced by encrypt().
bool oox::crypto::AgileEngine::generateAndEncryptVerifierHash | ( | OUString const & | rPassword | ) |
Definition at line 566 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, calculateHashFinal(), encryptBlock(), oox::crypto::AgileEncryptionInfo::encryptedVerifierHashInput, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashValue, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, mInfo, oox::crypto::roundUp(), oox::crypto::AgileEncryptionInfo::saltSize, and oox::crypto::AgileEncryptionInfo::saltValue.
Referenced by setupEncryptionKey().
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 364 of file AgileEngine.cxx.
References decryptAndCheckVerifierHash(), decryptEncryptionKey(), decryptHmacKey(), and decryptHmacValue().
|
inline |
Definition at line 101 of file AgileEngine.hxx.
References mInfo.
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 503 of file AgileEngine.cxx.
References msfilter::AGILE_ENCRYPTION_RESERVED, oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::AgileEncryptionInfo::cipherAlgorithm, oox::crypto::AgileEncryptionInfo::cipherChaining, comphelper::getProcessComponentContext(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, mInfo, oox::crypto::AgileEncryptionInfo::saltSize, comphelper::SHA1_HASH_LENGTH, comphelper::SHA512_HASH_LENGTH, oox::crypto::AgileEncryptionInfo::spinCount, and oox::ByteOrderConverter::writeLittleEndian().
|
inline |
Definition at line 103 of file AgileEngine.hxx.
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 678 of file AgileEngine.cxx.
References oox::crypto::AES_128_SHA1, meEncryptionPreset, setupEncryptionKey(), and setupEncryptionParameters().
bool oox::crypto::AgileEngine::setupEncryptionKey | ( | OUString const & | rPassword | ) |
Definition at line 706 of file AgileEngine.cxx.
References encryptEncryptionKey(), encryptHmacKey(), generateAndEncryptVerifierHash(), oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, and oox::crypto::AgileEncryptionInfo::saltSize.
Referenced by setupEncryption().
void oox::crypto::AgileEngine::setupEncryptionParameters | ( | AgileEncryptionParameters const & | rAgileEncryptionParameters | ) |
Definition at line 688 of file AgileEngine.cxx.
References oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::AgileEncryptionParameters::blockSize, oox::crypto::AgileEncryptionInfo::cipherAlgorithm, oox::crypto::AgileEncryptionParameters::cipherAlgorithm, oox::crypto::AgileEncryptionInfo::cipherChaining, oox::crypto::AgileEncryptionParameters::cipherChaining, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashInput, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashValue, oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionParameters::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionParameters::hashSize, oox::crypto::AgileEncryptionInfo::keyBits, oox::crypto::AgileEncryptionParameters::keyBits, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::roundUp(), oox::crypto::AgileEncryptionInfo::saltSize, oox::crypto::AgileEncryptionParameters::saltSize, oox::crypto::AgileEncryptionInfo::saltValue, oox::crypto::AgileEncryptionInfo::spinCount, and oox::crypto::AgileEncryptionParameters::spinCount.
Referenced by setupEncryption().
|
overridevirtual |
Implements oox::crypto::CryptoEngine.
Definition at line 719 of file AgileEngine.cxx.
References msfilter::AGILE_ENCRYPTION_RESERVED, tools::XmlWriter::attribute(), tools::XmlWriter::attributeBase64(), oox::crypto::AgileEncryptionInfo::blockSize, oox::crypto::AgileEncryptionInfo::cipherAlgorithm, oox::crypto::AgileEncryptionInfo::cipherChaining, oox::crypto::AgileEncryptionInfo::encryptedKeyValue, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashInput, oox::crypto::AgileEncryptionInfo::encryptedVerifierHashValue, tools::XmlWriter::endDocument(), tools::XmlWriter::endElement(), SvMemoryStream::GetData(), SvMemoryStream::GetSize(), oox::crypto::AgileEncryptionInfo::hashAlgorithm, oox::crypto::AgileEncryptionInfo::hashSize, oox::crypto::AgileEncryptionInfo::hmacEncryptedKey, oox::crypto::AgileEncryptionInfo::hmacEncryptedValue, oox::crypto::AgileEncryptionInfo::keyBits, oox::crypto::AgileEncryptionInfo::keyDataSalt, mInfo, oox::crypto::AgileEncryptionInfo::saltSize, oox::crypto::AgileEncryptionInfo::saltValue, oox::crypto::AgileEncryptionInfo::spinCount, tools::XmlWriter::startDocument(), tools::XmlWriter::startElement(), msfilter::VERSION_INFO_AGILE, oox::BinaryXOutputStream::writeMemory(), and oox::BinaryOutputStream::WriteUInt32().
|
private |
Definition at line 80 of file AgileEngine.hxx.
Referenced by setupEncryption().
|
private |
Definition at line 79 of file AgileEngine.hxx.
Referenced by calculateBlock(), calculateHashFinal(), checkDataIntegrity(), decrypt(), decryptAndCheckVerifierHash(), decryptEncryptionKey(), decryptHmacKey(), decryptHmacValue(), encrypt(), encryptBlock(), encryptEncryptionKey(), encryptHmacKey(), encryptHmacValue(), generateAndEncryptVerifierHash(), readEncryptionInfo(), setupEncryptionKey(), setupEncryptionParameters(), and writeEncryptionInfo().