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
a505ae39
Commit
a505ae39
authored
Jun 16, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verify cert (openssl only)
parent
c3898019
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
1 deletion
+43
-1
DesktopEditor/xmlsec/src/include/XmlCertificate.h
DesktopEditor/xmlsec/src/include/XmlCertificate.h
+2
-0
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
+7
-1
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
+5
-0
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
+27
-0
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
+2
-0
No files found.
DesktopEditor/xmlsec/src/include/XmlCertificate.h
View file @
a505ae39
...
...
@@ -12,6 +12,7 @@
#define OPEN_SSL_WARNING_ERR 1
#define OPEN_SSL_WARNING_ALL_OK 2
#define OPEN_SSL_WARNING_PASS 4
#define OPEN_SSL_WARNING_NOVERIFY 8
class
ICertificate
;
class
Q_DECL_EXPORT
ICertificateSelectDialogOpenSsl
...
...
@@ -102,6 +103,7 @@ public:
virtual
std
::
string
GetDate
()
=
0
;
virtual
std
::
string
GetId
()
=
0
;
virtual
int
VerifySelf
()
=
0
;
public:
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
)
=
0
;
...
...
DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp
View file @
a505ae39
...
...
@@ -249,6 +249,12 @@ public:
if
(
!
m_cert
->
Verify
(
sSignatureCalcValue
,
sSignatureValue
,
nSignatureMethod
))
m_valid
=
OOXML_SIGNATURE_INVALID
;
else
{
int
nCertVerify
=
m_cert
->
VerifySelf
();
if
(
OPEN_SSL_WARNING_NOVERIFY
==
nCertVerify
)
m_valid
=
OOXML_SIGNATURE_INVALID
;
}
}
XmlUtils
::
CXmlNode
GetObjectById
(
std
::
string
sId
)
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_mscrypto.h
View file @
a505ae39
...
...
@@ -131,6 +131,11 @@ public:
return
GetNumber
();
}
virtual
int
VerifySelf
()
{
return
OPEN_SSL_WARNING_OK
;
}
public:
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
)
{
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
View file @
a505ae39
...
...
@@ -328,6 +328,7 @@ public:
RELEASEARRAYOBJECTS
(
pData
);
return
(
NULL
==
m_cert
)
?
false
:
true
;
}
return
false
;
}
...
...
@@ -424,6 +425,27 @@ public:
m_pDialog
=
pDialog
;
}
int
VerifySelf
()
{
if
(
NULL
==
m_cert
)
return
OPEN_SSL_WARNING_NOVERIFY
;
X509_STORE_CTX
*
ctx
=
X509_STORE_CTX_new
();
X509_STORE
*
store
=
X509_STORE_new
();
X509_STORE_add_cert
(
store
,
m_cert
);
X509_STORE_CTX_init
(
ctx
,
store
,
m_cert
,
NULL
);
int
status
=
X509_verify_cert
(
ctx
);
int
nErr
=
X509_STORE_CTX_get_error
(
ctx
);
std
::
string
sErr
(
X509_verify_cert_error_string
(
nErr
));
X509_STORE_free
(
store
);
X509_STORE_CTX_free
(
ctx
);
return
(
1
==
status
)
?
OPEN_SSL_WARNING_OK
:
OPEN_SSL_WARNING_NOVERIFY
;
}
protected:
tm
ASN1_GetTimeT
(
ASN1_TIME
*
time
)
{
...
...
@@ -716,6 +738,11 @@ std::string CCertificate_openssl::GetId()
return
m_internal
->
GetId
();
}
int
CCertificate_openssl
::
VerifySelf
()
{
return
m_internal
->
VerifySelf
();
}
std
::
string
CCertificate_openssl
::
Sign
(
const
std
::
string
&
sXml
)
{
return
m_internal
->
Sign
(
sXml
);
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
View file @
a505ae39
...
...
@@ -26,6 +26,8 @@ public:
virtual
std
::
string
GetId
();
virtual
int
VerifySelf
();
public:
virtual
std
::
string
Sign
(
const
std
::
string
&
sXml
);
...
...
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