SilentEye 0.4.1

modules/secryptoaes/secryptoaes.h

Go to the documentation of this file.
00001 //  This file is part of SilentEye.
00002 //
00003 //  SilentEye is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  SilentEye is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with SilentEye.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 #ifndef SECRYPTOAES_H_
00017 #define SECRYPTOAES_H_
00018 
00019 #include <QtCore>
00020 #include <QtCrypto>
00021 #include <cryptomoduleinterface.h>
00022 #include <logger.h>
00023 
00024 #ifdef QT_STATICPLUGIN
00025     Q_IMPORT_PLUGIN(qca_ossl)
00026 #endif
00027 
00028 using namespace SilentEyeFramework;
00029 
00031 namespace SECryptoAES {
00032 
00033     class SECryptoAES : public CryptoModuleInterface
00034     {
00035         Q_OBJECT;
00036         Q_INTERFACES(SilentEyeFramework::CryptoModuleInterface);
00037 
00038     private:
00039         QPointer<Logger> m_logger;
00040         bool m_isQcaCompatible;
00041         QCA::SymmetricKey m_key;
00042         QCA::Initializer* m_init;
00043 
00044     public:
00045         SECryptoAES();
00046         ~SECryptoAES();
00047 
00048         QString name() const;
00049         QString version() const;
00050         QString status();
00051 
00052         QString typeSupported() const ;
00053         QPointer<EncodedData> encode(QString key, QPointer<EncodedData> msg);
00054         QPointer<EncodedData> decode(QString key, QPointer<EncodedData> data);
00055 
00056     private:
00057         void init();
00058         QCA::SecureArray initializationVector(QString);
00059     };
00060 }
00061 
00062 #endif