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
24e55018
Commit
24e55018
authored
May 11, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2352ae5d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
5 deletions
+112
-5
DesktopEditor/xmlsec/src/OOXMLSigner.h
DesktopEditor/xmlsec/src/OOXMLSigner.h
+1
-1
DesktopEditor/xmlsec/src/XmlRels.h
DesktopEditor/xmlsec/src/XmlRels.h
+25
-2
DesktopEditor/xmlsec/src/XmlTransform.h
DesktopEditor/xmlsec/src/XmlTransform.h
+86
-2
No files found.
DesktopEditor/xmlsec/src/OOXMLSigner.h
View file @
24e55018
...
...
@@ -99,7 +99,7 @@ public:
std
::
wstring
GetRelsReference
(
const
std
::
wstring
&
file
)
{
COOXMLRelationships
oRels
(
m_sFolder
+
file
);
COOXMLRelationships
oRels
(
m_sFolder
+
file
,
true
);
if
(
L"/_rels/.rels"
==
file
)
{
...
...
DesktopEditor/xmlsec/src/XmlRels.h
View file @
24e55018
...
...
@@ -67,12 +67,35 @@ public:
{
}
COOXMLRelationships
(
const
std
::
wstring
&
file
,
std
::
map
<
std
::
wstring
,
bool
>*
check_need
=
NULL
)
COOXMLRelationships
(
const
std
::
string
&
xml
,
std
::
map
<
std
::
wstring
,
bool
>*
check_need
=
NULL
)
{
XmlUtils
::
CXmlNode
oNode
;
if
(
!
oNode
.
FromXml
File
(
file
))
if
(
!
oNode
.
FromXml
StringA
(
xml
))
return
;
FromXmlNode
(
oNode
,
check_need
);
}
COOXMLRelationships
(
const
std
::
wstring
&
xml
,
const
bool
&
is_file
,
std
::
map
<
std
::
wstring
,
bool
>*
check_need
=
NULL
)
{
XmlUtils
::
CXmlNode
oNode
;
if
(
!
is_file
)
{
if
(
!
oNode
.
FromXmlString
(
xml
))
return
;
}
else
{
if
(
!
oNode
.
FromXmlFile
(
xml
))
return
;
}
FromXmlNode
(
oNode
,
check_need
);
}
void
FromXmlNode
(
XmlUtils
::
CXmlNode
&
oNode
,
std
::
map
<
std
::
wstring
,
bool
>*
check_need
=
NULL
)
{
XmlUtils
::
CXmlNodes
oNodes
;
if
(
!
oNode
.
GetNodes
(
L"Relationship"
,
oNodes
))
return
;
...
...
DesktopEditor/xmlsec/src/XmlTransform.h
View file @
24e55018
...
...
@@ -20,6 +20,8 @@ public:
public:
virtual
std
::
string
Transform
(
const
std
::
string
&
sXml
)
=
0
;
virtual
void
LoadFromXml
(
XmlUtils
::
CXmlNode
&
node
)
=
0
;
static
IXmlTransform
*
GetFromType
(
const
std
::
string
&
alg
);
};
class
CXmlTransformRelationship
:
public
IXmlTransform
...
...
@@ -33,9 +35,9 @@ public:
m_algorithm
=
"http://schemas.openxmlformats.org/package/2006/RelationshipTransform"
;
}
virtual
std
::
string
Transform
(
const
std
::
wstring
&
sFile
)
virtual
std
::
string
Transform
(
const
std
::
string
&
xml
)
{
COOXMLRelationships
_rels
(
sFile
,
&
m_arIds
);
COOXMLRelationships
_rels
(
xml
,
&
m_arIds
);
return
U_TO_UTF8
(
_rels
.
GetXml
());
}
...
...
@@ -57,4 +59,86 @@ public:
}
};
class
CXmlTransformC14N
:
public
IXmlTransform
{
protected:
int
m_mode
;
bool
m_comments
;
public:
CXmlTransformC14N
()
:
IXmlTransform
()
{
m_mode
=
-
1
;
m_comments
=
false
;
}
bool
CheckC14NTransform
(
const
std
::
string
&
alg
)
{
m_mode
=
-
1
;
if
(
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
==
alg
)
{
m_mode
=
XML_C14N_1_0
;
m_comments
=
false
;
}
else
if
(
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"
==
alg
)
{
m_mode
=
XML_C14N_1_0
;
m_comments
=
true
;
}
else
if
(
"http://www.w3.org/2006/12/xml-c14n11"
==
alg
)
{
m_mode
=
XML_C14N_1_1
;
m_comments
=
false
;
}
else
if
(
"http://www.w3.org/2006/12/xml-c14n11#WithComments"
==
alg
)
{
m_mode
=
XML_C14N_1_1
;
m_comments
=
true
;
}
else
if
(
"http://www.w3.org/2001/10/xml-exc-c14n#"
==
alg
)
{
m_mode
=
XML_C14N_EXCLUSIVE_1_0
;
m_comments
=
false
;
}
else
if
(
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
==
alg
)
{
m_mode
=
XML_C14N_EXCLUSIVE_1_0
;
m_comments
=
true
;
}
return
(
-
1
!=
m_mode
)
?
true
:
false
;
}
virtual
std
::
string
Transform
(
const
std
::
string
&
xml
)
{
// TODO
return
xml
;
}
virtual
void
LoadFromXml
(
XmlUtils
::
CXmlNode
&
node
)
{
// none
XML_UNUSED
(
node
);
}
};
IXmlTransform
*
IXmlTransform
::
GetFromType
(
const
std
::
string
&
alg
)
{
if
(
true
)
{
CXmlTransformRelationship
*
transform
=
new
CXmlTransformRelationship
();
if
(
transform
->
m_algorithm
==
alg
)
return
transform
;
RELEASEOBJECT
(
transform
);
}
if
(
true
)
{
CXmlTransformC14N
*
transform
=
new
CXmlTransformC14N
();
if
(
transform
->
CheckC14NTransform
(
alg
))
return
transform
;
RELEASEOBJECT
(
transform
);
}
return
NULL
;
}
#endif //_XML_TRANSFORM_H_
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