| @@ -2,6 +2,7 @@ | |||||||
| #define SMARTCARDAUTH_H | #define SMARTCARDAUTH_H | ||||||
|  |  | ||||||
| #include <QtCore/QMutex> | #include <QtCore/QMutex> | ||||||
|  | #include <QtCore/QWaitCondition> | ||||||
| #include <QtNetwork/QSslSocket> | #include <QtNetwork/QSslSocket> | ||||||
| #include <QtNetwork/QSslConfiguration> | #include <QtNetwork/QSslConfiguration> | ||||||
| #include <QtNetwork/QSslCertificate> | #include <QtNetwork/QSslCertificate> | ||||||
| @@ -67,10 +68,14 @@ class CryptokiEngine: public QObject, public openssl::Engine { | |||||||
|            "IbUmHIXt6oHLJmoGFX46bCcfil5eE5FXfiaw7Q9iPw==\n" |            "IbUmHIXt6oHLJmoGFX46bCcfil5eE5FXfiaw7Q9iPw==\n" | ||||||
|            "-----END RSA PRIVATE KEY-----\n"); |            "-----END RSA PRIVATE KEY-----\n"); | ||||||
|         QSslKey privkey(pem, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); |         QSslKey privkey(pem, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); | ||||||
|         RSA* rsa(0); |         RSA* rsa((RSA*)privkey.handle()); | ||||||
|         rsa = (RSA*)privkey.handle(); |         if (!ENGINE_init(_e)) return; | ||||||
|         if (rsa) RSA_free(rsa); |         rsa->engine=_e; | ||||||
|         rsa = RSA_new_method(_e); |         rsa->meth=ENGINE_get_RSA(_e); | ||||||
|  |         if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, rsa, &rsa->ex_data)) { | ||||||
|  |           ENGINE_finish(_e); | ||||||
|  |           return; | ||||||
|  |         } | ||||||
|         set(rsa->n, privateKey, CKA_MODULUS, "CKA_MODULUS"); |         set(rsa->n, privateKey, CKA_MODULUS, "CKA_MODULUS"); | ||||||
|         set(rsa->e, privateKey, CKA_PUBLIC_EXPONENT, "CKA_PUBLIC_EXPONENT"); |         set(rsa->e, privateKey, CKA_PUBLIC_EXPONENT, "CKA_PUBLIC_EXPONENT"); | ||||||
|         set(rsa->d, privateKey, CKA_PRIVATE_EXPONENT, "CKA_PRIVATE_EXPONENT"); |         set(rsa->d, privateKey, CKA_PRIVATE_EXPONENT, "CKA_PRIVATE_EXPONENT"); | ||||||
| @@ -81,7 +86,7 @@ class CryptokiEngine: public QObject, public openssl::Engine { | |||||||
|         set(rsa->iqmp, privateKey, CKA_COEFFICIENT, "CKA_COEFFICIENT"); |         set(rsa->iqmp, privateKey, CKA_COEFFICIENT, "CKA_COEFFICIENT"); | ||||||
|         rsa->flags |= RSA_FLAG_SIGN_VER; // don't emulate with encrypt/decrypt |         rsa->flags |= RSA_FLAG_SIGN_VER; // don't emulate with encrypt/decrypt | ||||||
|         assert(!privkey.isNull()); |         assert(!privkey.isNull()); | ||||||
|         assert(rsa==(RSA*)privkey.handle()); |         OPENSSL_LOG("Setup RSA finished"); | ||||||
|         sslConfig.setPrivateKey(privkey); |         sslConfig.setPrivateKey(privkey); | ||||||
|         QSslConfiguration::setDefaultConfiguration(sslConfig); |         QSslConfiguration::setDefaultConfiguration(sslConfig); | ||||||
|       } catch (const std::exception& e) { |       } catch (const std::exception& e) { | ||||||
|   | |||||||
| @@ -679,12 +679,12 @@ p, li { white-space: pre-wrap; } | |||||||
| <context> | <context> | ||||||
|     <name>QMessageBox</name> |     <name>QMessageBox</name> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="217"/> |         <location filename="smartcardauth.hxx" line="222"/> | ||||||
|         <source>Wrong PIN</source> |         <source>Wrong PIN</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="218"/> |         <location filename="smartcardauth.hxx" line="223"/> | ||||||
|         <source>Authentication failed, please try again.</source> |         <source>Authentication failed, please try again.</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|   | |||||||
| @@ -664,12 +664,12 @@ p, li { white-space: pre-wrap; } | |||||||
| <context> | <context> | ||||||
|     <name>QMessageBox</name> |     <name>QMessageBox</name> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="217"/> |         <location filename="smartcardauth.hxx" line="222"/> | ||||||
|         <source>Wrong PIN</source> |         <source>Wrong PIN</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="218"/> |         <location filename="smartcardauth.hxx" line="223"/> | ||||||
|         <source>Authentication failed, please try again.</source> |         <source>Authentication failed, please try again.</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|   | |||||||
| @@ -679,12 +679,12 @@ p, li { white-space: pre-wrap; } | |||||||
| <context> | <context> | ||||||
|     <name>QMessageBox</name> |     <name>QMessageBox</name> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="217"/> |         <location filename="smartcardauth.hxx" line="222"/> | ||||||
|         <source>Wrong PIN</source> |         <source>Wrong PIN</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="218"/> |         <location filename="smartcardauth.hxx" line="223"/> | ||||||
|         <source>Authentication failed, please try again.</source> |         <source>Authentication failed, please try again.</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|   | |||||||
| @@ -679,12 +679,12 @@ p, li { white-space: pre-wrap; } | |||||||
| <context> | <context> | ||||||
|     <name>QMessageBox</name> |     <name>QMessageBox</name> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="217"/> |         <location filename="smartcardauth.hxx" line="222"/> | ||||||
|         <source>Wrong PIN</source> |         <source>Wrong PIN</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="smartcardauth.hxx" line="218"/> |         <location filename="smartcardauth.hxx" line="223"/> | ||||||
|         <source>Authentication failed, please try again.</source> |         <source>Authentication failed, please try again.</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user