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
b18cd44c
Commit
b18cd44c
authored
May 18, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6705045d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
3 deletions
+51
-3
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
+51
-3
No files found.
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
View file @
b18cd44c
...
...
@@ -174,6 +174,9 @@ public:
return
;
}
std
::
wstring
sSetupID
=
FindFirstChild
(
GetObjectById
(
"idOfficeObject"
),
L"SetupID"
).
GetText
();
m_guid
=
U_TO_UTF8
(
sSetupID
);
// 2) Check files (Manifect)
XmlUtils
::
CXmlNode
nodeManifect
=
GetObjectById
(
"idPackageObject"
);
if
(
!
nodeManifect
.
IsValid
())
...
...
@@ -197,10 +200,10 @@ public:
// 3) Images
XmlUtils
::
CXmlNode
nodeImageValid
=
GetObjectById
(
"idValidSigLnImg"
);
if
(
nodeImageValid
.
IsValid
())
m_sImageValidBase64
=
U_TO_UTF8
(
nodeImageValid
.
GetText
()
);
m_sImageValidBase64
=
GetBase64Image
(
nodeImageValid
);
XmlUtils
::
CXmlNode
nodeImageInvalid
=
GetObjectById
(
"idInvalidSigLnImg"
);
if
(
nodeImageInvalid
.
IsValid
())
m_sImageInvalidBase64
=
U_TO_UTF8
(
nodeImageInvalid
.
GetText
()
);
m_sImageInvalidBase64
=
GetBase64Image
(
nodeImageInvalid
);
// 4) Objects
XmlUtils
::
CXmlNodes
nodesReferences
;
...
...
@@ -244,7 +247,7 @@ public:
std
::
string
sSignatureValue
=
U_TO_UTF8
((
m_node
.
ReadValueString
(
L"SignatureValue"
)));
if
(
!
m_cert
->
Verify
(
sSignatureCalcValue
,
sSignatureValue
,
nSignatureMethod
))
m_valid
=
OOXML_SIGNATURE_INVALID
;
m_valid
=
OOXML_SIGNATURE_INVALID
;
}
XmlUtils
::
CXmlNode
GetObjectById
(
std
::
string
sId
)
...
...
@@ -262,6 +265,51 @@ public:
return
ret
;
}
XmlUtils
::
CXmlNode
FindFirstChild
(
XmlUtils
::
CXmlNode
&
node
,
const
std
::
wstring
&
sName
)
{
if
(
node
.
GetName
()
==
sName
)
return
node
;
XmlUtils
::
CXmlNodes
childs
;
if
(
node
.
GetChilds
(
childs
))
{
int
nCount
=
childs
.
GetCount
();
for
(
int
i
=
0
;
i
<
nCount
;
i
++
)
{
XmlUtils
::
CXmlNode
child
;
childs
.
GetAt
(
i
,
child
);
XmlUtils
::
CXmlNode
ret
=
FindFirstChild
(
child
,
sName
);
if
(
ret
.
IsValid
())
return
ret
;
}
}
XmlUtils
::
CXmlNode
ret
;
return
ret
;
}
std
::
string
GetBase64Image
(
XmlUtils
::
CXmlNode
&
node
)
{
std
::
wstring
sW
=
node
.
GetText
();
std
::
string
s
=
U_TO_UTF8
(
sW
);
int
len
=
(
int
)
s
.
length
();
int
j
=
0
;
for
(
int
i
=
0
;
i
<
len
;)
{
char
c
=
s
.
at
(
i
);
if
((
c
>=
'A'
&&
c
<=
'Z'
)
||
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'0'
&&
c
<=
'9'
)
||
(
c
==
'+'
)
||
(
c
==
'/'
))
s
.
at
(
j
++
)
=
s
.
at
(
i
++
);
else
i
++
;
}
s
.
resize
(
j
);
return
s
;
}
friend
class
COOXMLVerifier
;
public:
...
...
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