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
d0591483
Commit
d0591483
authored
May 17, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'develop' and 'develop' of
https://github.com/ONLYOFFICE/core
into develop
parents
729f9f24
17a6ba73
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
14 deletions
+119
-14
DesktopEditor/xmlsec/src/include/XmlCertificate.h
DesktopEditor/xmlsec/src/include/XmlCertificate.h
+4
-4
DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp
DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp
+2
-1
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
+4
-2
DesktopEditor/xmlsec/src/src/XmlRels.h
DesktopEditor/xmlsec/src/src/XmlRels.h
+1
-1
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
+4
-4
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
+101
-0
DesktopEditor/xmlsec/test/windows_list_serts/main.cpp
DesktopEditor/xmlsec/test/windows_list_serts/main.cpp
+3
-2
No files found.
DesktopEditor/xmlsec/src/include/XmlCertificate.h
View file @
d0591483
...
...
@@ -27,11 +27,11 @@ public:
virtual
std
::
string
GetCertificateHash
()
=
0
;
public:
virtual
std
::
string
Sign
(
std
::
string
sXml
)
=
0
;
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
)
=
0
;
virtual
std
::
string
GetHash
(
unsigned
char
*
pData
,
unsigned
int
nSize
,
int
nAlg
)
=
0
;
virtual
std
::
string
GetHash
(
std
::
string
&
sXml
,
int
nAlg
)
=
0
;
virtual
std
::
string
GetHash
(
std
::
wstring
&
sXmlFile
,
int
nAlg
)
=
0
;
virtual
bool
Verify
(
std
::
string
&
sXml
,
std
::
string
&
sXmlSignature
,
int
nAlg
)
=
0
;
virtual
std
::
string
GetHash
(
const
std
::
string
&
sXml
,
int
nAlg
)
=
0
;
virtual
std
::
string
GetHash
(
const
std
::
wstring
&
sXmlFile
,
int
nAlg
)
=
0
;
virtual
bool
Verify
(
const
std
::
string
&
sXml
,
std
::
string
&
sXmlSignature
,
int
nAlg
)
=
0
;
virtual
bool
LoadFromBase64Data
(
const
std
::
string
&
data
)
=
0
;
...
...
DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp
View file @
d0591483
...
...
@@ -40,7 +40,8 @@ public:
std
::
wstring
sXml
=
L"<Reference URI=
\"
"
+
file
+
L"?ContentType="
+
content_type
+
L"
\"
>"
;
sXml
+=
L"<DigestMethod Algorithm=
\"
http://www.w3.org/2000/09/xmldsig#sha1
\"
/>"
;
sXml
+=
L"<DigestValue>"
;
sXml
+=
UTF8_TO_U
(
m_certificate
->
GetHash
(
m_sFolder
+
file
,
OOXML_HASH_ALG_SHA1
));
std
::
string
sTmp
=
m_certificate
->
GetHash
(
m_sFolder
+
file
,
OOXML_HASH_ALG_SHA1
);
sXml
+=
UTF8_TO_U
(
sTmp
);
sXml
+=
L"</DigestValue>"
;
sXml
+=
L"</Reference>"
;
return
sXml
;
...
...
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
View file @
d0591483
...
...
@@ -4,11 +4,13 @@
#endif
#if defined(_LINUX) && !defined(_MAC)
#include "./XmlSigner_openssl.h"
#define CCertificate CCertificate_openssl
#endif
#ifdef _MAC
#include "./XmlSigner_openssl.h"
#define CCertificate CCertificate_openssl
#endif
int
ICertificate
::
GetOOXMLHashAlg
(
const
std
::
string
&
sAlg
)
...
...
DesktopEditor/xmlsec/src/src/XmlRels.h
View file @
d0591483
...
...
@@ -154,7 +154,7 @@ public:
return
builder
.
GetData
();
}
void
CheckOriginSigs
(
std
::
wstring
&
file
)
void
CheckOriginSigs
(
const
std
::
wstring
&
file
)
{
int
rId
=
0
;
std
::
vector
<
COOXMLRelationship
>::
iterator
i
=
rels
.
begin
();
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
View file @
d0591483
...
...
@@ -100,7 +100,7 @@ public:
}
public:
virtual
std
::
string
Sign
(
std
::
string
sXml
)
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
)
{
BOOL
bResult
=
TRUE
;
DWORD
dwKeySpec
=
0
;
...
...
@@ -240,12 +240,12 @@ public:
return
sReturn
;
}
virtual
std
::
string
GetHash
(
std
::
string
&
sXml
,
int
nAlg
)
virtual
std
::
string
GetHash
(
const
std
::
string
&
sXml
,
int
nAlg
)
{
return
GetHash
((
BYTE
*
)
sXml
.
c_str
(),
(
DWORD
)
sXml
.
length
(),
nAlg
);
}
virtual
std
::
string
GetHash
(
std
::
wstring
&
sXmlFile
,
int
nAlg
)
virtual
std
::
string
GetHash
(
const
std
::
wstring
&
sXmlFile
,
int
nAlg
)
{
BYTE
*
pFileData
=
NULL
;
DWORD
dwFileDataLen
=
0
;
...
...
@@ -260,7 +260,7 @@ public:
return
sReturn
;
}
virtual
bool
Verify
(
std
::
string
&
sXml
,
std
::
string
&
sXmlSignature
,
int
nAlg
)
virtual
bool
Verify
(
const
std
::
string
&
sXml
,
std
::
string
&
sXmlSignature
,
int
nAlg
)
{
DWORD
dwKeySpec
=
0
;
HCRYPTHASH
hHash
=
NULL
;
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
0 → 100644
View file @
d0591483
#ifndef _XMLSIGNER_OPENSSL_H_
#define _XMLSIGNER_OPENSSL_H_
#include "./include/XmlCertificate.h"
#include "../../../common/File.h"
#include "../../../common/BigInteger.h"
class
CCertificate_openssl
:
public
ICertificate
{
public:
protected:
BYTE
*
m_rawData
;
int
m_rawDataLen
;
public:
CCertificate_openssl
()
:
ICertificate
()
{
m_rawData
=
NULL
;
m_rawDataLen
=
0
;
}
virtual
~
CCertificate_openssl
()
{
}
public:
virtual
std
::
string
GetNumber
()
{
return
""
;
}
virtual
std
::
wstring
GetSignerName
()
{
return
L""
;
}
virtual
std
::
string
GetCertificateBase64
()
{
return
""
;
}
virtual
std
::
string
GetCertificateHash
()
{
return
""
;
}
public:
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
)
{
return
""
;
}
virtual
std
::
string
GetHash
(
unsigned
char
*
pData
,
unsigned
int
nSize
,
int
nAlg
)
{
return
""
;
}
virtual
std
::
string
GetHash
(
const
std
::
string
&
sXml
,
int
nAlg
)
{
return
GetHash
((
BYTE
*
)
sXml
.
c_str
(),
(
DWORD
)
sXml
.
length
(),
nAlg
);
}
virtual
std
::
string
GetHash
(
const
std
::
wstring
&
sXmlFile
,
int
nAlg
)
{
BYTE
*
pFileData
=
NULL
;
DWORD
dwFileDataLen
=
0
;
NSFile
::
CFileBinary
::
ReadAllBytes
(
sXmlFile
,
&
pFileData
,
dwFileDataLen
);
if
(
0
==
dwFileDataLen
)
return
""
;
std
::
string
sReturn
=
GetHash
(
pFileData
,
dwFileDataLen
,
nAlg
);
RELEASEARRAYOBJECTS
(
pFileData
);
return
sReturn
;
}
virtual
bool
Verify
(
const
std
::
string
&
sXml
,
std
::
string
&
sXmlSignature
,
int
nAlg
)
{
return
false
;
}
virtual
bool
LoadFromBase64Data
(
const
std
::
string
&
data
)
{
return
false
;
}
virtual
int
ShowCertificate
()
{
return
1
;
}
public:
virtual
bool
ShowSelectDialog
()
{
return
false
;
}
};
#endif // _XMLSIGNER_OPENSSL_H_
DesktopEditor/xmlsec/test/windows_list_serts/main.cpp
View file @
d0591483
...
...
@@ -4,7 +4,7 @@
#include "../../../common/File.h"
void
main
(
void
)
int
main
(
void
)
{
//std::wstring sFolderOOOXML = NSFile::GetProcessDirectory() + L"/ImageStamp";
//std::wstring sSignId = L"{39B6B9C7-60AD-45A2-9F61-40C74A24042E}";
...
...
@@ -19,7 +19,7 @@ void main(void)
if
(
!
pCertificate
->
ShowSelectDialog
())
{
RELEASEOBJECT
(
pCertificate
);
return
;
return
0
;
}
COOXMLSigner
oOOXMLSigner
(
sFolderOOXML
,
pCertificate
);
...
...
@@ -45,4 +45,5 @@ void main(void)
nRes
=
nRes
;
}
}
return
0
;
}
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