WPXEncryption.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwpd
3  * Version: MPL 2.0 / LGPLv2.1+
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Major Contributor(s):
10  * Copyright (C) 2007 Jaroslav Fojtik (JaFojtik@seznam.cz)
11  * Copyright (C) 2007 Fridrich Strba (fridrich.strba@bluewin.ch)
12  *
13  * For minor contributions see the git repository.
14  *
15  * Alternatively, the contents of this file may be used under the terms
16  * of the GNU Lesser General Public License Version 2.1 or later
17  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18  * applicable instead of those above.
19  *
20  * For further information visit http://libwpd.sourceforge.net
21  */
22 
23 /* "This product is not manufactured, approved, or supported by
24  * Corel Corporation or Corel Corporation Limited."
25  */
26 
27 #ifndef WPXENCRYPTION_H
28 #define WPXENCRYPTION_H
29 
30 #include <memory>
31 
32 #include <librevenge/librevenge.h>
33 #include <libwpd/libwpd.h>
34 
36 {
37 public:
38  WPXEncryption(const char *password, const unsigned long encryptionStartOffset = 0);
40 
41  const unsigned char *readAndDecrypt(librevenge::RVNGInputStream *input, unsigned long numBytes, unsigned long &numBytesRead);
42  unsigned short getCheckSum() const;
43 
44  void setEncryptionStartOffset(unsigned long encryptionStartOffset)
45  {
46  m_encryptionStartOffset = encryptionStartOffset;
47  }
48  unsigned long getEncryptionStartOffset() const
49  {
51  }
52 
53  void setEncryptionMaskBase(unsigned char encryptionMaskBase)
54  {
55  m_encryptionMaskBase = encryptionMaskBase;
56  }
57  unsigned char getEncryptionMaskBase() const
58  {
59  return m_encryptionMaskBase;
60  }
61 
62  const librevenge::RVNGString &getEncryptionPassword() const
63  {
64  return m_password;
65  }
66 
67 private:
68  std::unique_ptr<unsigned char[]> m_buffer;
69  librevenge::RVNGString m_password;
70  unsigned long m_encryptionStartOffset;
71  unsigned char m_encryptionMaskBase;
72  // Unimplemented to prevent compiler from creating crasher ones
75 };
76 
77 #endif /* WPXENCRYPTION_H */
78 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Definition: WPXEncryption.h:36
WPXEncryption & operator=(const WPXEncryption &)
unsigned long m_encryptionStartOffset
Definition: WPXEncryption.h:70
librevenge::RVNGString m_password
Definition: WPXEncryption.h:69
const librevenge::RVNGString & getEncryptionPassword() const
Definition: WPXEncryption.h:62
unsigned short getCheckSum() const
Definition: WPXEncryption.cpp:52
void setEncryptionStartOffset(unsigned long encryptionStartOffset)
Definition: WPXEncryption.h:44
const unsigned char * readAndDecrypt(librevenge::RVNGInputStream *input, unsigned long numBytes, unsigned long &numBytesRead)
Definition: WPXEncryption.cpp:64
unsigned char m_encryptionMaskBase
Definition: WPXEncryption.h:71
unsigned char getEncryptionMaskBase() const
Definition: WPXEncryption.h:57
~WPXEncryption()
Definition: WPXEncryption.cpp:47
std::unique_ptr< unsigned char[]> m_buffer
Definition: WPXEncryption.h:68
void setEncryptionMaskBase(unsigned char encryptionMaskBase)
Definition: WPXEncryption.h:53
unsigned long getEncryptionStartOffset() const
Definition: WPXEncryption.h:48
WPXEncryption(const char *password, const unsigned long encryptionStartOffset=0)
Definition: WPXEncryption.cpp:30
WPXEncryption(const WPXEncryption &)

Generated for libwpd by doxygen 1.9.1