Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
4015e8ba
Commit
4015e8ba
authored
Jun 24, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PptFormatReader - decrypt ppt images
parent
276af556
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
196 additions
and
174 deletions
+196
-174
ASCOfficeDocFile/DocDocxConverter/EncryptionHeader.cpp
ASCOfficeDocFile/DocDocxConverter/EncryptionHeader.cpp
+2
-1
ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h
ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h
+3
-1
ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp
ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp
+8
-13
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.cpp
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.cpp
+23
-12
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
+5
-1
ASCOfficePPTFile/PPTFormatLib/Records/CryptSession10Container.h
...icePPTFile/PPTFormatLib/Records/CryptSession10Container.h
+2
-0
ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ArtBlip.cpp
ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ArtBlip.cpp
+153
-146
No files found.
ASCOfficeDocFile/DocDocxConverter/EncryptionHeader.cpp
View file @
4015e8ba
...
...
@@ -147,10 +147,11 @@ namespace DocFileFormat
if
(
fAES
)
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
AES_ECB
;
if
(
fCryptoAPI
)
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
RC4
;
crypt_data_aes
.
keySize
=
KeySize
/
8
;
break
;
case
0x6801
:
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
RC4
;
crypt_data_aes
.
keySize
=
KeySize
/
8
;
if
(
crypt_data_aes
.
keySize
==
0
)
crypt_data_aes
.
keySize
=
5
;
// 40 bit
break
;
case
0x660E
:
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
AES_ECB
;
...
...
ASCOfficePPTFile/PPTFormatLib/Reader/PPTDocumentInfo.h
View file @
4015e8ba
...
...
@@ -96,7 +96,9 @@ public:
if
(
bResult
==
false
)
{
delete
pInfo
;
continue
;
if
(
pInfo
->
m_bEncrypt
)
return
false
;
else
continue
;
}
m_arUsers
.
push_back
(
pInfo
);
...
...
ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp
View file @
4015e8ba
...
...
@@ -224,6 +224,7 @@ void CPPTFileReader::ReadDocumentSummary()
void
CPPTFileReader
::
ReadPictures
()
{
if
(
m_oDocumentInfo
.
m_arUsers
.
empty
())
return
;
CFStreamPtr
pStream
=
GetPictureStream
();
if
(
!
pStream
)
return
;
...
...
@@ -242,28 +243,22 @@ void CPPTFileReader::ReadPictures()
POLE
::
Stream
*
pStreamTmp
=
pStream
->
stream_
;
if
(
pDecryptor
)
{
m_oDocumentInfo
.
m_arUsers
[
0
]
->
DecryptStream
(
pStreamTmp
,
0
);
m_oDocumentInfo
.
m_arUsers
[
0
]
->
DecryptStream
(
pStreamTmp
,
0
);
pStreamTmp
=
m_oDocumentInfo
.
m_arUsers
[
0
]
->
m_arStreamDecrypt
.
back
()
->
stream_
;
}
oHeader
.
ReadFromStream
(
pStreamTmp
);
pStream
->
seekFromBegin
(
pos
+
8
);
CRecordOfficeArtBlip
art_blip
;
art_blip
.
m_strTmpDirectory
=
m_strTmpDirectory
;
art_blip
.
m_oDocumentInfo
=
&
m_oDocumentInfo
;
pStreamTmp
=
pStream
->
stream_
;
if
(
pDecryptor
)
{
m_oDocumentInfo
.
m_arUsers
[
0
]
->
DecryptStream
(
pStreamTmp
,
1
);
pStreamTmp
=
m_oDocumentInfo
.
m_arUsers
[
0
]
->
m_arStreamDecrypt
.
back
()
->
stream_
;
//
pStream
->
seekFromBegin
(
pos
+
8
);
pStreamTmp
=
pStream
->
stream_
;
//каждое поле отдельно нужно
}
art_blip
.
ReadFromStream
(
oHeader
,
pStreamTmp
);
pStream
->
seekFromBegin
(
pos
+
oHeader
.
RecLen
+
8
);
art_blip
.
ReadFromStream
(
oHeader
,
pStreamTmp
);
m_oDocumentInfo
.
m_mapStoreImageFile
[
pos
]
=
art_blip
.
m_sFileName
;
pStream
->
seekFromBegin
(
pos
+
oHeader
.
RecLen
+
8
);
}
}
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.cpp
View file @
4015e8ba
...
...
@@ -33,8 +33,10 @@
#include "ReadStructures.h"
#include <zlib.h>
#include "../../../ASCOfficeDocFile/DocDocxConverter/MemoryStream.h"
#include "../../../OfficeCryptReader/source/CryptTransform.h"
#include <zlib.h>
using
namespace
NSPresentationEditor
;
...
...
@@ -639,22 +641,31 @@ namespace NSPresentationEditor
}
}
//------------------------------------------------------------------------------------
void
CMetaHeader
::
FromStream
(
POLE
::
Stream
*
pStream
)
void
CMetaHeader
::
FromStream
(
POLE
::
Stream
*
pStream
,
CRYPT
::
ECMADecryptor
*
pDecryptor
)
{
cbSize
=
StreamUtils
::
ReadDWORD
(
pStream
);
int
size
=
34
;
BYTE
*
pData
=
new
BYTE
[
size
];
pStream
->
read
(
pData
,
size
);
if
(
pDecryptor
)
{
pDecryptor
->
Decrypt
((
char
*
)
pData
,
size
,
0
);
}
MemoryStream
memStream
(
pData
,
size
,
false
);
cbSize
=
memStream
.
ReadUInt32
();
rcBounds
.
left
=
StreamUtils
::
ReadLONG
(
pStream
);
rcBounds
.
top
=
StreamUtils
::
ReadLONG
(
pStream
);
rcBounds
.
right
=
StreamUtils
::
ReadLONG
(
pStream
);
rcBounds
.
bottom
=
StreamUtils
::
ReadLONG
(
pStream
);
rcBounds
.
left
=
memStream
.
ReadInt32
(
);
rcBounds
.
top
=
memStream
.
ReadInt32
(
);
rcBounds
.
right
=
memStream
.
ReadInt32
(
);
rcBounds
.
bottom
=
memStream
.
ReadInt32
(
);
ptSize
.
x
=
StreamUtils
::
ReadLONG
(
pStream
);
ptSize
.
y
=
StreamUtils
::
ReadLONG
(
pStream
);
ptSize
.
x
=
memStream
.
ReadInt32
(
);
ptSize
.
y
=
memStream
.
ReadInt32
(
);
cbSave
=
StreamUtils
::
ReadDWORD
(
pStream
);
cbSave
=
memStream
.
ReadUInt32
(
);
compression
=
StreamUtils
::
ReadBYTE
(
pStream
);
filter
=
StreamUtils
::
ReadBYTE
(
pStream
);
compression
=
memStream
.
ReadByte
(
);
filter
=
memStream
.
ReadByte
(
);
}
void
CMetaHeader
::
ToEMFHeader
(
Gdiplus
::
ENHMETAHEADER3
*
pHeader
)
...
...
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
View file @
4015e8ba
...
...
@@ -43,6 +43,10 @@ namespace NSZLib
bool
Decompress
(
const
BYTE
*
pSrcBuffer
,
const
ULONG
&
lSrcBufferLen
,
BYTE
*
pDstBuffer
,
ULONG
&
lDstBufferLen
);
}
namespace
CRYPT
{
class
ECMADecryptor
;
}
/**************************************************************
теперь все структуры...
которые участвуют в записях
...
...
@@ -170,7 +174,7 @@ public:
CMetaHeader
()
{
}
void
FromStream
(
POLE
::
Stream
*
pStream
);
void
FromStream
(
POLE
::
Stream
*
pStream
,
CRYPT
::
ECMADecryptor
*
pDecryptor
=
NULL
);
void
ToEMFHeader
(
Gdiplus
::
ENHMETAHEADER3
*
pHeader
);
void
ToWMFHeader
(
Gdiplus
::
WmfPlaceableFileHeader
*
pHeader
);
...
...
ASCOfficePPTFile/PPTFormatLib/Records/CryptSession10Container.h
View file @
4015e8ba
...
...
@@ -165,6 +165,8 @@ public:
case
0x6801
:
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
RC4
;
crypt_data_aes
.
keySize
=
KeySize
/
8
;
if
(
crypt_data_aes
.
keySize
==
0
)
crypt_data_aes
.
keySize
=
5
;
// 40 bit
break
;
case
0x660E
:
crypt_data_aes
.
cipherAlgorithm
=
CRYPT_METHOD
::
AES_ECB
;
...
...
ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ArtBlip.cpp
View file @
4015e8ba
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment