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
01ba3b41
Commit
01ba3b41
authored
Jun 14, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openssl signing bugs
parent
ddb67584
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
23 deletions
+40
-23
DesktopEditor/xmlsec/src/include/XmlCertificate.h
DesktopEditor/xmlsec/src/include/XmlCertificate.h
+1
-8
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
+9
-0
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
+30
-15
No files found.
DesktopEditor/xmlsec/src/include/XmlCertificate.h
View file @
01ba3b41
...
@@ -121,14 +121,7 @@ public:
...
@@ -121,14 +121,7 @@ public:
static
CCertificateInfo
GetDefault
();
static
CCertificateInfo
GetDefault
();
static
ICertificate
*
GetById
(
const
std
::
string
&
id
);
static
ICertificate
*
GetById
(
const
std
::
string
&
id
);
virtual
CCertificateInfo
GetInfo
()
virtual
CCertificateInfo
GetInfo
();
{
CCertificateInfo
info
;
info
.
SetName
(
GetSignerName
());
info
.
SetDate
(
GetDate
());
info
.
SetId
(
GetId
());
return
info
;
}
public:
public:
static
int
GetOOXMLHashAlg
(
const
std
::
string
&
sAlg
);
static
int
GetOOXMLHashAlg
(
const
std
::
string
&
sAlg
);
...
...
DesktopEditor/xmlsec/src/src/XmlCertificate.cpp
View file @
01ba3b41
...
@@ -50,6 +50,15 @@ ICertificate* ICertificate::CreateInstance()
...
@@ -50,6 +50,15 @@ ICertificate* ICertificate::CreateInstance()
return
pCert
;
return
pCert
;
}
}
CCertificateInfo
ICertificate
::
GetInfo
()
{
CCertificateInfo
info
;
info
.
SetName
(
GetSignerName
());
info
.
SetDate
(
GetDate
());
info
.
SetId
(
GetId
());
return
info
;
}
CCertificateInfo
ICertificate
::
GetDefault
()
CCertificateInfo
ICertificate
::
GetDefault
()
{
{
CCertificateInfo
info
;
CCertificateInfo
info
;
...
...
DesktopEditor/xmlsec/src/src/XmlSigner_openssl.cpp
View file @
01ba3b41
...
@@ -25,6 +25,22 @@ void BIO_FREE(BIO*& bio)
...
@@ -25,6 +25,22 @@ void BIO_FREE(BIO*& bio)
bio
=
NULL
;
bio
=
NULL
;
}
}
}
}
void
EVP_PKEY_FREE
(
EVP_PKEY
*&
key
)
{
if
(
key
)
{
EVP_PKEY_free
(
key
);
key
=
NULL
;
}
}
void
X509_FREE
(
X509
*&
cert
)
{
if
(
cert
)
{
X509_free
(
cert
);
cert
=
NULL
;
}
}
class
CCertificate_openssl_private
class
CCertificate_openssl_private
{
{
...
@@ -50,9 +66,9 @@ public:
...
@@ -50,9 +66,9 @@ public:
virtual
~
CCertificate_openssl_private
()
virtual
~
CCertificate_openssl_private
()
{
{
if
(
NULL
!=
m_cert
)
if
(
NULL
!=
m_cert
)
X509_
free
(
m_cert
);
X509_
FREE
(
m_cert
);
if
(
NULL
!=
m_key
)
if
(
NULL
!=
m_key
)
EVP_PKEY_
free
(
m_key
);
EVP_PKEY_
FREE
(
m_key
);
}
}
public:
public:
...
@@ -76,7 +92,6 @@ public:
...
@@ -76,7 +92,6 @@ public:
std
::
string
sReturn
(
tmp
);
std
::
string
sReturn
(
tmp
);
BN_free
(
bn
);
BN_free
(
bn
);
ASN1_INTEGER_free
(
asn1_serial
);
return
sReturn
;
return
sReturn
;
}
}
...
@@ -87,12 +102,13 @@ public:
...
@@ -87,12 +102,13 @@ public:
return
L""
;
return
L""
;
X509_NAME
*
name
=
X509_get_issuer_name
(
m_cert
);
X509_NAME
*
name
=
X509_get_issuer_name
(
m_cert
);
char
*
utf_8_name
=
X509_NAME_oneline
(
name
,
NULL
,
0
);
char
buffer
[
1024
];
memset
(
buffer
,
0
,
1025
);
std
::
string
sName
(
utf_8_name
);
X509_NAME_oneline
(
name
,
buffer
,
1024
);
std
::
wstring
sNameW
=
UTF8_TO_U
(
sName
);
OPENSSL_free
(
utf_8_name
);
std
::
string
sName
(
buffer
);
std
::
wstring
sNameW
=
UTF8_TO_U
(
sName
);
return
sNameW
;
return
sNameW
;
}
}
...
@@ -137,11 +153,9 @@ public:
...
@@ -137,11 +153,9 @@ public:
ASN1_TIME
*
_time1
=
X509_get_notBefore
(
m_cert
);
ASN1_TIME
*
_time1
=
X509_get_notBefore
(
m_cert
);
struct
tm
t1
=
this
->
ASN1_GetTimeT
(
_time1
);
struct
tm
t1
=
this
->
ASN1_GetTimeT
(
_time1
);
ASN1_TIME_free
(
_time1
);
ASN1_TIME
*
_time2
=
X509_get_notAfter
(
m_cert
);
ASN1_TIME
*
_time2
=
X509_get_notAfter
(
m_cert
);
struct
tm
t2
=
this
->
ASN1_GetTimeT
(
_time2
);
struct
tm
t2
=
this
->
ASN1_GetTimeT
(
_time2
);
ASN1_TIME_free
(
_time2
);
std
::
string
sRet
=
std
::
to_string
(
t1
.
tm_mday
)
+
std
::
string
sRet
=
std
::
to_string
(
t1
.
tm_mday
)
+
"/"
+
"/"
+
...
@@ -154,6 +168,7 @@ public:
...
@@ -154,6 +168,7 @@ public:
std
::
to_string
(
t2
.
tm_mon
+
1
)
+
std
::
to_string
(
t2
.
tm_mon
+
1
)
+
"/"
+
"/"
+
std
::
to_string
(
t2
.
tm_year
+
1900
);
std
::
to_string
(
t2
.
tm_year
+
1900
);
return
sRet
;
return
sRet
;
}
}
...
@@ -246,7 +261,7 @@ public:
...
@@ -246,7 +261,7 @@ public:
n3
=
n3
;
n3
=
n3
;
EVP_MD_CTX_destroy
(
pCtx
);
EVP_MD_CTX_destroy
(
pCtx
);
EVP_PKEY_
free
(
pubkey
);
EVP_PKEY_
FREE
(
pubkey
);
RELEASEARRAYOBJECTS
(
pDigestValue
);
RELEASEARRAYOBJECTS
(
pDigestValue
);
...
@@ -268,7 +283,7 @@ public:
...
@@ -268,7 +283,7 @@ public:
}
}
else
else
{
{
X509_
free
(
pCert
);
X509_
FREE
(
pCert
);
m_cert
=
NULL
;
m_cert
=
NULL
;
}
}
...
@@ -450,7 +465,7 @@ public:
...
@@ -450,7 +465,7 @@ public:
if
(
PKCS12_parse
(
p12
,
pPassword
,
&
pKey
,
&
pCert
,
&
pCa
))
if
(
PKCS12_parse
(
p12
,
pPassword
,
&
pKey
,
&
pCert
,
&
pCa
))
{
{
sk_X509_pop_free
(
pCa
,
X509_free
);
sk_X509_pop_free
(
pCa
,
X509_free
);
X509_
free
(
pCert
);
X509_
FREE
(
pCert
);
PKCS12_free
(
p12
);
PKCS12_free
(
p12
);
nErr
=
OPEN_SSL_WARNING_ALL_OK
;
nErr
=
OPEN_SSL_WARNING_ALL_OK
;
goto
end
;
goto
end
;
...
@@ -467,7 +482,7 @@ public:
...
@@ -467,7 +482,7 @@ public:
end:
end:
if
(
NULL
==
ppKey
)
if
(
NULL
==
ppKey
)
EVP_PKEY_
free
(
pKey
);
EVP_PKEY_
FREE
(
pKey
);
else
else
*
ppKey
=
pKey
;
*
ppKey
=
pKey
;
...
@@ -535,7 +550,7 @@ end:
...
@@ -535,7 +550,7 @@ end:
if
(
PKCS12_parse
(
p12
,
pPassword
,
&
pKey
,
&
pCert
,
&
pCa
))
if
(
PKCS12_parse
(
p12
,
pPassword
,
&
pKey
,
&
pCert
,
&
pCa
))
{
{
sk_X509_pop_free
(
pCa
,
X509_free
);
sk_X509_pop_free
(
pCa
,
X509_free
);
EVP_PKEY_
free
(
pKey
);
EVP_PKEY_
FREE
(
pKey
);
PKCS12_free
(
p12
);
PKCS12_free
(
p12
);
BIO_FREE
(
bio
);
BIO_FREE
(
bio
);
nErr
=
OPEN_SSL_WARNING_ALL_OK
;
nErr
=
OPEN_SSL_WARNING_ALL_OK
;
...
@@ -553,7 +568,7 @@ end:
...
@@ -553,7 +568,7 @@ end:
end:
end:
if
(
NULL
==
ppCert
)
if
(
NULL
==
ppCert
)
X509_
free
(
pCert
);
X509_
FREE
(
pCert
);
else
else
*
ppCert
=
pCert
;
*
ppCert
=
pCert
;
...
...
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