summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslkey_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qsslkey_p.h')
-rw-r--r--src/network/ssl/qsslkey_p.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h
index 54d12d76fb..d24606e6a6 100644
--- a/src/network/ssl/qsslkey_p.h
+++ b/src/network/ssl/qsslkey_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNetwork module of the Qt Toolkit.
@@ -40,8 +40,8 @@
****************************************************************************/
-#ifndef QSSLKEY_P_H
-#define QSSLKEY_P_H
+#ifndef QSSLKEY_OPENSSL_P_H
+#define QSSLKEY_OPENSSL_P_H
#include "qsslkey.h"
@@ -58,8 +58,10 @@
#include "qsslsocket_p.h" // includes wincrypt.h
+#ifndef QT_NO_OPENSSL
#include <openssl/rsa.h>
#include <openssl/dsa.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -67,9 +69,11 @@ class QSslKeyPrivate
{
public:
inline QSslKeyPrivate()
- : rsa(0)
+ : opaque(0)
+#ifndef QT_NO_OPENSSL
+ , rsa(0)
, dsa(0)
- , opaque(0)
+#endif
{
clear();
}
@@ -79,19 +83,42 @@ public:
void clear(bool deep = true);
+#ifndef QT_NO_OPENSSL
+ bool fromEVP_PKEY(EVP_PKEY *pkey);
+#endif
+ void decodeDer(const QByteArray &der, bool deepClear = true);
void decodePem(const QByteArray &pem, const QByteArray &passPhrase,
bool deepClear = true);
QByteArray pemHeader() const;
QByteArray pemFooter() const;
- QByteArray pemFromDer(const QByteArray &der) const;
- QByteArray derFromPem(const QByteArray &pem) const;
+ QByteArray pemFromDer(const QByteArray &der, const QMap<QByteArray, QByteArray> &headers) const;
+ QByteArray derFromPem(const QByteArray &pem, QMap<QByteArray, QByteArray> *headers) const;
+
+ int length() const;
+ QByteArray toPem(const QByteArray &passPhrase) const;
+ Qt::HANDLE handle() const;
bool isNull;
QSsl::KeyType type;
QSsl::KeyAlgorithm algorithm;
+#ifndef QT_NO_OPENSSL
+ EVP_PKEY *opaque;
RSA *rsa;
DSA *dsa;
- EVP_PKEY *opaque;
+#else
+ enum Cipher {
+ DesCbc,
+ DesEde3Cbc,
+ Rc2Cbc
+ };
+
+ Q_AUTOTEST_EXPORT static QByteArray decrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv);
+ Q_AUTOTEST_EXPORT static QByteArray encrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv);
+
+ Qt::HANDLE opaque;
+ QByteArray derData;
+ int keyLength;
+#endif
QAtomicInt ref;
@@ -101,4 +128,4 @@ private:
QT_END_NAMESPACE
-#endif // QSSLKEY_P_H
+#endif // QSSLKEY_OPENSSL_P_H