diff --git a/swisssurfer/src/pinentry.hxx b/swisssurfer/src/pinentry.hxx
index b9c3f1b..8d2a2d5 100644
--- a/swisssurfer/src/pinentry.hxx
+++ b/swisssurfer/src/pinentry.hxx
@@ -40,6 +40,11 @@ class PinEntry: public QDialog, public Ui::PinEntry {
_issuerCa->setVisible(_issuerCa->text().size());
_issuerCaLabel->setVisible(_issuerCa->text().size());
}
+ PinEntry& retries(int num) {
+ _pinstatus->setCurrentIndex(num==-1?1:(num==-2?2:0));
+ _retries->setText(tr("there are %1 PIN attempts left").arg(num));
+ return *this;
+ }
QString pin() const {
return _pin->text();
}
diff --git a/swisssurfer/src/pinentry.ui b/swisssurfer/src/pinentry.ui
index 8fddc66..92c8a22 100644
--- a/swisssurfer/src/pinentry.ui
+++ b/swisssurfer/src/pinentry.ui
@@ -6,8 +6,8 @@
0
0
- 351
- 369
+ 435
+ 412
@@ -23,7 +23,7 @@
- Please enter your Certificate PIN to authenticate:
+ Please enter your PIN to unlock Certificate:
true
@@ -159,31 +159,77 @@
-
+
+ QFormLayout::ExpandingFieldsGrow
+
-
-
-
-
- 0
- 0
-
-
-
- You have %1 tries left
-
-
- true
+
+
+ 2
-
-
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+
+
+
-
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Serif'; font-size:11pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:24pt; color:#00b900;">✔</span></p></body></html>
-
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ there are %1 PIN attempts left
+
+
+ true
+
+
+
+
+
+
+
+ -
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu Serif'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-size:24pt; color:#ff0000;">✘</span></p></body></html>
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ certificate is bad or locked
+
+
+ true
+
+
+
+
+
+
diff --git a/swisssurfer/src/qmake.pro.in b/swisssurfer/src/qmake.pro.in
index ffbd932..f85c72e 100644
--- a/swisssurfer/src/qmake.pro.in
+++ b/swisssurfer/src/qmake.pro.in
@@ -5,6 +5,8 @@ QMAKE_LIBS += -lproxyface -lcryptoki++ -lssl -lcrypto
unix {
!macx {
CONFIG += debug
+ QMAKE_INCDIR += /usr/include/PCSC
+ QMAKE_INCDIR += /usr/local/include/PCSC
}
}
macx {
diff --git a/swisssurfer/src/smartcardauth.hxx b/swisssurfer/src/smartcardauth.hxx
index da0d6a6..6286aa6 100644
--- a/swisssurfer/src/smartcardauth.hxx
+++ b/swisssurfer/src/smartcardauth.hxx
@@ -11,6 +11,7 @@
#include
#include
+#include
#include
#include
@@ -56,20 +57,13 @@ class CryptokiEngine: public QObject, public openssl::Engine {
QByteArray pem // empty dummy key for qt object instantiation
("-----BEGIN RSA PRIVATE KEY-----\n"
- "MIIBOwIBAAJBAMH2yqAGeVNPdgeZ2GoHo"
- "31m9aUxZ7QfK2Go2qLTahLpQ3UL1C8G\n"
- "LkuMS8SNK0ZGfRMalIpIhv6bW5l3kjogO"
- "ncCAwEAAQJABVGECtFCoGMsZFb2lSmy\n"
- "dOzOzYHGSy0TnnDn1dEgNnZ8sIljElPtU"
- "zm9dyXs2P3ICL1sOd7qjpzfJeyxknDL\n"
- "AQIhAO5iKdLmhyuW+EDEH19vDs1Pmqs3/"
- "ZnT5UgUiJnTJqz3AiEA0ExIfUOCnxq2\n"
- "a3Z46KEivcr8JB2P9VqouBbVryiq/oECI"
- "QDj8bPCejMoiEzMSX0iWWTTB9qC/KAg\n"
- "FtF4skHIrXKfEwIgPCs86Uo+Ch2aQjKHv"
- "JMHSRHAgeI0OmiEwiB+e0lhE4ECIQDd\n"
- "IbUmHIXt6oHLJmoGFX46bCcfil5eE5FXf"
- "iaw7Q9iPw==\n"
+ "MIIBOwIBAAJBAMH2yqAGeVNPdgeZ2GoHo31m9aUxZ7QfK2Go2qLTahLpQ3UL1C8G\n"
+ "LkuMS8SNK0ZGfRMalIpIhv6bW5l3kjogOncCAwEAAQJABVGECtFCoGMsZFb2lSmy\n"
+ "dOzOzYHGSy0TnnDn1dEgNnZ8sIljElPtUzm9dyXs2P3ICL1sOd7qjpzfJeyxknDL\n"
+ "AQIhAO5iKdLmhyuW+EDEH19vDs1Pmqs3/ZnT5UgUiJnTJqz3AiEA0ExIfUOCnxq2\n"
+ "a3Z46KEivcr8JB2P9VqouBbVryiq/oECIQDj8bPCejMoiEzMSX0iWWTTB9qC/KAg\n"
+ "FtF4skHIrXKfEwIgPCs86Uo+Ch2aQjKHvJMHSRHAgeI0OmiEwiB+e0lhE4ECIQDd\n"
+ "IbUmHIXt6oHLJmoGFX46bCcfil5eE5FXfiaw7Q9iPw==\n"
"-----END RSA PRIVATE KEY-----\n");
QSslKey privkey(pem, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
RSA* rsa(0);
@@ -200,7 +194,8 @@ class SmartCardAuth: public QObject {
PinEntry pinEntry(QSslCertificate(QByteArray(c.data.data(),
c.data.size()),
QSsl::Der), _parent);
- while (pinEntry.exec()==PinEntry::Accepted)
+ while (pinEntry.retries(retries(c.slot->slotinfo().slotDescription))
+ .exec()==PinEntry::Accepted)
try {
_session = // session login with pin
std::auto_ptr
@@ -227,6 +222,42 @@ class SmartCardAuth: public QObject {
throw;
}
}
+
+ private:
+
+ int retries(const std::string& name) try {
+ qDebug()<<__PRETTY_FUNCTION__<=2)
+ return ((((unsigned int)(unsigned char)res[res.size()-2])*256)
+ +((unsigned int)(unsigned char)res[res.size()-1]));
+ else
+ return -1;
+ }
private:
diff --git a/swisssurfer/src/swisssurfer_de.ts b/swisssurfer/src/swisssurfer_de.ts
index 05e1225..32df3bd 100644
--- a/swisssurfer/src/swisssurfer_de.ts
+++ b/swisssurfer/src/swisssurfer_de.ts
@@ -510,8 +510,8 @@ Compiled: qt-%5
-
- Please enter your SwissSign Certificate PIN to authenticate yourself:
+
+ Please enter your Certificate PIN to authenticate:
@@ -565,12 +565,27 @@ Compiled: qt-%5
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
- Please enter your Certificate PIN to authenticate:
- Please enter your SwissSign Certificate PIN to authenticate yourself:
+ Please enter your PIN to unlock Certificate:
+ Please enter your Certificate PIN to authenticate:
@@ -565,12 +565,27 @@ Compiled: qt-%5
-
- You have %1 tries left
+
+
+ there are %1 PIN attempts left
-
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu Serif'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-size:24pt; color:#ff0000;">✘</span></p></body></html>
+
+
+
+
+ certificate is bad or locked
+
+
+
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -582,12 +597,12 @@ p, li { white-space: pre-wrap; }
QMessageBox
-
+
Wrong PIN
-
+
Authentication failed, please try again.
diff --git a/swisssurfer/src/swisssurfer_fr.ts b/swisssurfer/src/swisssurfer_fr.ts
index 05e1225..32df3bd 100644
--- a/swisssurfer/src/swisssurfer_fr.ts
+++ b/swisssurfer/src/swisssurfer_fr.ts
@@ -510,8 +510,8 @@ Compiled: qt-%5
- Please enter your Certificate PIN to authenticate:
- Please enter your SwissSign Certificate PIN to authenticate yourself:
+ Please enter your PIN to unlock Certificate:
+ Please enter your Certificate PIN to authenticate:
@@ -565,12 +565,27 @@ Compiled: qt-%5
-
- You have %1 tries left
+
+
+ there are %1 PIN attempts left
-
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu Serif'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-size:24pt; color:#ff0000;">✘</span></p></body></html>
+
+
+
+
+ certificate is bad or locked
+
+
+
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -582,12 +597,12 @@ p, li { white-space: pre-wrap; }
QMessageBox
-
+
Wrong PIN
-
+
Authentication failed, please try again.
diff --git a/swisssurfer/src/swisssurfer_it.ts b/swisssurfer/src/swisssurfer_it.ts
index 05e1225..32df3bd 100644
--- a/swisssurfer/src/swisssurfer_it.ts
+++ b/swisssurfer/src/swisssurfer_it.ts
@@ -510,8 +510,8 @@ Compiled: qt-%5
- Please enter your Certificate PIN to authenticate:
- Please enter your SwissSign Certificate PIN to authenticate yourself:
+ Please enter your PIN to unlock Certificate:
+ Please enter your Certificate PIN to authenticate:
@@ -565,12 +565,27 @@ Compiled: qt-%5
-
- You have %1 tries left
+
+
+ there are %1 PIN attempts left
-
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu Serif'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-size:24pt; color:#ff0000;">✘</span></p></body></html>
+
+
+
+
+ certificate is bad or locked
+
+
+
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -582,12 +597,12 @@ p, li { white-space: pre-wrap; }
QMessageBox
-
+
Wrong PIN
-
+
Authentication failed, please try again.