tdecore
tdecryptographiccarddevice.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _TDECRYPTOGRAPHICCARDDEVICE_H
00020 #define _TDECRYPTOGRAPHICCARDDEVICE_H
00021
00022 #include "ksslconfig.h"
00023 #include "tdegenericdevice.h"
00024
00025 #ifndef _TDECRYPTOGRAPHICCARDDEVICE_INTERNAL
00026 #ifdef KSSL_HAVE_SSL
00027 typedef struct x509_st X509;
00028 #else
00029 struct X509;
00030 #endif
00031 #endif
00032
00033 class TQEventLoopThread;
00034 class CryptoCardDeviceWatcher;
00035
00036 typedef TQValueList<X509*> X509CertificatePtrList;
00037 typedef TQValueListIterator<X509*> X509CertificatePtrListIterator;
00038
00039 class TDECORE_EXPORT TDECryptographicCardDevice : public TDEGenericDevice
00040 {
00041 Q_OBJECT
00042
00043 public:
00048 TDECryptographicCardDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
00049
00053 ~TDECryptographicCardDevice();
00054
00059 void enableCardMonitoring(bool enable);
00060
00073 void enablePINEntryCallbacks(bool enable);
00074
00081 int cardPresent();
00082
00088 TQString cardATR();
00089
00098 X509CertificatePtrList cardX509Certificates();
00099
00107 void setProvidedPin(TQString pin);
00108
00117 TQString autoPIN();
00118
00130 int decryptDataEncryptedWithCertPublicKey(TQByteArray &ciphertext, TQByteArray &plaintext, TQString *errstr=NULL);
00131
00144 int decryptDataEncryptedWithCertPublicKey(TQValueList<TQByteArray> &cipherTextList, TQValueList<TQByteArray> &plainTextList, TQValueList<int> &retcodes, TQString *errstr);
00145
00154 static int createNewSecretRSAKeyFromCertificate(TQByteArray &plaintext, TQByteArray &ciphertext, X509* certificate);
00155
00159 static TQString pkcsProviderLibrary();
00160
00161 public slots:
00162 void cardStatusChanged(TQString status, TQString atr);
00163 void workerRequestedPin(TQString prompt);
00164
00165 signals:
00166 void cardInserted(TDECryptographicCardDevice*);
00167 void cardRemoved(TDECryptographicCardDevice*);
00168 void certificateListAvailable(TDECryptographicCardDevice*);
00169 void pinRequested(TQString prompt, TDECryptographicCardDevice* cdevice);
00170
00171 private:
00172 TQEventLoopThread *m_watcherThread;
00173 CryptoCardDeviceWatcher *m_watcherObject;
00174
00175 bool m_cardPresent;
00176 TQString m_cardATR;
00177 X509CertificatePtrList m_cardCertificates;
00178
00179 friend class TDEHardwareDevices;
00180 friend class CryptoCardDeviceWatcher;
00181 };
00182
00183 #endif // _TDECRYPTOGRAPHICCARDDEVICE_H