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