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
89b384ab
Commit
89b384ab
authored
Sep 01, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix derypt file
parent
f54baf3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
51 deletions
+47
-51
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
+43
-48
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
+4
-3
No files found.
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
View file @
89b384ab
...
...
@@ -483,26 +483,27 @@ namespace DocFileFormat
delete
storageOut
;
return
false
;
}
std
::
list
<
std
::
string
>
listStream
=
storageIn
->
entries
();
for
(
std
::
list
<
std
::
string
>::
iterator
it
=
listStream
.
begin
();
it
!=
listStream
.
end
();
it
++
)
{
if
(
storageIn
->
isDirectory
(
*
it
))
{
std
::
list
<
std
::
string
>
list_entry
=
storageIn
->
GetAllStreams
(
*
it
);
for
(
std
::
list
<
std
::
string
>::
iterator
it2
=
list_entry
.
begin
();
it2
!=
list_entry
.
end
();
it2
++
)
{
DecryptStream
(
Decryptor
,
*
it2
,
storageIn
,
storageOut
);
}
}
else
{
DecryptStream
(
Decryptor
,
*
it
,
storageIn
,
storageOut
);
}
}
DecryptStream
(
0
,
"/"
,
storageIn
,
storageOut
,
Decryptor
);
//std::list<std::string> listStream = storageIn->entries();
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
//{
// if (storageIn->isDirectory(*it))
// {
// std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
//
// for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
// {
// DecryptStream(Decryptor, *it2, storageIn, storageOut);
// }
// }
// else
// {
// DecryptStream(Decryptor, *it, storageIn, storageOut);
// }
//}
storageOut
->
close
();
delete
storageOut
;
...
...
@@ -525,34 +526,28 @@ namespace DocFileFormat
}
return
true
;
}
bool
WordDocument
::
CopyStream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
)
void
WordDocument
::
DecryptStream
(
int
level
,
std
::
string
path
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
,
CRYPT
::
Decryptor
*
Decryptor
)
{
POLE
::
Stream
*
stream
=
new
POLE
::
Stream
(
storageIn
,
streamName
);
if
(
!
stream
)
return
false
;
stream
->
seek
(
0
);
int
sz_stream
=
stream
->
size
();
POLE
::
Stream
*
streamNew
=
new
POLE
::
Stream
(
storageOut
,
streamName
,
true
,
sz_stream
);
if
(
!
streamNew
)
return
false
;
unsigned
char
*
data_stream
=
new
unsigned
char
[
sz_stream
];
stream
->
read
(
data_stream
,
sz_stream
);
streamNew
->
write
(
data_stream
,
sz_stream
);
RELEASEARRAYOBJECTS
(
data_stream
);
streamNew
->
flush
();
delete
streamNew
;
delete
stream
;
return
true
;
std
::
list
<
std
::
string
>
entries
;
entries
=
storageIn
->
entries
(
path
);
std
::
list
<
std
::
string
>::
iterator
it
;
for
(
it
=
entries
.
begin
();
it
!=
entries
.
end
();
++
it
)
{
std
::
string
name
=
*
it
;
std
::
string
fullname
=
path
+
name
;
if
(
storageIn
->
isDirectory
(
fullname
)
)
{
DecryptStream
(
level
+
1
,
fullname
+
"/"
,
storageIn
,
storageOut
,
Decryptor
);
}
else
{
DecryptStream
(
fullname
,
storageIn
,
storageOut
,
Decryptor
);
}
}
}
bool
WordDocument
::
DecryptStream
(
CRYPT
::
Decryptor
*
Decryptor
,
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
)
bool
WordDocument
::
DecryptStream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
,
CRYPT
::
Decryptor
*
Decryptor
)
{
POLE
::
Stream
*
stream
=
new
POLE
::
Stream
(
storageIn
,
streamName
);
if
(
!
stream
)
return
false
;
...
...
@@ -567,9 +562,9 @@ namespace DocFileFormat
stream
->
read
(
data_stream
,
size_stream
);
unsigned
char
*
data_store
=
NULL
;
int
size_data_store
=
0
;
int
size_data_store
=
0
;
if
(
"WordDocument"
==
streamName
)
if
(
std
::
wstring
::
npos
!=
streamName
.
find
(
"WordDocument"
)
)
{
size_data_store
=
68
;
data_store
=
new
unsigned
char
[
size_data_store
];
...
...
ASCOfficeDocFile/DocDocxConverter/WordDocument.h
View file @
89b384ab
...
...
@@ -102,9 +102,10 @@ namespace DocFileFormat
private:
bool
DecryptOfficeFile
(
CRYPT
::
Decryptor
*
Decryptor
);
bool
DecryptStream
(
CRYPT
::
Decryptor
*
Decryptor
,
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
);
bool
CopyStream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
);
bool
DecryptStream
(
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
,
CRYPT
::
Decryptor
*
Decryptor
);
void
DecryptStream
(
int
level
,
std
::
string
streamName
,
POLE
::
Storage
*
storageIn
,
POLE
::
Storage
*
storageOut
,
CRYPT
::
Decryptor
*
Decryptor
);
inline
StructuredStorageReader
*
GetStorage
()
const
{
return
m_pStorage
;
...
...
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