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
6fc6f9ea
Commit
6fc6f9ea
authored
Jun 14, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://github.com/ONLYOFFICE/core
into develop
parents
270c1fa2
f76a03fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
+11
-0
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
+61
-0
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
+3
-0
No files found.
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
View file @
6fc6f9ea
...
@@ -16,11 +16,13 @@ int ICertificateSelectDialogOpenSsl::LoadCert(std::wstring file, std::string pas
...
@@ -16,11 +16,13 @@ int ICertificateSelectDialogOpenSsl::LoadCert(std::wstring file, std::string pas
#if defined(_LINUX) && !defined(_MAC)
#if defined(_LINUX) && !defined(_MAC)
#include "./XmlSigner_openssl.h"
#include "./XmlSigner_openssl.h"
#define XML_CERTIFICATE_USE_OPENSSL
#define CCertificate CCertificate_openssl
#define CCertificate CCertificate_openssl
#endif
#endif
#ifdef _MAC
#ifdef _MAC
#include "./XmlSigner_openssl.h"
#include "./XmlSigner_openssl.h"
#define XML_CERTIFICATE_USE_OPENSSL
#define CCertificate CCertificate_openssl
#define CCertificate CCertificate_openssl
#endif
#endif
...
@@ -118,5 +120,14 @@ ICertificate* ICertificate::GetById(const std::string& id)
...
@@ -118,5 +120,14 @@ ICertificate* ICertificate::GetById(const std::string& id)
CertCloseStore
(
hStoreHandle
,
0
);
CertCloseStore
(
hStoreHandle
,
0
);
#endif
#endif
#ifdef XML_CERTIFICATE_USE_OPENSSL
CCertificate_openssl
*
pCertificate
=
(
CCertificate_openssl
*
)
CreateInstance
();
if
(
pCertificate
->
FromId
(
id
))
return
pCertificate
;
delete
pCertificate
;
#endif
return
NULL
;
return
NULL
;
}
}
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
View file @
6fc6f9ea
...
@@ -50,6 +50,9 @@ protected:
...
@@ -50,6 +50,9 @@ protected:
X509
*
m_cert
;
X509
*
m_cert
;
EVP_PKEY
*
m_key
;
EVP_PKEY
*
m_key
;
std
::
string
m_separator
;
std
::
string
m_id
;
public:
public:
ICertificate
*
m_pBase
;
ICertificate
*
m_pBase
;
...
@@ -62,6 +65,7 @@ public:
...
@@ -62,6 +65,7 @@ public:
m_key
=
NULL
;
m_key
=
NULL
;
m_pBase
=
NULL
;
m_pBase
=
NULL
;
m_separator
=
";;;;;;;ONLYOFFICE;;;;;;;"
;
}
}
virtual
~
CCertificate_openssl_private
()
virtual
~
CCertificate_openssl_private
()
{
{
...
@@ -175,6 +179,8 @@ public:
...
@@ -175,6 +179,8 @@ public:
std
::
string
GetId
()
std
::
string
GetId
()
{
{
// TODO: + public key?
// TODO: + public key?
if
(
!
m_id
.
empty
())
return
m_id
;
return
GetNumber
();
return
GetNumber
();
}
}
...
@@ -309,6 +315,14 @@ public:
...
@@ -309,6 +315,14 @@ public:
std
::
wstring
sCertPasswordW
=
m_pDialog
->
GetCertificatePassword
();
std
::
wstring
sCertPasswordW
=
m_pDialog
->
GetCertificatePassword
();
std
::
string
sCertPassword
=
U_TO_UTF8
(
sCertPasswordW
);
std
::
string
sCertPassword
=
U_TO_UTF8
(
sCertPasswordW
);
return
FromFiles
(
sKeyPath
,
sKeyPassword
,
sCertPath
,
sCertPassword
);
}
bool
FromFiles
(
const
std
::
wstring
&
sKeyPath
,
const
std
::
string
&
sKeyPassword
,
const
std
::
wstring
&
certPath
,
const
std
::
string
&
certPassword
)
{
std
::
wstring
sCertPath
=
certPath
;
std
::
string
sCertPassword
=
certPassword
;
if
(
sCertPath
.
empty
())
if
(
sCertPath
.
empty
())
{
{
sCertPath
=
sKeyPath
;
sCertPath
=
sKeyPath
;
...
@@ -325,8 +339,45 @@ public:
...
@@ -325,8 +339,45 @@ public:
if
(
nErr
!=
OPEN_SSL_WARNING_OK
&&
nErr
!=
OPEN_SSL_WARNING_ALL_OK
)
if
(
nErr
!=
OPEN_SSL_WARNING_OK
&&
nErr
!=
OPEN_SSL_WARNING_ALL_OK
)
return
false
;
return
false
;
m_id
=
U_TO_UTF8
(
sKeyPath
);
m_id
+=
m_separator
;
m_id
+=
sKeyPassword
;
m_id
+=
m_separator
;
m_id
+=
U_TO_UTF8
(
sCertPath
);
m_id
+=
m_separator
;
m_id
+=
sCertPassword
;
return
true
;
return
true
;
}
}
bool
FromKey
(
const
std
::
string
&
sId
)
{
std
::
string
id
=
sId
;
std
::
vector
<
std
::
string
>
arr
;
size_t
pos
=
0
;
while
((
pos
=
id
.
find
(
m_separator
))
!=
std
::
string
::
npos
)
{
arr
.
push_back
(
id
.
substr
(
0
,
pos
));
id
.
erase
(
0
,
pos
+
m_separator
.
length
());
}
if
(
!
id
.
empty
())
arr
.
push_back
(
id
);
if
(
4
!=
arr
.
size
())
return
false
;
std
::
string
sKeyPathA
=
arr
[
0
];
std
::
string
sKeyPasswordA
=
arr
[
1
];
std
::
string
sCertPathA
=
arr
[
2
];
std
::
string
sCertPasswordA
=
arr
[
3
];
std
::
wstring
sKeyPath
=
UTF8_TO_U
(
sKeyPathA
);
std
::
wstring
sCertPath
=
UTF8_TO_U
(
sCertPathA
);
return
FromFiles
(
sKeyPath
,
sKeyPasswordA
,
sCertPath
,
sCertPasswordA
);
}
int
ShowCertificate
()
int
ShowCertificate
()
{
{
if
(
m_pDialog
)
if
(
m_pDialog
)
...
@@ -671,6 +722,16 @@ int CCertificate_openssl::ShowCertificate()
...
@@ -671,6 +722,16 @@ int CCertificate_openssl::ShowCertificate()
return
m_internal
->
ShowCertificate
();
return
m_internal
->
ShowCertificate
();
}
}
bool
CCertificate_openssl
::
FromFiles
(
const
std
::
wstring
&
keyPath
,
const
std
::
string
&
keyPassword
,
const
std
::
wstring
&
certPath
,
const
std
::
string
&
certPassword
)
{
return
m_internal
->
FromFiles
(
keyPath
,
keyPassword
,
certPath
,
certPassword
);
}
bool
CCertificate_openssl
::
FromId
(
const
std
::
string
&
id
)
{
return
m_internal
->
FromKey
(
id
);
}
void
CCertificate_openssl
::
SetOpenSslDialog
(
ICertificateSelectDialogOpenSsl
*
pDialog
)
void
CCertificate_openssl
::
SetOpenSslDialog
(
ICertificateSelectDialogOpenSsl
*
pDialog
)
{
{
return
m_internal
->
SetOpenSslDialog
(
pDialog
);
return
m_internal
->
SetOpenSslDialog
(
pDialog
);
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.h
View file @
6fc6f9ea
...
@@ -43,6 +43,9 @@ public:
...
@@ -43,6 +43,9 @@ public:
virtual
bool
ShowSelectDialog
();
virtual
bool
ShowSelectDialog
();
virtual
int
ShowCertificate
();
virtual
int
ShowCertificate
();
bool
FromFiles
(
const
std
::
wstring
&
keyPath
,
const
std
::
string
&
keyPassword
,
const
std
::
wstring
&
certPath
,
const
std
::
string
&
certPassword
);
bool
FromId
(
const
std
::
string
&
id
);
virtual
void
SetOpenSslDialog
(
ICertificateSelectDialogOpenSsl
*
pDialog
);
virtual
void
SetOpenSslDialog
(
ICertificateSelectDialogOpenSsl
*
pDialog
);
};
};
...
...
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