summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-01 15:21:41 +0200
committermadmaxoft <github@xoft.cz>2014-05-01 15:21:41 +0200
commit1587b21edded56dbfb88150500336c2853b460c6 (patch)
tree544cd9d1aece0e7902739b30a75e372506d775fa /src/HTTPServer
parentFixed crashes in the SSL HTTP connection. (diff)
downloadcuberite-1587b21edded56dbfb88150500336c2853b460c6.tar
cuberite-1587b21edded56dbfb88150500336c2853b460c6.tar.gz
cuberite-1587b21edded56dbfb88150500336c2853b460c6.tar.bz2
cuberite-1587b21edded56dbfb88150500336c2853b460c6.tar.lz
cuberite-1587b21edded56dbfb88150500336c2853b460c6.tar.xz
cuberite-1587b21edded56dbfb88150500336c2853b460c6.tar.zst
cuberite-1587b21edded56dbfb88150500336c2853b460c6.zip
Diffstat (limited to 'src/HTTPServer')
-rw-r--r--src/HTTPServer/HTTPServer.cpp6
-rw-r--r--src/HTTPServer/HTTPServer.h6
-rw-r--r--src/HTTPServer/SslHTTPConnection.cpp2
-rw-r--r--src/HTTPServer/SslHTTPConnection.h8
4 files changed, 11 insertions, 11 deletions
diff --git a/src/HTTPServer/HTTPServer.cpp b/src/HTTPServer/HTTPServer.cpp
index 9e3e0a17b..c45044c66 100644
--- a/src/HTTPServer/HTTPServer.cpp
+++ b/src/HTTPServer/HTTPServer.cpp
@@ -124,17 +124,17 @@ class cDebugCallbacks :
cHTTPServer::cHTTPServer(void) :
m_ListenThreadIPv4(*this, cSocket::IPv4, "WebServer IPv4"),
m_ListenThreadIPv6(*this, cSocket::IPv6, "WebServer IPv6"),
- m_Callbacks(NULL),
- m_Cert(new cX509Cert),
- m_CertPrivKey(new cPublicKey)
+ m_Callbacks(NULL)
{
AString CertFile = cFile::ReadWholeFile("webadmin/httpscert.crt");
AString KeyFile = cFile::ReadWholeFile("webadmin/httpskey.pem");
if (!CertFile.empty() && !KeyFile.empty())
{
+ m_Cert.reset(new cX509Cert);
int res = m_Cert->Parse(CertFile.data(), CertFile.size());
if (res == 0)
{
+ m_CertPrivKey.reset(new cCryptoKey);
int res2 = m_CertPrivKey->ParsePrivate(KeyFile.data(), KeyFile.size(), "");
if (res2 != 0)
{
diff --git a/src/HTTPServer/HTTPServer.h b/src/HTTPServer/HTTPServer.h
index eb91dd5a3..522b7da62 100644
--- a/src/HTTPServer/HTTPServer.h
+++ b/src/HTTPServer/HTTPServer.h
@@ -13,7 +13,7 @@
#include "../OSSupport/SocketThreads.h"
#include "inifile/iniFile.h"
#include "PolarSSL++/RsaPrivateKey.h"
-#include "PolarSSL++/PublicKey.h"
+#include "PolarSSL++/CryptoKey.h"
#include "PolarSSL++/X509Cert.h"
@@ -85,8 +85,8 @@ protected:
/** The server certificate to use for the SSL connections */
cX509CertPtr m_Cert;
- /** The private key for m_Cert. Despite the class name, this is the PRIVATE key. */
- cPublicKeyPtr m_CertPrivKey;
+ /** The private key for m_Cert. */
+ cCryptoKeyPtr m_CertPrivKey;
// cListenThread::cCallback overrides:
diff --git a/src/HTTPServer/SslHTTPConnection.cpp b/src/HTTPServer/SslHTTPConnection.cpp
index b6b222b47..d237089d9 100644
--- a/src/HTTPServer/SslHTTPConnection.cpp
+++ b/src/HTTPServer/SslHTTPConnection.cpp
@@ -11,7 +11,7 @@
-cSslHTTPConnection::cSslHTTPConnection(cHTTPServer & a_HTTPServer, const cX509CertPtr & a_Cert, const cPublicKeyPtr & a_PrivateKey) :
+cSslHTTPConnection::cSslHTTPConnection(cHTTPServer & a_HTTPServer, const cX509CertPtr & a_Cert, const cCryptoKeyPtr & a_PrivateKey) :
super(a_HTTPServer),
m_Ssl(64000),
m_Cert(a_Cert),
diff --git a/src/HTTPServer/SslHTTPConnection.h b/src/HTTPServer/SslHTTPConnection.h
index 653acbfce..c2c1585cd 100644
--- a/src/HTTPServer/SslHTTPConnection.h
+++ b/src/HTTPServer/SslHTTPConnection.h
@@ -22,9 +22,9 @@ class cSslHTTPConnection :
typedef cHTTPConnection super;
public:
- /** Creates a new connection on the specified server; sends the specified cert as the server certificate,
- uses the private key for decryption. a_Private key is, despite the class name, a PRIVATE key for the cert. */
- cSslHTTPConnection(cHTTPServer & a_HTTPServer, const cX509CertPtr & a_Cert, const cPublicKeyPtr & a_PrivateKey);
+ /** Creates a new connection on the specified server.
+ Sends the specified cert as the server certificate, uses the private key for decryption. */
+ cSslHTTPConnection(cHTTPServer & a_HTTPServer, const cX509CertPtr & a_Cert, const cCryptoKeyPtr & a_PrivateKey);
protected:
cBufferedSslContext m_Ssl;
@@ -33,7 +33,7 @@ protected:
cX509CertPtr m_Cert;
/** The private key used for the certificate */
- cPublicKeyPtr m_PrivateKey;
+ cCryptoKeyPtr m_PrivateKey;
// cHTTPConnection overrides:
virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client