From fb78247bc355c9af5f905a79958694a18d04014e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Mon, 31 Mar 2014 09:41:44 +0000 Subject: [PATCH] some minor changes accorfing o what's really needed/supported; refs #28 --- src/cardgui.cxx | 6 +++++- src/cardos.hxx | 20 ++++++++++---------- src/suisseid.hxx | 20 ++++++++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/cardgui.cxx b/src/cardgui.cxx index 010e231..36af331 100644 --- a/src/cardgui.cxx +++ b/src/cardgui.cxx @@ -10,7 +10,11 @@ #include #include -#include +#if QT_VERSION >= 0x050000 +#include +#else +#include +#endif int main(int argc, char** argv) { QApplication app(argc, argv); diff --git a/src/cardos.hxx b/src/cardos.hxx index 6f458ea..8cf39bd 100644 --- a/src/cardos.hxx +++ b/src/cardos.hxx @@ -1084,37 +1084,37 @@ namespace cardos { //@{ /// Path to MF - std::string mf() { - return crypto::hexToBin("3f00"); + static std::string mf() { + return "3f00"; } /// Path to PKCS#15 - std::string pkcs15() { - return crypto::hexToBin("5015"); + static std::string pkcs15() { + return mf()+"5015"; } /// Path to SigG (Signaturgesetz) - std::string sigG() { - return crypto::hexToBin("1fff"); + static std::string sigG() { + return mf()+"1fff"; } /// ID of transport PIN - unsigned char transportPin() { + static unsigned char transportPin() { return 0x71; } /// ID of PKCS#15 user PIN - unsigned char pkcs15Pin() { + static unsigned char pkcs15Pin() { return 0x01; } /// ID of SigG (Signaturgesetz) secure PIN - unsigned char sigGPin() { + static unsigned char sigGPin() { return 0x01; } /// ID of PUK to unlock PKCS#15 user PIN - unsigned char puk() { + static unsigned char puk() { return 0x02; } diff --git a/src/suisseid.hxx b/src/suisseid.hxx index d276dc8..5e12200 100644 --- a/src/suisseid.hxx +++ b/src/suisseid.hxx @@ -173,9 +173,9 @@ namespace suisseid { /** @note by now, only @c MISSING and @c VALID is supported */ enum CertStatus { MISSING, ///< certificate is missing, needs initiatlization - EXPIRES_SOON, ///< certificate will soon expire, needs renewal - EXPIRED, ///< certificate is expired, needs new purchase - REVOKED, ///< certificate has been revoked and is invalid + // EXPIRES_SOON, ///< certificate will soon expire, needs renewal + // EXPIRED, ///< certificate is expired, needs new purchase + // REVOKED, ///< certificate has been revoked and is invalid VALID ///< certificate is valid }; @@ -311,11 +311,15 @@ namespace suisseid { } virtual CertStatus certStatus() { - cryptoki::ObjectList certs - (session().find(cryptoki::Attribute(CKA_CLASS) - .from(CKO_CERTIFICATE))); - if (certs.size()==0) return MISSING; - return VALID; + try { + Certificate auth(authenticationCertificate()); + Certificate sig(digitalSignatureCertificate()); + return VALID; + } catch (const no_auth& x) { + return MISSING; + } catch (const no_digsig& x) { + return MISSING; + } } virtual Certificate authenticationCertificate() try {