QT3 -> QT4
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@5 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
192dbba0e4
commit
28c71dfe1e
|
@ -28,10 +28,10 @@ class CEntry{
|
||||||
public:
|
public:
|
||||||
CEntry();
|
CEntry();
|
||||||
~CEntry();
|
~CEntry();
|
||||||
UINT8 ID[16];
|
Q_UINT8 ID[16];
|
||||||
UINT32 sID;
|
Q_UINT32 sID;
|
||||||
UINT32 GroupID;
|
Q_UINT32 GroupID;
|
||||||
UINT32 ImageID;
|
Q_UINT32 ImageID;
|
||||||
QString Title;
|
QString Title;
|
||||||
QString URL;
|
QString URL;
|
||||||
QString UserName;
|
QString UserName;
|
||||||
|
@ -42,10 +42,10 @@ CPwmTime Creation;
|
||||||
CPwmTime LastMod;
|
CPwmTime LastMod;
|
||||||
CPwmTime LastAccess;
|
CPwmTime LastAccess;
|
||||||
CPwmTime Expire;
|
CPwmTime Expire;
|
||||||
UINT8 *pBinaryData;
|
Q_UINT8 *pBinaryData;
|
||||||
UINT32 BinaryDataLength;
|
Q_UINT32 BinaryDataLength;
|
||||||
UINT32 PasswordLength;
|
Q_UINT32 PasswordLength;
|
||||||
bool ReadEntryField(UINT16 FieldType, UINT32 FieldSize, UINT8 *pData);
|
bool ReadEntryField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,17 +53,17 @@ class CGroup{
|
||||||
public:
|
public:
|
||||||
CGroup();
|
CGroup();
|
||||||
~CGroup();
|
~CGroup();
|
||||||
UINT32 ID;
|
Q_UINT32 ID;
|
||||||
UINT32 ImageID;
|
Q_UINT32 ImageID;
|
||||||
UINT32 NumEntries;
|
Q_UINT32 NumEntries;
|
||||||
QString Name;
|
QString Name;
|
||||||
CPwmTime Creation;
|
CPwmTime Creation;
|
||||||
CPwmTime LastMod;
|
CPwmTime LastMod;
|
||||||
CPwmTime LastAccess;
|
CPwmTime LastAccess;
|
||||||
CPwmTime Expire;
|
CPwmTime Expire;
|
||||||
UINT16 Level;
|
Q_UINT16 Level;
|
||||||
UINT32 Flags;
|
Q_UINT32 Flags;
|
||||||
bool ReadGroupField(UINT16 FieldType, UINT32 FieldSize, UINT8 *pData);
|
bool ReadGroupField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pData);
|
||||||
|
|
||||||
bool UI_ItemIsExpanded;
|
bool UI_ItemIsExpanded;
|
||||||
static bool UI_ExpandByDefault;
|
static bool UI_ExpandByDefault;
|
||||||
|
@ -85,15 +85,15 @@ public:
|
||||||
|
|
||||||
class Database:public AbstractDatabase{
|
class Database:public AbstractDatabase{
|
||||||
public:
|
public:
|
||||||
UINT32 CryptoAlgorithmus;
|
Q_UINT32 CryptoAlgorithmus;
|
||||||
UINT32 KeyEncRounds;
|
Q_UINT32 KeyEncRounds;
|
||||||
QString filename;
|
QString filename;
|
||||||
bool modflag;
|
bool modflag;
|
||||||
int SearchGroupID;
|
int SearchGroupID;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UINT8 MasterKey[32];
|
Q_UINT8 MasterKey[32];
|
||||||
UINT8 TransformedMasterKey[32];
|
Q_UINT8 TransformedMasterKey[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -20,61 +20,61 @@
|
||||||
#include "ListViews.h"
|
#include "ListViews.h"
|
||||||
#include "PwManager.h"
|
#include "PwManager.h"
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qlistview.h>
|
#include <q3listview.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListView * parent ) : QListViewItem(parent)
|
GroupItem::GroupItem(CGroup* group, Q3ListView * parent ) : Q3ListViewItem(parent)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListViewItem * parent ): QListViewItem(parent)
|
GroupItem::GroupItem(CGroup* group, Q3ListViewItem * parent ): Q3ListViewItem(parent)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListView * parent, QListViewItem * after ): QListViewItem(parent,after)
|
GroupItem::GroupItem(CGroup* group, Q3ListView * parent, Q3ListViewItem * after ): Q3ListViewItem(parent,after)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListViewItem * parent, QListViewItem * after ): QListViewItem(parent,after)
|
GroupItem::GroupItem(CGroup* group, Q3ListViewItem * parent, Q3ListViewItem * after ): Q3ListViewItem(parent,after)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListView* parent, QString l1,QString l2,QString l3,QString l4,
|
GroupItem::GroupItem(CGroup* group, Q3ListView* parent, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListViewItem* parent, QString l1,QString l2,QString l3,QString l4,
|
GroupItem::GroupItem(CGroup* group, Q3ListViewItem* parent, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListView* parent,QListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
GroupItem::GroupItem(CGroup* group, Q3ListView* parent,Q3ListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupItem::GroupItem(CGroup* group, QListViewItem* parent,QListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
GroupItem::GroupItem(CGroup* group, Q3ListViewItem* parent,Q3ListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pGroup=group;
|
pGroup=group;
|
||||||
setDropEnabled(true);
|
setDropEnabled(true);
|
||||||
|
@ -91,57 +91,57 @@ return true;
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListView * parent ) : QListViewItem(parent)
|
EntryItem::EntryItem(CEntry* entry, Q3ListView * parent ) : Q3ListViewItem(parent)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListViewItem * parent ): QListViewItem(parent)
|
EntryItem::EntryItem(CEntry* entry, Q3ListViewItem * parent ): Q3ListViewItem(parent)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListView * parent, QListViewItem * after ): QListViewItem(parent,after)
|
EntryItem::EntryItem(CEntry* entry, Q3ListView * parent, Q3ListViewItem * after ): Q3ListViewItem(parent,after)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListViewItem * parent, QListViewItem * after ): QListViewItem(parent,after)
|
EntryItem::EntryItem(CEntry* entry, Q3ListViewItem * parent, Q3ListViewItem * after ): Q3ListViewItem(parent,after)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListView* parent, QString l1,QString l2,QString l3,QString l4,
|
EntryItem::EntryItem(CEntry* entry, Q3ListView* parent, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListViewItem* parent, QString l1,QString l2,QString l3,QString l4,
|
EntryItem::EntryItem(CEntry* entry, Q3ListViewItem* parent, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListView* parent,QListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
EntryItem::EntryItem(CEntry* entry, Q3ListView* parent,Q3ListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryItem::EntryItem(CEntry* entry, QListViewItem* parent,QListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
EntryItem::EntryItem(CEntry* entry, Q3ListViewItem* parent,Q3ListViewItem* after, QString l1,QString l2,QString l3,QString l4,
|
||||||
QString l5,QString l6,QString l7,QString l8)
|
QString l5,QString l6,QString l7,QString l8)
|
||||||
:QListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
:Q3ListViewItem(parent,after,l1,l2,l3,l4,l5,l6,l7,l8)
|
||||||
{
|
{
|
||||||
pEntry=entry;
|
pEntry=entry;
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
|
@ -150,6 +150,6 @@ setDragEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CGroupView::CGroupView(QWidget * parent, const char * name, WFlags f):QListView(parent,name,f){
|
CGroupView::CGroupView(QWidget * parent, const char * name, Qt::WFlags f):Q3ListView(parent,name,f){
|
||||||
|
|
||||||
};
|
};
|
|
@ -20,39 +20,39 @@
|
||||||
#ifndef _LISTVIEWS_H_
|
#ifndef _LISTVIEWS_H_
|
||||||
#define _LISTVIEWS_H_
|
#define _LISTVIEWS_H_
|
||||||
|
|
||||||
#include <qlistview.h>
|
#include <q3listview.h>
|
||||||
#include <qmime.h>
|
#include <qmime.h>
|
||||||
#include "PwManager.h"
|
#include "PwManager.h"
|
||||||
|
|
||||||
class GroupItem: public QListViewItem{
|
class GroupItem: public Q3ListViewItem{
|
||||||
public:
|
public:
|
||||||
CGroup* pGroup;
|
CGroup* pGroup;
|
||||||
virtual bool acceptDrop(const QMimeSource * mime);
|
virtual bool acceptDrop(const QMimeSource * mime);
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
GroupItem(CGroup*, QListView * parent );
|
GroupItem(CGroup*, Q3ListView * parent );
|
||||||
GroupItem(CGroup*, QListViewItem * parent );
|
GroupItem(CGroup*, Q3ListViewItem * parent );
|
||||||
GroupItem(CGroup*, QListView * parent, QListViewItem * after );
|
GroupItem(CGroup*, Q3ListView * parent, Q3ListViewItem * after );
|
||||||
GroupItem(CGroup*, QListViewItem * parent, QListViewItem * after );
|
GroupItem(CGroup*, Q3ListViewItem * parent, Q3ListViewItem * after );
|
||||||
|
|
||||||
GroupItem(CGroup*, QListView * parent,
|
GroupItem(CGroup*, Q3ListView * parent,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
GroupItem(CGroup*, QListViewItem * parent,
|
GroupItem(CGroup*, Q3ListViewItem * parent,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
GroupItem(CGroup*, QListView * parent, QListViewItem * after,
|
GroupItem(CGroup*, Q3ListView * parent, Q3ListViewItem * after,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
GroupItem(CGroup*, QListViewItem * parent, QListViewItem * after,
|
GroupItem(CGroup*, Q3ListViewItem * parent, Q3ListViewItem * after,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
|
@ -62,34 +62,34 @@ virtual bool acceptDrop(const QMimeSource * mime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class EntryItem: public QListViewItem{
|
class EntryItem: public Q3ListViewItem{
|
||||||
public:
|
public:
|
||||||
CEntry* pEntry;
|
CEntry* pEntry;
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
EntryItem(CEntry*, QListView * parent );
|
EntryItem(CEntry*, Q3ListView * parent );
|
||||||
EntryItem(CEntry*, QListViewItem * parent );
|
EntryItem(CEntry*, Q3ListViewItem * parent );
|
||||||
EntryItem(CEntry*, QListView * parent, QListViewItem * after );
|
EntryItem(CEntry*, Q3ListView * parent, Q3ListViewItem * after );
|
||||||
EntryItem(CEntry*, QListViewItem * parent, QListViewItem * after );
|
EntryItem(CEntry*, Q3ListViewItem * parent, Q3ListViewItem * after );
|
||||||
|
|
||||||
EntryItem(CEntry*, QListView * parent,
|
EntryItem(CEntry*, Q3ListView * parent,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
EntryItem(CEntry*, QListViewItem * parent,
|
EntryItem(CEntry*, Q3ListViewItem * parent,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
EntryItem(CEntry*, QListView * parent, QListViewItem * after,
|
EntryItem(CEntry*, Q3ListView * parent, Q3ListViewItem * after,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null );
|
QString = QString::null, QString = QString::null );
|
||||||
|
|
||||||
EntryItem(CEntry*, QListViewItem * parent, QListViewItem * after,
|
EntryItem(CEntry*, Q3ListViewItem * parent, Q3ListViewItem * after,
|
||||||
QString, QString = QString::null,
|
QString, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
QString = QString::null, QString = QString::null,
|
QString = QString::null, QString = QString::null,
|
||||||
|
@ -98,9 +98,9 @@ CEntry* pEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CGroupView: public QListView{
|
class CGroupView: public Q3ListView{
|
||||||
public:
|
public:
|
||||||
CGroupView(QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
|
CGroupView(QWidget * parent = 0, const char * name = 0, Qt::WFlags f = 0 );
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,15 +36,15 @@
|
||||||
|
|
||||||
bool PwDatabase::loadDatabase(QString _filename, QString& err){
|
bool PwDatabase::loadDatabase(QString _filename, QString& err){
|
||||||
unsigned long total_size,crypto_size;
|
unsigned long total_size,crypto_size;
|
||||||
UINT32 Signature1,Signature2,Version,NumGroups,NumEntries,Flags;
|
Q_UINT32 Signature1,Signature2,Version,NumGroups,NumEntries,Flags;
|
||||||
UINT8 TrafoRandomSeed[32];
|
Q_UINT8 TrafoRandomSeed[32];
|
||||||
UINT8 FinalRandomSeed[16];
|
Q_UINT8 FinalRandomSeed[16];
|
||||||
UINT8 ContentsHash[32];
|
Q_UINT8 ContentsHash[32];
|
||||||
UINT8 EncryptionIV[16];
|
Q_UINT8 EncryptionIV[16];
|
||||||
|
|
||||||
filename=_filename;
|
filename=_filename;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(IO_ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
total_size=file.size();
|
total_size=file.size();
|
||||||
char* buffer = new char[total_size];
|
char* buffer = new char[total_size];
|
||||||
file.readBlock(buffer,total_size);
|
file.readBlock(buffer,total_size);
|
||||||
|
@ -83,7 +83,7 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
transformKey(MasterKey,TransformedMasterKey,TrafoRandomSeed,KeyEncRounds);
|
transformKey(MasterKey,TransformedMasterKey,TrafoRandomSeed,KeyEncRounds);
|
||||||
UINT8 FinalKey[32];
|
Q_UINT8 FinalKey[32];
|
||||||
sha256_context sha32;
|
sha256_context sha32;
|
||||||
sha256_starts(&sha32);
|
sha256_starts(&sha32);
|
||||||
sha256_update(&sha32,FinalRandomSeed, 16);
|
sha256_update(&sha32,FinalRandomSeed, 16);
|
||||||
|
@ -99,15 +99,15 @@ if(CryptoAlgorithmus == ALGO_AES)
|
||||||
{err=trUtf8("AES-Initialisierung fehlgeschlagen");
|
{err=trUtf8("AES-Initialisierung fehlgeschlagen");
|
||||||
return false;}
|
return false;}
|
||||||
// Decrypt! The first bytes aren't encrypted (that's the header)
|
// Decrypt! The first bytes aren't encrypted (that's the header)
|
||||||
crypto_size = (unsigned long)aes.padDecrypt((UINT8 *)buffer + DB_HEADER_SIZE,
|
crypto_size = (unsigned long)aes.padDecrypt((Q_UINT8 *)buffer + DB_HEADER_SIZE,
|
||||||
total_size - DB_HEADER_SIZE, (UINT8 *)buffer + DB_HEADER_SIZE);
|
total_size - DB_HEADER_SIZE, (Q_UINT8 *)buffer + DB_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
else if(CryptoAlgorithmus == ALGO_TWOFISH)
|
else if(CryptoAlgorithmus == ALGO_TWOFISH)
|
||||||
{
|
{
|
||||||
CTwofish twofish;
|
CTwofish twofish;
|
||||||
if(twofish.init(FinalKey, 32, EncryptionIV) != true){return false;}
|
if(twofish.init(FinalKey, 32, EncryptionIV) != true){return false;}
|
||||||
crypto_size = (unsigned long)twofish.padDecrypt((UINT8 *)buffer + DB_HEADER_SIZE,
|
crypto_size = (unsigned long)twofish.padDecrypt((Q_UINT8 *)buffer + DB_HEADER_SIZE,
|
||||||
total_size - DB_HEADER_SIZE, (UINT8 *)buffer + DB_HEADER_SIZE);
|
total_size - DB_HEADER_SIZE, (Q_UINT8 *)buffer + DB_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((crypto_size > 2147483446) || (crypto_size == 0)){err=trUtf8("Unerwarteter Wert für 'crypto_size'"); return false;}
|
if((crypto_size > 2147483446) || (crypto_size == 0)){err=trUtf8("Unerwarteter Wert für 'crypto_size'"); return false;}
|
||||||
|
@ -127,8 +127,8 @@ Entries.resize(NumEntries);
|
||||||
|
|
||||||
unsigned long tmp_id=0;
|
unsigned long tmp_id=0;
|
||||||
unsigned long pos = DB_HEADER_SIZE;
|
unsigned long pos = DB_HEADER_SIZE;
|
||||||
UINT16 FieldType;
|
Q_UINT16 FieldType;
|
||||||
UINT32 FieldSize;
|
Q_UINT32 FieldSize;
|
||||||
char* pField;
|
char* pField;
|
||||||
bool bRet;
|
bool bRet;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ bool bRet;
|
||||||
if(pos >= (total_size + FieldSize)) {
|
if(pos >= (total_size + FieldSize)) {
|
||||||
return false;}
|
return false;}
|
||||||
|
|
||||||
bRet = Groups[CurGroup].ReadGroupField(FieldType, FieldSize, (UINT8 *)pField);
|
bRet = Groups[CurGroup].ReadGroupField(FieldType, FieldSize, (Q_UINT8 *)pField);
|
||||||
if((FieldType == 0xFFFF) && (bRet == true)){
|
if((FieldType == 0xFFFF) && (bRet == true)){
|
||||||
CurGroup++;} // Now and ONLY now the counter gets increased
|
CurGroup++;} // Now and ONLY now the counter gets increased
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ bool bRet;
|
||||||
if(pos >= (total_size + FieldSize)) {
|
if(pos >= (total_size + FieldSize)) {
|
||||||
return false; }
|
return false; }
|
||||||
|
|
||||||
bRet = Entries[CurEntry].ReadEntryField(FieldType,FieldSize,(UINT8*)pField);
|
bRet = Entries[CurEntry].ReadEntryField(FieldType,FieldSize,(Q_UINT8*)pField);
|
||||||
if((FieldType == 0xFFFF) && (bRet == true)){
|
if((FieldType == 0xFFFF) && (bRet == true)){
|
||||||
Entries[CurEntry].sID=tmp_id++;
|
Entries[CurEntry].sID=tmp_id++;
|
||||||
CurEntry++;} // Now and ONLY now the counter gets increased
|
CurEntry++;} // Now and ONLY now the counter gets increased
|
||||||
|
@ -196,18 +196,18 @@ return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PwDatabase::transformKey(UINT8* src,UINT8* dst,UINT8* KeySeed,int rounds){
|
void PwDatabase::transformKey(Q_UINT8* src,Q_UINT8* dst,Q_UINT8* KeySeed,int rounds){
|
||||||
UINT8* tmp=new UINT8[32];
|
Q_UINT8* tmp=new Q_UINT8[32];
|
||||||
Rijndael rijndael;
|
Rijndael rijndael;
|
||||||
sha256_context sha2;
|
sha256_context sha2;
|
||||||
if(rijndael.init(Rijndael::ECB, Rijndael::Encrypt, (const UINT8 *)KeySeed,
|
if(rijndael.init(Rijndael::ECB, Rijndael::Encrypt, (const Q_UINT8 *)KeySeed,
|
||||||
Rijndael::Key32Bytes, 0) != RIJNDAEL_SUCCESS){
|
Rijndael::Key32Bytes, 0) != RIJNDAEL_SUCCESS){
|
||||||
cout << QString("unexpected error in %1, line %2").arg(__FILE__).arg(__LINE__) << endl;
|
cout << QString("unexpected error in %1, line %2").arg(__FILE__).arg(__LINE__).ascii() << endl;
|
||||||
exit(1);}
|
exit(1);}
|
||||||
|
|
||||||
memcpy(tmp,src,32);
|
memcpy(tmp,src,32);
|
||||||
for(int i=0;i<rounds;i++){
|
for(int i=0;i<rounds;i++){
|
||||||
rijndael.blockEncrypt((const UINT8 *)tmp, 256, (UINT8 *)tmp);
|
rijndael.blockEncrypt((const Q_UINT8 *)tmp, 256, (Q_UINT8 *)tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
sha256_starts(&sha2);
|
sha256_starts(&sha2);
|
||||||
|
@ -253,7 +253,7 @@ return true;
|
||||||
bool PwDatabase::CalcMasterKeyByFile(QString filename){
|
bool PwDatabase::CalcMasterKeyByFile(QString filename){
|
||||||
|
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if(file.open(IO_ReadOnly) == false) return false;
|
if(file.open(QIODevice::ReadOnly) == false) return false;
|
||||||
unsigned long FileSize=file.size();
|
unsigned long FileSize=file.size();
|
||||||
|
|
||||||
if(FileSize == 32){
|
if(FileSize == 32){
|
||||||
|
@ -314,14 +314,14 @@ return &Entries.back();
|
||||||
|
|
||||||
|
|
||||||
bool PwDatabase::CalcMasterKeyByFileAndPw(QString filename, QString& Password){
|
bool PwDatabase::CalcMasterKeyByFileAndPw(QString filename, QString& Password){
|
||||||
UINT8* FileKey;
|
Q_UINT8* FileKey;
|
||||||
UINT8* PasswordKey;
|
Q_UINT8* PasswordKey;
|
||||||
PasswordKey=new UINT8[32];
|
PasswordKey=new Q_UINT8[32];
|
||||||
FileKey=new UINT8[32];
|
FileKey=new Q_UINT8[32];
|
||||||
sha256_context sha32;
|
sha256_context sha32;
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if(file.open(IO_ReadOnly) == false) return false;
|
if(file.open(QIODevice::ReadOnly) == false) return false;
|
||||||
unsigned long FileSize=file.size();
|
unsigned long FileSize=file.size();
|
||||||
if(FileSize == 32){
|
if(FileSize == 32){
|
||||||
if(file.readBlock((char*)FileKey,32) != 32){
|
if(file.readBlock((char*)FileKey,32) != 32){
|
||||||
|
@ -381,14 +381,14 @@ return deleteEntry(getEntryIterator(entry));
|
||||||
bool PwDatabase::IsMetaStream(CEntry& p){
|
bool PwDatabase::IsMetaStream(CEntry& p){
|
||||||
|
|
||||||
if(p.pBinaryData == NULL) return false;
|
if(p.pBinaryData == NULL) return false;
|
||||||
if(p.Additional == NULL) return false;
|
if(p.Additional == "") return false;
|
||||||
if(p.BinaryDesc == NULL) return false;
|
if(p.BinaryDesc == "") return false;
|
||||||
if(p.BinaryDesc != "bin-stream") return false;
|
if(p.BinaryDesc != "bin-stream") return false;
|
||||||
if(p.Title == NULL) return false;
|
if(p.Title == "") return false;
|
||||||
if(p.Title != "Meta-Info") return false;
|
if(p.Title != "Meta-Info") return false;
|
||||||
if(p.UserName == NULL) return false;
|
if(p.UserName == "") return false;
|
||||||
if(p.UserName != "SYSTEM") return false;
|
if(p.UserName != "SYSTEM") return false;
|
||||||
if(p.URL == NULL) return false;
|
if(p.URL == "") return false;
|
||||||
if(p.URL != "$") return false;
|
if(p.URL != "$") return false;
|
||||||
if(p.ImageID != 0) return false;
|
if(p.ImageID != 0) return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -402,7 +402,7 @@ entry->GroupID=dst->ID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CGroup::ReadGroupField(UINT16 FieldType, UINT32 FieldSize, UINT8 *pData)
|
bool CGroup::ReadGroupField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pData)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(FieldType)
|
switch(FieldType)
|
||||||
|
@ -456,7 +456,7 @@ PwDatabase::~PwDatabase(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CEntry::ReadEntryField(UINT16 FieldType, UINT32 FieldSize, UINT8 *pData){
|
bool CEntry::ReadEntryField(Q_UINT16 FieldType, Q_UINT32 FieldSize, Q_UINT8 *pData){
|
||||||
|
|
||||||
|
|
||||||
switch(FieldType)
|
switch(FieldType)
|
||||||
|
@ -510,7 +510,7 @@ switch(FieldType)
|
||||||
{
|
{
|
||||||
///@TODO: im Destruktor löschen
|
///@TODO: im Destruktor löschen
|
||||||
///@TODO: im Konstruktor auf Null
|
///@TODO: im Konstruktor auf Null
|
||||||
pBinaryData = new UINT8[FieldSize];
|
pBinaryData = new Q_UINT8[FieldSize];
|
||||||
memcpy(pBinaryData, pData, FieldSize);
|
memcpy(pBinaryData, pData, FieldSize);
|
||||||
BinaryDataLength = FieldSize;
|
BinaryDataLength = FieldSize;
|
||||||
}
|
}
|
||||||
|
@ -535,11 +535,11 @@ return true;
|
||||||
|
|
||||||
bool PwDatabase::SaveDataBase(QString filename){
|
bool PwDatabase::SaveDataBase(QString filename){
|
||||||
CGroup SearchGroup;
|
CGroup SearchGroup;
|
||||||
UINT32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version;
|
Q_UINT32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version;
|
||||||
UINT8 TrafoRandomSeed[32];
|
Q_UINT8 TrafoRandomSeed[32];
|
||||||
UINT8 FinalRandomSeed[16];
|
Q_UINT8 FinalRandomSeed[16];
|
||||||
UINT8 ContentsHash[32];
|
Q_UINT8 ContentsHash[32];
|
||||||
UINT8 EncryptionIV[16];
|
Q_UINT8 EncryptionIV[16];
|
||||||
|
|
||||||
if(SearchGroupID!=-1){
|
if(SearchGroupID!=-1){
|
||||||
for(int i=0;i<Groups.size();i++){
|
for(int i=0;i<Groups.size();i++){
|
||||||
|
@ -586,8 +586,8 @@ getRandomBytes(FinalRandomSeed,1,16,false);
|
||||||
getRandomBytes(TrafoRandomSeed,1,32,false);
|
getRandomBytes(TrafoRandomSeed,1,32,false);
|
||||||
getRandomBytes(EncryptionIV,1,16,false);
|
getRandomBytes(EncryptionIV,1,16,false);
|
||||||
|
|
||||||
UINT16 FieldType;
|
Q_UINT16 FieldType;
|
||||||
UINT32 FieldSize;
|
Q_UINT32 FieldSize;
|
||||||
int pos=DB_HEADER_SIZE; // Skip the header, it will be written later
|
int pos=DB_HEADER_SIZE; // Skip the header, it will be written later
|
||||||
|
|
||||||
for(int i=0; i < Groups.size(); i++){
|
for(int i=0; i < Groups.size(); i++){
|
||||||
|
@ -743,7 +743,7 @@ memcpy(buffer+56,ContentsHash,32);
|
||||||
memcpy(buffer+88,TrafoRandomSeed,32);
|
memcpy(buffer+88,TrafoRandomSeed,32);
|
||||||
memcpy(buffer+120,&KeyEncRounds,4);
|
memcpy(buffer+120,&KeyEncRounds,4);
|
||||||
transformKey(MasterKey,TransformedMasterKey,TrafoRandomSeed,KeyEncRounds);
|
transformKey(MasterKey,TransformedMasterKey,TrafoRandomSeed,KeyEncRounds);
|
||||||
UINT8 FinalKey[32];
|
Q_UINT8 FinalKey[32];
|
||||||
sha256_starts(&context);
|
sha256_starts(&context);
|
||||||
sha256_update(&context,FinalRandomSeed, 16);
|
sha256_update(&context,FinalRandomSeed, 16);
|
||||||
sha256_update(&context,TransformedMasterKey, 32);
|
sha256_update(&context,TransformedMasterKey, 32);
|
||||||
|
@ -758,18 +758,18 @@ Rijndael aes;
|
||||||
//TODO:ERR_MSG
|
//TODO:ERR_MSG
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return false;}
|
return false;}
|
||||||
EncryptedPartSize = (unsigned long)aes.padEncrypt((UINT8*)buffer+DB_HEADER_SIZE,
|
EncryptedPartSize = (unsigned long)aes.padEncrypt((Q_UINT8*)buffer+DB_HEADER_SIZE,
|
||||||
pos - DB_HEADER_SIZE,
|
pos - DB_HEADER_SIZE,
|
||||||
(UINT8*)buffer+DB_HEADER_SIZE);
|
(Q_UINT8*)buffer+DB_HEADER_SIZE);
|
||||||
}else if(CryptoAlgorithmus == ALGO_TWOFISH){
|
}else if(CryptoAlgorithmus == ALGO_TWOFISH){
|
||||||
CTwofish twofish;
|
CTwofish twofish;
|
||||||
if(twofish.init(FinalKey, 32, EncryptionIV) == false){
|
if(twofish.init(FinalKey, 32, EncryptionIV) == false){
|
||||||
//TODO:ERR_MSG
|
//TODO:ERR_MSG
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return false;}
|
return false;}
|
||||||
EncryptedPartSize = (unsigned long)twofish.padEncrypt((UINT8*)buffer+DB_HEADER_SIZE,
|
EncryptedPartSize = (unsigned long)twofish.padEncrypt((Q_UINT8*)buffer+DB_HEADER_SIZE,
|
||||||
pos - DB_HEADER_SIZE,
|
pos - DB_HEADER_SIZE,
|
||||||
(UINT8*)buffer+DB_HEADER_SIZE);
|
(Q_UINT8*)buffer+DB_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((EncryptedPartSize > 2147483446) || (EncryptedPartSize == 0)){
|
if((EncryptedPartSize > 2147483446) || (EncryptedPartSize == 0)){
|
||||||
|
@ -778,7 +778,7 @@ delete [] buffer;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file.open(IO_ReadWrite | IO_Truncate)==false){
|
if(file.open(QIODevice::ReadWrite | QIODevice::Truncate)==false){
|
||||||
//TODO:ERR_MSG
|
//TODO:ERR_MSG
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return false;
|
return false;
|
||||||
|
@ -889,14 +889,14 @@ for(int i=0;i<db->Groups.size();i++){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PwDatabase::isGroupIdInUse(UINT32 id){
|
bool PwDatabase::isGroupIdInUse(Q_UINT32 id){
|
||||||
for(int i=0;i<Groups.size();i++)
|
for(int i=0;i<Groups.size();i++)
|
||||||
if(Groups[i].ID==id)return true;
|
if(Groups[i].ID==id)return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PwDatabase::isEntrySidInUse(UINT32 sid){
|
bool PwDatabase::isEntrySidInUse(Q_UINT32 sid){
|
||||||
for(int i=0;i<Entries.size();i++)
|
for(int i=0;i<Entries.size();i++)
|
||||||
if(Entries[i].sID==sid)return true;
|
if(Entries[i].sID==sid)return true;
|
||||||
|
|
||||||
|
@ -904,8 +904,8 @@ return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT32 PwDatabase::getNewGroupId(){
|
Q_UINT32 PwDatabase::getNewGroupId(){
|
||||||
UINT32 id;
|
Q_UINT32 id;
|
||||||
bool used;
|
bool used;
|
||||||
while(1){
|
while(1){
|
||||||
used=false;
|
used=false;
|
||||||
|
@ -917,8 +917,8 @@ if(used==false)break;}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 PwDatabase::getNewEntrySid(){
|
Q_UINT32 PwDatabase::getNewEntrySid(){
|
||||||
UINT32 sid;
|
Q_UINT32 sid;
|
||||||
while(1){
|
while(1){
|
||||||
getRandomBytes(&sid,4,1,false);
|
getRandomBytes(&sid,4,1,false);
|
||||||
if(!sid)continue;
|
if(!sid)continue;
|
||||||
|
@ -931,7 +931,7 @@ bool PwDatabase::convHexToBinaryKey(char* HexKey, char* dst){
|
||||||
QString hex=QString::fromAscii(HexKey,64);
|
QString hex=QString::fromAscii(HexKey,64);
|
||||||
for(int i=0; i<64; i+=2){
|
for(int i=0; i<64; i+=2){
|
||||||
bool err;
|
bool err;
|
||||||
UINT8 bin;
|
Q_UINT8 bin;
|
||||||
bin=hex.mid(i,2).toUInt(&err,16);
|
bin=hex.mid(i,2).toUInt(&err,16);
|
||||||
if(!err){
|
if(!err){
|
||||||
qWarning("Invalid Hex Key\n");
|
qWarning("Invalid Hex Key\n");
|
||||||
|
@ -940,7 +940,7 @@ for(int i=0; i<64; i+=2){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpyFromLEnd32(UINT32* dst,char* src){
|
void memcpyFromLEnd32(Q_UINT32* dst,char* src){
|
||||||
#ifdef KEEPASS_LITTLE_ENDIAN
|
#ifdef KEEPASS_LITTLE_ENDIAN
|
||||||
memcpy(dst,src,4);
|
memcpy(dst,src,4);
|
||||||
#endif
|
#endif
|
||||||
|
@ -952,7 +952,7 @@ void memcpyFromLEnd32(UINT32* dst,char* src){
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpyFromLEnd16(UINT16* dst,char* src){
|
void memcpyFromLEnd16(Q_UINT16* dst,char* src){
|
||||||
#ifdef KEEPASS_LITTLE_ENDIAN
|
#ifdef KEEPASS_LITTLE_ENDIAN
|
||||||
memcpy(dst,src,2);
|
memcpy(dst,src,2);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,16 +68,16 @@ private:
|
||||||
EntryItr getEntryIterator(CEntry* pEntry);
|
EntryItr getEntryIterator(CEntry* pEntry);
|
||||||
GroupItr getGroupIterator(CGroup* pGroup);
|
GroupItr getGroupIterator(CGroup* pGroup);
|
||||||
bool IsMetaStream(CEntry& Entry);
|
bool IsMetaStream(CEntry& Entry);
|
||||||
void transformKey(UINT8* src,UINT8* dst,UINT8* seed,int rounds);
|
void transformKey(Q_UINT8* src,Q_UINT8* dst,Q_UINT8* seed,int rounds);
|
||||||
bool readHeader(char* raw);
|
bool readHeader(char* raw);
|
||||||
bool isGroupIdInUse(UINT32 GroupID);
|
bool isGroupIdInUse(Q_UINT32 GroupID);
|
||||||
bool isEntrySidInUse(UINT32 sID);
|
bool isEntrySidInUse(Q_UINT32 sID);
|
||||||
UINT32 getNewGroupId();
|
Q_UINT32 getNewGroupId();
|
||||||
UINT32 getNewEntrySid();
|
Q_UINT32 getNewEntrySid();
|
||||||
bool convHexToBinaryKey(char* HexKey, char* dst);
|
bool convHexToBinaryKey(char* HexKey, char* dst);
|
||||||
};
|
};
|
||||||
|
|
||||||
void memcpyFromLEnd32(UINT32* dst,char* src);
|
void memcpyFromLEnd32(Q_UINT32* dst,char* src);
|
||||||
void memcpyFromLEnd16(UINT16* dst,char* src);
|
void memcpyFromLEnd16(Q_UINT16* dst,char* src);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,52 +24,52 @@
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
|
|
||||||
bool CConfig::loadFromIni(QString filename){
|
bool CConfig::loadFromIni(QString filename){
|
||||||
CIniFile ini(filename);
|
CIniFile ini((char*)filename.data());
|
||||||
ini.ReadFile();
|
ini.ReadFile();
|
||||||
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
|
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
|
||||||
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
|
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
|
||||||
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
|
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
|
||||||
OpenLast=ini.GetValueB("Options","OpenLast",true);
|
OpenLast=ini.GetValueB("Options","OpenLast",true);
|
||||||
LastFile=ini.GetValue("Options","LastFile","");
|
LastFile=ini.GetValue("Options","LastFile","").c_str();
|
||||||
ParseColumnString(ini.GetValue("UI","Columns","1111100000"),Columns);
|
ParseColumnString(ini.GetValue("UI","Columns","1111100000").c_str(),Columns);
|
||||||
BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,104,176"));
|
BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,104,176").c_str());
|
||||||
BannerColor2=ParseColorString(ini.GetValue("Options","BannerColor2","213,239,255"));
|
BannerColor2=ParseColorString(ini.GetValue("Options","BannerColor2","213,239,255").c_str());
|
||||||
BannerTextColor=ParseColorString(ini.GetValue("Options","BannerTextColor","4,0,80"));
|
BannerTextColor=ParseColorString(ini.GetValue("Options","BannerTextColor","4,0,80").c_str());
|
||||||
ShowPasswords=ini.GetValueB("Options","ShowPasswords",false);
|
ShowPasswords=ini.GetValueB("Options","ShowPasswords",false);
|
||||||
OpenUrlCommand=ini.GetValue("Options","UrlCmd","kfmclient openURL %1");
|
OpenUrlCommand=ini.GetValue("Options","UrlCmd","kfmclient openURL %1").c_str();
|
||||||
Language=ini.GetValue("Options","LangFile","");
|
Language=ini.GetValue("Options","LangFile","").c_str();
|
||||||
ParseBoolString(ini.GetValue("Options","SearchOptions","00110111"),SearchOptions,8);
|
ParseBoolString(ini.GetValue("Options","SearchOptions","00110111").c_str(),SearchOptions,8);
|
||||||
ListView_HidePasswords=ini.GetValueB("UI","HidePasswords",true);
|
ListView_HidePasswords=ini.GetValueB("UI","HidePasswords",true);
|
||||||
ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false);
|
ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false);
|
||||||
ParseBoolString(ini.GetValue("Options","PwGenOptions","1111100001"),PwGenOptions,10);
|
ParseBoolString(ini.GetValue("Options","PwGenOptions","1111100001").c_str(),PwGenOptions,10);
|
||||||
PwGenLength=ini.GetValueI("Options","PwGenLength",25);
|
PwGenLength=ini.GetValueI("Options","PwGenLength",25);
|
||||||
PwGenCharList=ini.GetValue("Options","PwGenCharList","");
|
PwGenCharList=ini.GetValue("Options","PwGenCharList","").c_str();
|
||||||
ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true);
|
ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true);
|
||||||
EnableKdePlugin=ini.GetValueB("KDE Plugin","Enabled",false);
|
EnableKdePlugin=ini.GetValueB("KDE Plugin","Enabled",false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfig::saveToIni(QString filename){
|
bool CConfig::saveToIni(QString filename){
|
||||||
CIniFile ini(filename);
|
CIniFile ini((const char*)filename);
|
||||||
ini.ReadFile();
|
ini.ReadFile();
|
||||||
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
|
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
|
||||||
ini.SetValueB("UI","ShowToolbar",Toolbar);
|
ini.SetValueB("UI","ShowToolbar",Toolbar);
|
||||||
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
|
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
|
||||||
if(OpenLast)ini.SetValue("Options","LastFile",LastFile);
|
if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile);
|
||||||
else ini.SetValue("Options","LastFile","");
|
else ini.SetValue("Options","LastFile","");
|
||||||
ini.SetValue("UI","Columns",CreateColumnString(),true);
|
ini.SetValue("UI","Columns",(const char*)CreateColumnString(),true);
|
||||||
ini.SetValue("Options","BannerColor1",CreateColorString(BannerColor1),true);
|
ini.SetValue("Options","BannerColor1",(const char*)CreateColorString(BannerColor1),true);
|
||||||
ini.SetValue("Options","BannerColor2",CreateColorString(BannerColor2),true);
|
ini.SetValue("Options","BannerColor2",(const char*)CreateColorString(BannerColor2),true);
|
||||||
ini.SetValue("Options","BannerTextColor",CreateColorString(BannerTextColor),true);
|
ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor),true);
|
||||||
ini.SetValueB("Options","ShowPasswords",ShowPasswords,true);
|
ini.SetValueB("Options","ShowPasswords",ShowPasswords,true);
|
||||||
ini.SetValue("Options","UrlCmd",OpenUrlCommand,true);
|
ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand,true);
|
||||||
ini.SetValue("Options","LangFile",Language,true);
|
ini.SetValue("Options","LangFile",(const char*)Language,true);
|
||||||
ini.SetValue("Options","SearchOptions",CreateBoolString(SearchOptions,8),true);
|
ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,8),true);
|
||||||
ini.SetValueB("UI","HidePasswords",ListView_HidePasswords);
|
ini.SetValueB("UI","HidePasswords",ListView_HidePasswords);
|
||||||
ini.SetValueB("UI","HideUsernames",ListView_HideUsernames);
|
ini.SetValueB("UI","HideUsernames",ListView_HideUsernames);
|
||||||
ini.SetValue("Options","PwGenOptions",CreateBoolString(PwGenOptions,10),true);
|
ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10),true);
|
||||||
ini.SetValueI("Options","PwGenLength",PwGenLength,true);
|
ini.SetValueI("Options","PwGenLength",PwGenLength,true);
|
||||||
ini.SetValue("Options","PwGenCharList",PwGenCharList,true);
|
ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList,true);
|
||||||
ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
|
ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
|
||||||
ini.SetValueB("KDE Plugin","Enabled",EnableKdePlugin,true);
|
ini.SetValueB("KDE Plugin","Enabled",EnableKdePlugin,true);
|
||||||
if(!ini.WriteFile())return false;
|
if(!ini.WriteFile())return false;
|
||||||
|
@ -102,15 +102,15 @@ return str;
|
||||||
QColor CConfig::ParseColorString(QString str){
|
QColor CConfig::ParseColorString(QString str){
|
||||||
QStringList lst=QStringList::split(',',str);
|
QStringList lst=QStringList::split(',',str);
|
||||||
if(lst.size()!=3){
|
if(lst.size()!=3){
|
||||||
cout << QObject::trUtf8("Warnung:")+" CConfig::ParseColorString(QString):"+QObject::trUtf8("ungültiger RGB-Farbwert: ") << str << endl;
|
qWarning(QObject::trUtf8("Warnung:")+" CConfig::ParseColorString(QString):"+QObject::trUtf8("ungültiger RGB-Farbwert.\n"));
|
||||||
return QColor(0,0,0);}
|
return QColor(0,0,0);}
|
||||||
bool err[3];
|
bool err[3];
|
||||||
int r=lst[0].toUInt(err);
|
int r=lst[0].toUInt(err);
|
||||||
int g=lst[1].toUInt(err+1);
|
int g=lst[1].toUInt(err+1);
|
||||||
int b=lst[2].toUInt(err+2);
|
int b=lst[2].toUInt(err+2);
|
||||||
if(!err[0] || !err[1] || !err[2]){
|
if(!err[0] || !err[1] || !err[2]){
|
||||||
cout << QObject::trUtf8("Warnung:")+" CConfig::ParseColorString(QString):"+QObject::trUtf8("ungültiger RGB-Farbwert: ") << str << endl;
|
qWarning(QObject::trUtf8("Warnung:")+" CConfig::ParseColorString(QString):"+QObject::trUtf8("ungültiger RGB-Farbwert.\n"));
|
||||||
return QColor(0,0,0);}
|
return QColor(0,0,0);}
|
||||||
return QColor(r,g,b);
|
return QColor(r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "rijndael.h"
|
#include "rijndael.h"
|
||||||
|
|
||||||
|
|
||||||
static UINT8 S[256]=
|
static Q_UINT8 S[256]=
|
||||||
{
|
{
|
||||||
99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
|
99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
|
||||||
202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
|
202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
|
||||||
|
@ -61,7 +61,7 @@ static UINT8 S[256]=
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static UINT8 T1[256][4]=
|
static Q_UINT8 T1[256][4]=
|
||||||
{
|
{
|
||||||
0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84, 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d,
|
0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84, 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d,
|
||||||
0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd, 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54,
|
0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd, 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54,
|
||||||
|
@ -129,7 +129,7 @@ static UINT8 T1[256][4]=
|
||||||
0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc, 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a
|
0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc, 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T2[256][4]=
|
static Q_UINT8 T2[256][4]=
|
||||||
{
|
{
|
||||||
0xa5,0xc6,0x63,0x63, 0x84,0xf8,0x7c,0x7c, 0x99,0xee,0x77,0x77, 0x8d,0xf6,0x7b,0x7b,
|
0xa5,0xc6,0x63,0x63, 0x84,0xf8,0x7c,0x7c, 0x99,0xee,0x77,0x77, 0x8d,0xf6,0x7b,0x7b,
|
||||||
0x0d,0xff,0xf2,0xf2, 0xbd,0xd6,0x6b,0x6b, 0xb1,0xde,0x6f,0x6f, 0x54,0x91,0xc5,0xc5,
|
0x0d,0xff,0xf2,0xf2, 0xbd,0xd6,0x6b,0x6b, 0xb1,0xde,0x6f,0x6f, 0x54,0x91,0xc5,0xc5,
|
||||||
|
@ -197,7 +197,7 @@ static UINT8 T2[256][4]=
|
||||||
0xcb,0x7b,0xb0,0xb0, 0xfc,0xa8,0x54,0x54, 0xd6,0x6d,0xbb,0xbb, 0x3a,0x2c,0x16,0x16
|
0xcb,0x7b,0xb0,0xb0, 0xfc,0xa8,0x54,0x54, 0xd6,0x6d,0xbb,0xbb, 0x3a,0x2c,0x16,0x16
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T3[256][4]=
|
static Q_UINT8 T3[256][4]=
|
||||||
{
|
{
|
||||||
0x63,0xa5,0xc6,0x63, 0x7c,0x84,0xf8,0x7c, 0x77,0x99,0xee,0x77, 0x7b,0x8d,0xf6,0x7b,
|
0x63,0xa5,0xc6,0x63, 0x7c,0x84,0xf8,0x7c, 0x77,0x99,0xee,0x77, 0x7b,0x8d,0xf6,0x7b,
|
||||||
0xf2,0x0d,0xff,0xf2, 0x6b,0xbd,0xd6,0x6b, 0x6f,0xb1,0xde,0x6f, 0xc5,0x54,0x91,0xc5,
|
0xf2,0x0d,0xff,0xf2, 0x6b,0xbd,0xd6,0x6b, 0x6f,0xb1,0xde,0x6f, 0xc5,0x54,0x91,0xc5,
|
||||||
|
@ -265,7 +265,7 @@ static UINT8 T3[256][4]=
|
||||||
0xb0,0xcb,0x7b,0xb0, 0x54,0xfc,0xa8,0x54, 0xbb,0xd6,0x6d,0xbb, 0x16,0x3a,0x2c,0x16
|
0xb0,0xcb,0x7b,0xb0, 0x54,0xfc,0xa8,0x54, 0xbb,0xd6,0x6d,0xbb, 0x16,0x3a,0x2c,0x16
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T4[256][4]=
|
static Q_UINT8 T4[256][4]=
|
||||||
{
|
{
|
||||||
0x63,0x63,0xa5,0xc6, 0x7c,0x7c,0x84,0xf8, 0x77,0x77,0x99,0xee, 0x7b,0x7b,0x8d,0xf6,
|
0x63,0x63,0xa5,0xc6, 0x7c,0x7c,0x84,0xf8, 0x77,0x77,0x99,0xee, 0x7b,0x7b,0x8d,0xf6,
|
||||||
0xf2,0xf2,0x0d,0xff, 0x6b,0x6b,0xbd,0xd6, 0x6f,0x6f,0xb1,0xde, 0xc5,0xc5,0x54,0x91,
|
0xf2,0xf2,0x0d,0xff, 0x6b,0x6b,0xbd,0xd6, 0x6f,0x6f,0xb1,0xde, 0xc5,0xc5,0x54,0x91,
|
||||||
|
@ -333,7 +333,7 @@ static UINT8 T4[256][4]=
|
||||||
0xb0,0xb0,0xcb,0x7b, 0x54,0x54,0xfc,0xa8, 0xbb,0xbb,0xd6,0x6d, 0x16,0x16,0x3a,0x2c
|
0xb0,0xb0,0xcb,0x7b, 0x54,0x54,0xfc,0xa8, 0xbb,0xbb,0xd6,0x6d, 0x16,0x16,0x3a,0x2c
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T5[256][4]=
|
static Q_UINT8 T5[256][4]=
|
||||||
{
|
{
|
||||||
0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53, 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96,
|
0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53, 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96,
|
||||||
0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1, 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93,
|
0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1, 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93,
|
||||||
|
@ -401,7 +401,7 @@ static UINT8 T5[256][4]=
|
||||||
0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70, 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42
|
0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70, 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T6[256][4]=
|
static Q_UINT8 T6[256][4]=
|
||||||
{
|
{
|
||||||
0x50,0x51,0xf4,0xa7, 0x53,0x7e,0x41,0x65, 0xc3,0x1a,0x17,0xa4, 0x96,0x3a,0x27,0x5e,
|
0x50,0x51,0xf4,0xa7, 0x53,0x7e,0x41,0x65, 0xc3,0x1a,0x17,0xa4, 0x96,0x3a,0x27,0x5e,
|
||||||
0xcb,0x3b,0xab,0x6b, 0xf1,0x1f,0x9d,0x45, 0xab,0xac,0xfa,0x58, 0x93,0x4b,0xe3,0x03,
|
0xcb,0x3b,0xab,0x6b, 0xf1,0x1f,0x9d,0x45, 0xab,0xac,0xfa,0x58, 0x93,0x4b,0xe3,0x03,
|
||||||
|
@ -469,7 +469,7 @@ static UINT8 T6[256][4]=
|
||||||
0x61,0x7b,0xcb,0x84, 0x70,0xd5,0x32,0xb6, 0x74,0x48,0x6c,0x5c, 0x42,0xd0,0xb8,0x57
|
0x61,0x7b,0xcb,0x84, 0x70,0xd5,0x32,0xb6, 0x74,0x48,0x6c,0x5c, 0x42,0xd0,0xb8,0x57
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T7[256][4]=
|
static Q_UINT8 T7[256][4]=
|
||||||
{
|
{
|
||||||
0xa7,0x50,0x51,0xf4, 0x65,0x53,0x7e,0x41, 0xa4,0xc3,0x1a,0x17, 0x5e,0x96,0x3a,0x27,
|
0xa7,0x50,0x51,0xf4, 0x65,0x53,0x7e,0x41, 0xa4,0xc3,0x1a,0x17, 0x5e,0x96,0x3a,0x27,
|
||||||
0x6b,0xcb,0x3b,0xab, 0x45,0xf1,0x1f,0x9d, 0x58,0xab,0xac,0xfa, 0x03,0x93,0x4b,0xe3,
|
0x6b,0xcb,0x3b,0xab, 0x45,0xf1,0x1f,0x9d, 0x58,0xab,0xac,0xfa, 0x03,0x93,0x4b,0xe3,
|
||||||
|
@ -537,7 +537,7 @@ static UINT8 T7[256][4]=
|
||||||
0x84,0x61,0x7b,0xcb, 0xb6,0x70,0xd5,0x32, 0x5c,0x74,0x48,0x6c, 0x57,0x42,0xd0,0xb8
|
0x84,0x61,0x7b,0xcb, 0xb6,0x70,0xd5,0x32, 0x5c,0x74,0x48,0x6c, 0x57,0x42,0xd0,0xb8
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 T8[256][4]=
|
static Q_UINT8 T8[256][4]=
|
||||||
{
|
{
|
||||||
0xf4,0xa7,0x50,0x51, 0x41,0x65,0x53,0x7e, 0x17,0xa4,0xc3,0x1a, 0x27,0x5e,0x96,0x3a,
|
0xf4,0xa7,0x50,0x51, 0x41,0x65,0x53,0x7e, 0x17,0xa4,0xc3,0x1a, 0x27,0x5e,0x96,0x3a,
|
||||||
0xab,0x6b,0xcb,0x3b, 0x9d,0x45,0xf1,0x1f, 0xfa,0x58,0xab,0xac, 0xe3,0x03,0x93,0x4b,
|
0xab,0x6b,0xcb,0x3b, 0x9d,0x45,0xf1,0x1f, 0xfa,0x58,0xab,0xac, 0xe3,0x03,0x93,0x4b,
|
||||||
|
@ -605,7 +605,7 @@ static UINT8 T8[256][4]=
|
||||||
0xcb,0x84,0x61,0x7b, 0x32,0xb6,0x70,0xd5, 0x6c,0x5c,0x74,0x48, 0xb8,0x57,0x42,0xd0
|
0xcb,0x84,0x61,0x7b, 0x32,0xb6,0x70,0xd5, 0x6c,0x5c,0x74,0x48, 0xb8,0x57,0x42,0xd0
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 S5[256]=
|
static Q_UINT8 S5[256]=
|
||||||
{
|
{
|
||||||
0x52,0x09,0x6a,0xd5,
|
0x52,0x09,0x6a,0xd5,
|
||||||
0x30,0x36,0xa5,0x38,
|
0x30,0x36,0xa5,0x38,
|
||||||
|
@ -673,7 +673,7 @@ static UINT8 S5[256]=
|
||||||
0x55,0x21,0x0c,0x7d
|
0x55,0x21,0x0c,0x7d
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 U1[256][4]=
|
static Q_UINT8 U1[256][4]=
|
||||||
{
|
{
|
||||||
0x00,0x00,0x00,0x00, 0x0e,0x09,0x0d,0x0b, 0x1c,0x12,0x1a,0x16, 0x12,0x1b,0x17,0x1d,
|
0x00,0x00,0x00,0x00, 0x0e,0x09,0x0d,0x0b, 0x1c,0x12,0x1a,0x16, 0x12,0x1b,0x17,0x1d,
|
||||||
0x38,0x24,0x34,0x2c, 0x36,0x2d,0x39,0x27, 0x24,0x36,0x2e,0x3a, 0x2a,0x3f,0x23,0x31,
|
0x38,0x24,0x34,0x2c, 0x36,0x2d,0x39,0x27, 0x24,0x36,0x2e,0x3a, 0x2a,0x3f,0x23,0x31,
|
||||||
|
@ -741,7 +741,7 @@ static UINT8 U1[256][4]=
|
||||||
0x9f,0x5d,0x80,0xbe, 0x91,0x54,0x8d,0xb5, 0x83,0x4f,0x9a,0xa8, 0x8d,0x46,0x97,0xa3
|
0x9f,0x5d,0x80,0xbe, 0x91,0x54,0x8d,0xb5, 0x83,0x4f,0x9a,0xa8, 0x8d,0x46,0x97,0xa3
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 U2[256][4]=
|
static Q_UINT8 U2[256][4]=
|
||||||
{
|
{
|
||||||
0x00,0x00,0x00,0x00, 0x0b,0x0e,0x09,0x0d, 0x16,0x1c,0x12,0x1a, 0x1d,0x12,0x1b,0x17,
|
0x00,0x00,0x00,0x00, 0x0b,0x0e,0x09,0x0d, 0x16,0x1c,0x12,0x1a, 0x1d,0x12,0x1b,0x17,
|
||||||
0x2c,0x38,0x24,0x34, 0x27,0x36,0x2d,0x39, 0x3a,0x24,0x36,0x2e, 0x31,0x2a,0x3f,0x23,
|
0x2c,0x38,0x24,0x34, 0x27,0x36,0x2d,0x39, 0x3a,0x24,0x36,0x2e, 0x31,0x2a,0x3f,0x23,
|
||||||
|
@ -809,7 +809,7 @@ static UINT8 U2[256][4]=
|
||||||
0xbe,0x9f,0x5d,0x80, 0xb5,0x91,0x54,0x8d, 0xa8,0x83,0x4f,0x9a, 0xa3,0x8d,0x46,0x97
|
0xbe,0x9f,0x5d,0x80, 0xb5,0x91,0x54,0x8d, 0xa8,0x83,0x4f,0x9a, 0xa3,0x8d,0x46,0x97
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 U3[256][4]=
|
static Q_UINT8 U3[256][4]=
|
||||||
{
|
{
|
||||||
0x00,0x00,0x00,0x00, 0x0d,0x0b,0x0e,0x09, 0x1a,0x16,0x1c,0x12, 0x17,0x1d,0x12,0x1b,
|
0x00,0x00,0x00,0x00, 0x0d,0x0b,0x0e,0x09, 0x1a,0x16,0x1c,0x12, 0x17,0x1d,0x12,0x1b,
|
||||||
0x34,0x2c,0x38,0x24, 0x39,0x27,0x36,0x2d, 0x2e,0x3a,0x24,0x36, 0x23,0x31,0x2a,0x3f,
|
0x34,0x2c,0x38,0x24, 0x39,0x27,0x36,0x2d, 0x2e,0x3a,0x24,0x36, 0x23,0x31,0x2a,0x3f,
|
||||||
|
@ -877,7 +877,7 @@ static UINT8 U3[256][4]=
|
||||||
0x80,0xbe,0x9f,0x5d, 0x8d,0xb5,0x91,0x54, 0x9a,0xa8,0x83,0x4f, 0x97,0xa3,0x8d,0x46
|
0x80,0xbe,0x9f,0x5d, 0x8d,0xb5,0x91,0x54, 0x9a,0xa8,0x83,0x4f, 0x97,0xa3,0x8d,0x46
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 U4[256][4]=
|
static Q_UINT8 U4[256][4]=
|
||||||
{
|
{
|
||||||
0x00,0x00,0x00,0x00, 0x09,0x0d,0x0b,0x0e, 0x12,0x1a,0x16,0x1c, 0x1b,0x17,0x1d,0x12,
|
0x00,0x00,0x00,0x00, 0x09,0x0d,0x0b,0x0e, 0x12,0x1a,0x16,0x1c, 0x1b,0x17,0x1d,0x12,
|
||||||
0x24,0x34,0x2c,0x38, 0x2d,0x39,0x27,0x36, 0x36,0x2e,0x3a,0x24, 0x3f,0x23,0x31,0x2a,
|
0x24,0x34,0x2c,0x38, 0x2d,0x39,0x27,0x36, 0x36,0x2e,0x3a,0x24, 0x3f,0x23,0x31,0x2a,
|
||||||
|
@ -945,7 +945,7 @@ static UINT8 U4[256][4]=
|
||||||
0x5d,0x80,0xbe,0x9f, 0x54,0x8d,0xb5,0x91, 0x4f,0x9a,0xa8,0x83, 0x46,0x97,0xa3,0x8d
|
0x5d,0x80,0xbe,0x9f, 0x54,0x8d,0xb5,0x91, 0x4f,0x9a,0xa8,0x83, 0x46,0x97,0xa3,0x8d
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT32 rcon[30]=
|
static Q_UINT32 rcon[30]=
|
||||||
{
|
{
|
||||||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
|
0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
|
||||||
0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
|
0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
|
||||||
|
@ -970,7 +970,7 @@ Rijndael::~Rijndael()
|
||||||
// nothing here
|
// nothing here
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rijndael::init(Mode mode,Direction dir,const UINT8 * key,KeyLength keyLen,UINT8 * initVector)
|
int Rijndael::init(Mode mode,Direction dir,const Q_UINT8 * key,KeyLength keyLen,Q_UINT8 * initVector)
|
||||||
{
|
{
|
||||||
// Not initialized yet
|
// Not initialized yet
|
||||||
m_state = Invalid;
|
m_state = Invalid;
|
||||||
|
@ -999,7 +999,7 @@ int Rijndael::init(Mode mode,Direction dir,const UINT8 * key,KeyLength keyLen,UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 uKeyLenInBytes;
|
Q_UINT32 uKeyLenInBytes;
|
||||||
|
|
||||||
// And check the key length
|
// And check the key length
|
||||||
switch(keyLen)
|
switch(keyLen)
|
||||||
|
@ -1025,9 +1025,9 @@ int Rijndael::init(Mode mode,Direction dir,const UINT8 * key,KeyLength keyLen,UI
|
||||||
|
|
||||||
if(!key) return RIJNDAEL_BAD_KEY;
|
if(!key) return RIJNDAEL_BAD_KEY;
|
||||||
|
|
||||||
UINT8 keyMatrix[_MAX_KEY_COLUMNS][4];
|
Q_UINT8 keyMatrix[_MAX_KEY_COLUMNS][4];
|
||||||
|
|
||||||
for(UINT32 i = 0;i < uKeyLenInBytes;i++)keyMatrix[i >> 2][i & 3] = key[i];
|
for(Q_UINT32 i = 0;i < uKeyLenInBytes;i++)keyMatrix[i >> 2][i & 3] = key[i];
|
||||||
|
|
||||||
keySched(keyMatrix);
|
keySched(keyMatrix);
|
||||||
|
|
||||||
|
@ -1038,10 +1038,10 @@ int Rijndael::init(Mode mode,Direction dir,const UINT8 * key,KeyLength keyLen,UI
|
||||||
return RIJNDAEL_SUCCESS;
|
return RIJNDAEL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
|
int Rijndael::blockEncrypt(const Q_UINT8 *input,int inputLen,Q_UINT8 *outBuffer)
|
||||||
{
|
{
|
||||||
int i, k, numBlocks;
|
int i, k, numBlocks;
|
||||||
UINT8 block[16], iv[4][4];
|
Q_UINT8 block[16], iv[4][4];
|
||||||
|
|
||||||
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
||||||
if(m_direction != Encrypt) return RIJNDAEL_BAD_DIRECTION;
|
if(m_direction != Encrypt) return RIJNDAEL_BAD_DIRECTION;
|
||||||
|
@ -1060,18 +1060,18 @@ int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CBC:
|
case CBC:
|
||||||
((UINT32*)block)[0] = ((UINT32*)m_initVector)[0] ^ ((UINT32*)input)[0];
|
((Q_UINT32*)block)[0] = ((Q_UINT32*)m_initVector)[0] ^ ((Q_UINT32*)input)[0];
|
||||||
((UINT32*)block)[1] = ((UINT32*)m_initVector)[1] ^ ((UINT32*)input)[1];
|
((Q_UINT32*)block)[1] = ((Q_UINT32*)m_initVector)[1] ^ ((Q_UINT32*)input)[1];
|
||||||
((UINT32*)block)[2] = ((UINT32*)m_initVector)[2] ^ ((UINT32*)input)[2];
|
((Q_UINT32*)block)[2] = ((Q_UINT32*)m_initVector)[2] ^ ((Q_UINT32*)input)[2];
|
||||||
((UINT32*)block)[3] = ((UINT32*)m_initVector)[3] ^ ((UINT32*)input)[3];
|
((Q_UINT32*)block)[3] = ((Q_UINT32*)m_initVector)[3] ^ ((Q_UINT32*)input)[3];
|
||||||
encrypt(block,outBuffer);
|
encrypt(block,outBuffer);
|
||||||
input += 16;
|
input += 16;
|
||||||
for(i = numBlocks - 1;i > 0;i--)
|
for(i = numBlocks - 1;i > 0;i--)
|
||||||
{
|
{
|
||||||
((UINT32*)block)[0] = ((UINT32*)outBuffer)[0] ^ ((UINT32*)input)[0];
|
((Q_UINT32*)block)[0] = ((Q_UINT32*)outBuffer)[0] ^ ((Q_UINT32*)input)[0];
|
||||||
((UINT32*)block)[1] = ((UINT32*)outBuffer)[1] ^ ((UINT32*)input)[1];
|
((Q_UINT32*)block)[1] = ((Q_UINT32*)outBuffer)[1] ^ ((Q_UINT32*)input)[1];
|
||||||
((UINT32*)block)[2] = ((UINT32*)outBuffer)[2] ^ ((UINT32*)input)[2];
|
((Q_UINT32*)block)[2] = ((Q_UINT32*)outBuffer)[2] ^ ((Q_UINT32*)input)[2];
|
||||||
((UINT32*)block)[3] = ((UINT32*)outBuffer)[3] ^ ((UINT32*)input)[3];
|
((Q_UINT32*)block)[3] = ((Q_UINT32*)outBuffer)[3] ^ ((Q_UINT32*)input)[3];
|
||||||
outBuffer += 16;
|
outBuffer += 16;
|
||||||
encrypt(block,outBuffer);
|
encrypt(block,outBuffer);
|
||||||
input += 16;
|
input += 16;
|
||||||
|
@ -1081,19 +1081,19 @@ int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
|
||||||
#if STRICT_ALIGN
|
#if STRICT_ALIGN
|
||||||
memcpy(iv,m_initVector,16);
|
memcpy(iv,m_initVector,16);
|
||||||
#else /* !STRICT_ALIGN */
|
#else /* !STRICT_ALIGN */
|
||||||
*((UINT32*)iv[0]) = *((UINT32*)(m_initVector ));
|
*((Q_UINT32*)iv[0]) = *((Q_UINT32*)(m_initVector ));
|
||||||
*((UINT32*)iv[1]) = *((UINT32*)(m_initVector + 4));
|
*((Q_UINT32*)iv[1]) = *((Q_UINT32*)(m_initVector + 4));
|
||||||
*((UINT32*)iv[2]) = *((UINT32*)(m_initVector + 8));
|
*((Q_UINT32*)iv[2]) = *((Q_UINT32*)(m_initVector + 8));
|
||||||
*((UINT32*)iv[3]) = *((UINT32*)(m_initVector +12));
|
*((Q_UINT32*)iv[3]) = *((Q_UINT32*)(m_initVector +12));
|
||||||
#endif /* ?STRICT_ALIGN */
|
#endif /* ?STRICT_ALIGN */
|
||||||
for(i = numBlocks; i > 0; i--)
|
for(i = numBlocks; i > 0; i--)
|
||||||
{
|
{
|
||||||
for(k = 0; k < 128; k++)
|
for(k = 0; k < 128; k++)
|
||||||
{
|
{
|
||||||
*((UINT32*) block ) = *((UINT32*)iv[0]);
|
*((Q_UINT32*) block ) = *((Q_UINT32*)iv[0]);
|
||||||
*((UINT32*)(block+ 4)) = *((UINT32*)iv[1]);
|
*((Q_UINT32*)(block+ 4)) = *((Q_UINT32*)iv[1]);
|
||||||
*((UINT32*)(block+ 8)) = *((UINT32*)iv[2]);
|
*((Q_UINT32*)(block+ 8)) = *((Q_UINT32*)iv[2]);
|
||||||
*((UINT32*)(block+12)) = *((UINT32*)iv[3]);
|
*((Q_UINT32*)(block+12)) = *((Q_UINT32*)iv[3]);
|
||||||
encrypt(block,block);
|
encrypt(block,block);
|
||||||
outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
|
outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
|
||||||
iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
|
iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
|
||||||
|
@ -1123,10 +1123,10 @@ int Rijndael::blockEncrypt(const UINT8 *input,int inputLen,UINT8 *outBuffer)
|
||||||
return 128 * numBlocks;
|
return 128 * numBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rijndael::padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
int Rijndael::padEncrypt(const Q_UINT8 *input, int inputOctets, Q_UINT8 *outBuffer)
|
||||||
{
|
{
|
||||||
int i, numBlocks, padLen;
|
int i, numBlocks, padLen;
|
||||||
UINT8 block[16], *iv;
|
Q_UINT8 block[16], *iv;
|
||||||
|
|
||||||
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
||||||
if(m_direction != Encrypt) return RIJNDAEL_NOT_INITIALIZED;
|
if(m_direction != Encrypt) return RIJNDAEL_NOT_INITIALIZED;
|
||||||
|
@ -1154,10 +1154,10 @@ int Rijndael::padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
iv = m_initVector;
|
iv = m_initVector;
|
||||||
for(i = numBlocks; i > 0; i--)
|
for(i = numBlocks; i > 0; i--)
|
||||||
{
|
{
|
||||||
((UINT32*)block)[0] = ((UINT32*)input)[0] ^ ((UINT32*)iv)[0];
|
((Q_UINT32*)block)[0] = ((Q_UINT32*)input)[0] ^ ((Q_UINT32*)iv)[0];
|
||||||
((UINT32*)block)[1] = ((UINT32*)input)[1] ^ ((UINT32*)iv)[1];
|
((Q_UINT32*)block)[1] = ((Q_UINT32*)input)[1] ^ ((Q_UINT32*)iv)[1];
|
||||||
((UINT32*)block)[2] = ((UINT32*)input)[2] ^ ((UINT32*)iv)[2];
|
((Q_UINT32*)block)[2] = ((Q_UINT32*)input)[2] ^ ((Q_UINT32*)iv)[2];
|
||||||
((UINT32*)block)[3] = ((UINT32*)input)[3] ^ ((UINT32*)iv)[3];
|
((Q_UINT32*)block)[3] = ((Q_UINT32*)input)[3] ^ ((Q_UINT32*)iv)[3];
|
||||||
encrypt(block, outBuffer);
|
encrypt(block, outBuffer);
|
||||||
iv = outBuffer;
|
iv = outBuffer;
|
||||||
input += 16;
|
input += 16;
|
||||||
|
@ -1169,7 +1169,7 @@ int Rijndael::padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
block[i] = input[i] ^ iv[i];
|
block[i] = input[i] ^ iv[i];
|
||||||
}
|
}
|
||||||
for (i = 16 - padLen; i < 16; i++) {
|
for (i = 16 - padLen; i < 16; i++) {
|
||||||
block[i] = (UINT8)padLen ^ iv[i];
|
block[i] = (Q_UINT8)padLen ^ iv[i];
|
||||||
}
|
}
|
||||||
encrypt(block,outBuffer);
|
encrypt(block,outBuffer);
|
||||||
break;
|
break;
|
||||||
|
@ -1181,10 +1181,10 @@ int Rijndael::padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
return 16*(numBlocks + 1);
|
return 16*(numBlocks + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
|
int Rijndael::blockDecrypt(const Q_UINT8 *input, int inputLen, Q_UINT8 *outBuffer)
|
||||||
{
|
{
|
||||||
int i, k, numBlocks;
|
int i, k, numBlocks;
|
||||||
UINT8 block[16], iv[4][4];
|
Q_UINT8 block[16], iv[4][4];
|
||||||
|
|
||||||
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
||||||
if((m_mode != CFB1) && (m_direction == Encrypt)) return RIJNDAEL_BAD_DIRECTION;
|
if((m_mode != CFB1) && (m_direction == Encrypt)) return RIJNDAEL_BAD_DIRECTION;
|
||||||
|
@ -1207,26 +1207,26 @@ int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
|
||||||
#if STRICT_ALIGN
|
#if STRICT_ALIGN
|
||||||
memcpy(iv,m_initVector,16);
|
memcpy(iv,m_initVector,16);
|
||||||
#else
|
#else
|
||||||
*((UINT32*)iv[0]) = *((UINT32*)(m_initVector ));
|
*((Q_UINT32*)iv[0]) = *((Q_UINT32*)(m_initVector ));
|
||||||
*((UINT32*)iv[1]) = *((UINT32*)(m_initVector+ 4));
|
*((Q_UINT32*)iv[1]) = *((Q_UINT32*)(m_initVector+ 4));
|
||||||
*((UINT32*)iv[2]) = *((UINT32*)(m_initVector+ 8));
|
*((Q_UINT32*)iv[2]) = *((Q_UINT32*)(m_initVector+ 8));
|
||||||
*((UINT32*)iv[3]) = *((UINT32*)(m_initVector+12));
|
*((Q_UINT32*)iv[3]) = *((Q_UINT32*)(m_initVector+12));
|
||||||
#endif
|
#endif
|
||||||
for (i = numBlocks; i > 0; i--)
|
for (i = numBlocks; i > 0; i--)
|
||||||
{
|
{
|
||||||
decrypt(input, block);
|
decrypt(input, block);
|
||||||
((UINT32*)block)[0] ^= *((UINT32*)iv[0]);
|
((Q_UINT32*)block)[0] ^= *((Q_UINT32*)iv[0]);
|
||||||
((UINT32*)block)[1] ^= *((UINT32*)iv[1]);
|
((Q_UINT32*)block)[1] ^= *((Q_UINT32*)iv[1]);
|
||||||
((UINT32*)block)[2] ^= *((UINT32*)iv[2]);
|
((Q_UINT32*)block)[2] ^= *((Q_UINT32*)iv[2]);
|
||||||
((UINT32*)block)[3] ^= *((UINT32*)iv[3]);
|
((Q_UINT32*)block)[3] ^= *((Q_UINT32*)iv[3]);
|
||||||
#if STRICT_ALIGN
|
#if STRICT_ALIGN
|
||||||
memcpy(iv, input, 16);
|
memcpy(iv, input, 16);
|
||||||
memcpy(outBuf, block, 16);
|
memcpy(outBuf, block, 16);
|
||||||
#else
|
#else
|
||||||
*((UINT32*)iv[0]) = ((UINT32*)input)[0]; ((UINT32*)outBuffer)[0] = ((UINT32*)block)[0];
|
*((Q_UINT32*)iv[0]) = ((Q_UINT32*)input)[0]; ((Q_UINT32*)outBuffer)[0] = ((Q_UINT32*)block)[0];
|
||||||
*((UINT32*)iv[1]) = ((UINT32*)input)[1]; ((UINT32*)outBuffer)[1] = ((UINT32*)block)[1];
|
*((Q_UINT32*)iv[1]) = ((Q_UINT32*)input)[1]; ((Q_UINT32*)outBuffer)[1] = ((Q_UINT32*)block)[1];
|
||||||
*((UINT32*)iv[2]) = ((UINT32*)input)[2]; ((UINT32*)outBuffer)[2] = ((UINT32*)block)[2];
|
*((Q_UINT32*)iv[2]) = ((Q_UINT32*)input)[2]; ((Q_UINT32*)outBuffer)[2] = ((Q_UINT32*)block)[2];
|
||||||
*((UINT32*)iv[3]) = ((UINT32*)input)[3]; ((UINT32*)outBuffer)[3] = ((UINT32*)block)[3];
|
*((Q_UINT32*)iv[3]) = ((Q_UINT32*)input)[3]; ((Q_UINT32*)outBuffer)[3] = ((Q_UINT32*)block)[3];
|
||||||
#endif
|
#endif
|
||||||
input += 16;
|
input += 16;
|
||||||
outBuffer += 16;
|
outBuffer += 16;
|
||||||
|
@ -1236,19 +1236,19 @@ int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
|
||||||
#if STRICT_ALIGN
|
#if STRICT_ALIGN
|
||||||
memcpy(iv, m_initVector, 16);
|
memcpy(iv, m_initVector, 16);
|
||||||
#else
|
#else
|
||||||
*((UINT32*)iv[0]) = *((UINT32*)(m_initVector));
|
*((Q_UINT32*)iv[0]) = *((Q_UINT32*)(m_initVector));
|
||||||
*((UINT32*)iv[1]) = *((UINT32*)(m_initVector+ 4));
|
*((Q_UINT32*)iv[1]) = *((Q_UINT32*)(m_initVector+ 4));
|
||||||
*((UINT32*)iv[2]) = *((UINT32*)(m_initVector+ 8));
|
*((Q_UINT32*)iv[2]) = *((Q_UINT32*)(m_initVector+ 8));
|
||||||
*((UINT32*)iv[3]) = *((UINT32*)(m_initVector+12));
|
*((Q_UINT32*)iv[3]) = *((Q_UINT32*)(m_initVector+12));
|
||||||
#endif
|
#endif
|
||||||
for(i = numBlocks; i > 0; i--)
|
for(i = numBlocks; i > 0; i--)
|
||||||
{
|
{
|
||||||
for(k = 0; k < 128; k++)
|
for(k = 0; k < 128; k++)
|
||||||
{
|
{
|
||||||
*((UINT32*) block ) = *((UINT32*)iv[0]);
|
*((Q_UINT32*) block ) = *((Q_UINT32*)iv[0]);
|
||||||
*((UINT32*)(block+ 4)) = *((UINT32*)iv[1]);
|
*((Q_UINT32*)(block+ 4)) = *((Q_UINT32*)iv[1]);
|
||||||
*((UINT32*)(block+ 8)) = *((UINT32*)iv[2]);
|
*((Q_UINT32*)(block+ 8)) = *((Q_UINT32*)iv[2]);
|
||||||
*((UINT32*)(block+12)) = *((UINT32*)iv[3]);
|
*((Q_UINT32*)(block+12)) = *((Q_UINT32*)iv[3]);
|
||||||
encrypt(block, block);
|
encrypt(block, block);
|
||||||
iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
|
iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
|
||||||
iv[0][1] = (iv[0][1] << 1) | (iv[0][2] >> 7);
|
iv[0][1] = (iv[0][1] << 1) | (iv[0][2] >> 7);
|
||||||
|
@ -1278,11 +1278,11 @@ int Rijndael::blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer)
|
||||||
return 128*numBlocks;
|
return 128*numBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rijndael::padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
int Rijndael::padDecrypt(const Q_UINT8 *input, int inputOctets, Q_UINT8 *outBuffer)
|
||||||
{
|
{
|
||||||
int i, numBlocks, padLen;
|
int i, numBlocks, padLen;
|
||||||
UINT8 block[16];
|
Q_UINT8 block[16];
|
||||||
UINT32 iv[4];
|
Q_UINT32 iv[4];
|
||||||
|
|
||||||
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
if(m_state != Valid) return RIJNDAEL_NOT_INITIALIZED;
|
||||||
if(m_direction != Decrypt) return RIJNDAEL_BAD_DIRECTION;
|
if(m_direction != Decrypt) return RIJNDAEL_BAD_DIRECTION;
|
||||||
|
@ -1317,10 +1317,10 @@ int Rijndael::padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
for (i = numBlocks - 1; i > 0; i--)
|
for (i = numBlocks - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
decrypt(input, block);
|
decrypt(input, block);
|
||||||
((UINT32*)block)[0] ^= iv[0];
|
((Q_UINT32*)block)[0] ^= iv[0];
|
||||||
((UINT32*)block)[1] ^= iv[1];
|
((Q_UINT32*)block)[1] ^= iv[1];
|
||||||
((UINT32*)block)[2] ^= iv[2];
|
((Q_UINT32*)block)[2] ^= iv[2];
|
||||||
((UINT32*)block)[3] ^= iv[3];
|
((Q_UINT32*)block)[3] ^= iv[3];
|
||||||
memcpy(iv, input, 16);
|
memcpy(iv, input, 16);
|
||||||
memcpy(outBuffer, block, 16);
|
memcpy(outBuffer, block, 16);
|
||||||
input += 16;
|
input += 16;
|
||||||
|
@ -1328,10 +1328,10 @@ int Rijndael::padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
}
|
}
|
||||||
/* last block */
|
/* last block */
|
||||||
decrypt(input, block);
|
decrypt(input, block);
|
||||||
((UINT32*)block)[0] ^= iv[0];
|
((Q_UINT32*)block)[0] ^= iv[0];
|
||||||
((UINT32*)block)[1] ^= iv[1];
|
((Q_UINT32*)block)[1] ^= iv[1];
|
||||||
((UINT32*)block)[2] ^= iv[2];
|
((Q_UINT32*)block)[2] ^= iv[2];
|
||||||
((UINT32*)block)[3] ^= iv[3];
|
((Q_UINT32*)block)[3] ^= iv[3];
|
||||||
padLen = block[15];
|
padLen = block[15];
|
||||||
if((padLen <= 0) || (padLen > 16)) return RIJNDAEL_CORRUPTED_DATA;
|
if((padLen <= 0) || (padLen > 16)) return RIJNDAEL_CORRUPTED_DATA;
|
||||||
for(i = 16 - padLen; i < 16; i++)
|
for(i = 16 - padLen; i < 16; i++)
|
||||||
|
@ -1354,7 +1354,7 @@ int Rijndael::padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer)
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
void Rijndael::keySched(Q_UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
{
|
{
|
||||||
int j,rconpointer = 0;
|
int j,rconpointer = 0;
|
||||||
|
|
||||||
|
@ -1362,13 +1362,13 @@ void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
// The number of calculations depends on keyBits and blockBits
|
// The number of calculations depends on keyBits and blockBits
|
||||||
int uKeyColumns = m_uRounds - 6;
|
int uKeyColumns = m_uRounds - 6;
|
||||||
|
|
||||||
UINT8 tempKey[_MAX_KEY_COLUMNS][4];
|
Q_UINT8 tempKey[_MAX_KEY_COLUMNS][4];
|
||||||
|
|
||||||
// Copy the input key to the temporary key matrix
|
// Copy the input key to the temporary key matrix
|
||||||
|
|
||||||
for(j = 0;j < uKeyColumns;j++)
|
for(j = 0;j < uKeyColumns;j++)
|
||||||
{
|
{
|
||||||
*((UINT32*)(tempKey[j])) = *((UINT32*)(key[j]));
|
*((Q_UINT32*)(tempKey[j])) = *((Q_UINT32*)(key[j]));
|
||||||
}
|
}
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
@ -1379,7 +1379,7 @@ void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
{
|
{
|
||||||
for(;(j < uKeyColumns) && (t < 4); j++, t++)
|
for(;(j < uKeyColumns) && (t < 4); j++, t++)
|
||||||
{
|
{
|
||||||
*((UINT32*)m_expandedKey[r][t]) = *((UINT32*)tempKey[j]);
|
*((Q_UINT32*)m_expandedKey[r][t]) = *((Q_UINT32*)tempKey[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1402,12 +1402,12 @@ void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
{
|
{
|
||||||
for(j = 1; j < uKeyColumns; j++)
|
for(j = 1; j < uKeyColumns; j++)
|
||||||
{
|
{
|
||||||
*((UINT32*)tempKey[j]) ^= *((UINT32*)tempKey[j-1]);
|
*((Q_UINT32*)tempKey[j]) ^= *((Q_UINT32*)tempKey[j-1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(j = 1; j < uKeyColumns/2; j++)
|
for(j = 1; j < uKeyColumns/2; j++)
|
||||||
{
|
{
|
||||||
*((UINT32*)tempKey[j]) ^= *((UINT32*)tempKey[j-1]);
|
*((Q_UINT32*)tempKey[j]) ^= *((Q_UINT32*)tempKey[j-1]);
|
||||||
}
|
}
|
||||||
tempKey[uKeyColumns/2][0] ^= S[tempKey[uKeyColumns/2 - 1][0]];
|
tempKey[uKeyColumns/2][0] ^= S[tempKey[uKeyColumns/2 - 1][0]];
|
||||||
tempKey[uKeyColumns/2][1] ^= S[tempKey[uKeyColumns/2 - 1][1]];
|
tempKey[uKeyColumns/2][1] ^= S[tempKey[uKeyColumns/2 - 1][1]];
|
||||||
|
@ -1415,14 +1415,14 @@ void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
tempKey[uKeyColumns/2][3] ^= S[tempKey[uKeyColumns/2 - 1][3]];
|
tempKey[uKeyColumns/2][3] ^= S[tempKey[uKeyColumns/2 - 1][3]];
|
||||||
for(j = uKeyColumns/2 + 1; j < uKeyColumns; j++)
|
for(j = uKeyColumns/2 + 1; j < uKeyColumns; j++)
|
||||||
{
|
{
|
||||||
*((UINT32*)tempKey[j]) ^= *((UINT32*)tempKey[j-1]);
|
*((Q_UINT32*)tempKey[j]) ^= *((Q_UINT32*)tempKey[j-1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(j = 0; (j < uKeyColumns) && (r <= (int)m_uRounds); )
|
for(j = 0; (j < uKeyColumns) && (r <= (int)m_uRounds); )
|
||||||
{
|
{
|
||||||
for(; (j < uKeyColumns) && (t < 4); j++, t++)
|
for(; (j < uKeyColumns) && (t < 4); j++, t++)
|
||||||
{
|
{
|
||||||
*((UINT32*)m_expandedKey[r][t]) = *((UINT32*)tempKey[j]);
|
*((Q_UINT32*)m_expandedKey[r][t]) = *((Q_UINT32*)tempKey[j]);
|
||||||
}
|
}
|
||||||
if(t == 4)
|
if(t == 4)
|
||||||
{
|
{
|
||||||
|
@ -1436,74 +1436,74 @@ void Rijndael::keySched(UINT8 key[_MAX_KEY_COLUMNS][4])
|
||||||
void Rijndael::keyEncToDec()
|
void Rijndael::keyEncToDec()
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
UINT8 *w;
|
Q_UINT8 *w;
|
||||||
|
|
||||||
for(r = 1; r < (int)m_uRounds; r++)
|
for(r = 1; r < (int)m_uRounds; r++)
|
||||||
{
|
{
|
||||||
w = m_expandedKey[r][0];
|
w = m_expandedKey[r][0];
|
||||||
*((UINT32*)w) = *((UINT32*)U1[w[0]]) ^ *((UINT32*)U2[w[1]]) ^ *((UINT32*)U3[w[2]]) ^ *((UINT32*)U4[w[3]]);
|
*((Q_UINT32*)w) = *((Q_UINT32*)U1[w[0]]) ^ *((Q_UINT32*)U2[w[1]]) ^ *((Q_UINT32*)U3[w[2]]) ^ *((Q_UINT32*)U4[w[3]]);
|
||||||
w = m_expandedKey[r][1];
|
w = m_expandedKey[r][1];
|
||||||
*((UINT32*)w) = *((UINT32*)U1[w[0]]) ^ *((UINT32*)U2[w[1]]) ^ *((UINT32*)U3[w[2]]) ^ *((UINT32*)U4[w[3]]);
|
*((Q_UINT32*)w) = *((Q_UINT32*)U1[w[0]]) ^ *((Q_UINT32*)U2[w[1]]) ^ *((Q_UINT32*)U3[w[2]]) ^ *((Q_UINT32*)U4[w[3]]);
|
||||||
w = m_expandedKey[r][2];
|
w = m_expandedKey[r][2];
|
||||||
*((UINT32*)w) = *((UINT32*)U1[w[0]]) ^ *((UINT32*)U2[w[1]]) ^ *((UINT32*)U3[w[2]]) ^ *((UINT32*)U4[w[3]]);
|
*((Q_UINT32*)w) = *((Q_UINT32*)U1[w[0]]) ^ *((Q_UINT32*)U2[w[1]]) ^ *((Q_UINT32*)U3[w[2]]) ^ *((Q_UINT32*)U4[w[3]]);
|
||||||
w = m_expandedKey[r][3];
|
w = m_expandedKey[r][3];
|
||||||
*((UINT32*)w) = *((UINT32*)U1[w[0]]) ^ *((UINT32*)U2[w[1]]) ^ *((UINT32*)U3[w[2]]) ^ *((UINT32*)U4[w[3]]);
|
*((Q_UINT32*)w) = *((Q_UINT32*)U1[w[0]]) ^ *((Q_UINT32*)U2[w[1]]) ^ *((Q_UINT32*)U3[w[2]]) ^ *((Q_UINT32*)U4[w[3]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rijndael::encrypt(const UINT8 a[16], UINT8 b[16])
|
void Rijndael::encrypt(const Q_UINT8 a[16], Q_UINT8 b[16])
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
UINT8 temp[4][4];
|
Q_UINT8 temp[4][4];
|
||||||
|
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(a )) ^ *((UINT32*)m_expandedKey[0][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(a )) ^ *((Q_UINT32*)m_expandedKey[0][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(a+ 4)) ^ *((UINT32*)m_expandedKey[0][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(a+ 4)) ^ *((Q_UINT32*)m_expandedKey[0][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(a+ 8)) ^ *((UINT32*)m_expandedKey[0][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(a+ 8)) ^ *((Q_UINT32*)m_expandedKey[0][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(a+12)) ^ *((UINT32*)m_expandedKey[0][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(a+12)) ^ *((Q_UINT32*)m_expandedKey[0][3]);
|
||||||
*((UINT32*)(b )) = *((UINT32*)T1[temp[0][0]])
|
*((Q_UINT32*)(b )) = *((Q_UINT32*)T1[temp[0][0]])
|
||||||
^ *((UINT32*)T2[temp[1][1]])
|
^ *((Q_UINT32*)T2[temp[1][1]])
|
||||||
^ *((UINT32*)T3[temp[2][2]])
|
^ *((Q_UINT32*)T3[temp[2][2]])
|
||||||
^ *((UINT32*)T4[temp[3][3]]);
|
^ *((Q_UINT32*)T4[temp[3][3]]);
|
||||||
*((UINT32*)(b + 4)) = *((UINT32*)T1[temp[1][0]])
|
*((Q_UINT32*)(b + 4)) = *((Q_UINT32*)T1[temp[1][0]])
|
||||||
^ *((UINT32*)T2[temp[2][1]])
|
^ *((Q_UINT32*)T2[temp[2][1]])
|
||||||
^ *((UINT32*)T3[temp[3][2]])
|
^ *((Q_UINT32*)T3[temp[3][2]])
|
||||||
^ *((UINT32*)T4[temp[0][3]]);
|
^ *((Q_UINT32*)T4[temp[0][3]]);
|
||||||
*((UINT32*)(b + 8)) = *((UINT32*)T1[temp[2][0]])
|
*((Q_UINT32*)(b + 8)) = *((Q_UINT32*)T1[temp[2][0]])
|
||||||
^ *((UINT32*)T2[temp[3][1]])
|
^ *((Q_UINT32*)T2[temp[3][1]])
|
||||||
^ *((UINT32*)T3[temp[0][2]])
|
^ *((Q_UINT32*)T3[temp[0][2]])
|
||||||
^ *((UINT32*)T4[temp[1][3]]);
|
^ *((Q_UINT32*)T4[temp[1][3]]);
|
||||||
*((UINT32*)(b +12)) = *((UINT32*)T1[temp[3][0]])
|
*((Q_UINT32*)(b +12)) = *((Q_UINT32*)T1[temp[3][0]])
|
||||||
^ *((UINT32*)T2[temp[0][1]])
|
^ *((Q_UINT32*)T2[temp[0][1]])
|
||||||
^ *((UINT32*)T3[temp[1][2]])
|
^ *((Q_UINT32*)T3[temp[1][2]])
|
||||||
^ *((UINT32*)T4[temp[2][3]]);
|
^ *((Q_UINT32*)T4[temp[2][3]]);
|
||||||
for(r = 1; r < (int)m_uRounds-1; r++)
|
for(r = 1; r < (int)m_uRounds-1; r++)
|
||||||
{
|
{
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)m_expandedKey[r][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(b )) ^ *((Q_UINT32*)m_expandedKey[r][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(b+ 4)) ^ *((UINT32*)m_expandedKey[r][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(b+ 4)) ^ *((Q_UINT32*)m_expandedKey[r][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(b+ 8)) ^ *((UINT32*)m_expandedKey[r][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(b+ 8)) ^ *((Q_UINT32*)m_expandedKey[r][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(b+12)) ^ *((UINT32*)m_expandedKey[r][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(b+12)) ^ *((Q_UINT32*)m_expandedKey[r][3]);
|
||||||
|
|
||||||
*((UINT32*)(b )) = *((UINT32*)T1[temp[0][0]])
|
*((Q_UINT32*)(b )) = *((Q_UINT32*)T1[temp[0][0]])
|
||||||
^ *((UINT32*)T2[temp[1][1]])
|
^ *((Q_UINT32*)T2[temp[1][1]])
|
||||||
^ *((UINT32*)T3[temp[2][2]])
|
^ *((Q_UINT32*)T3[temp[2][2]])
|
||||||
^ *((UINT32*)T4[temp[3][3]]);
|
^ *((Q_UINT32*)T4[temp[3][3]]);
|
||||||
*((UINT32*)(b + 4)) = *((UINT32*)T1[temp[1][0]])
|
*((Q_UINT32*)(b + 4)) = *((Q_UINT32*)T1[temp[1][0]])
|
||||||
^ *((UINT32*)T2[temp[2][1]])
|
^ *((Q_UINT32*)T2[temp[2][1]])
|
||||||
^ *((UINT32*)T3[temp[3][2]])
|
^ *((Q_UINT32*)T3[temp[3][2]])
|
||||||
^ *((UINT32*)T4[temp[0][3]]);
|
^ *((Q_UINT32*)T4[temp[0][3]]);
|
||||||
*((UINT32*)(b + 8)) = *((UINT32*)T1[temp[2][0]])
|
*((Q_UINT32*)(b + 8)) = *((Q_UINT32*)T1[temp[2][0]])
|
||||||
^ *((UINT32*)T2[temp[3][1]])
|
^ *((Q_UINT32*)T2[temp[3][1]])
|
||||||
^ *((UINT32*)T3[temp[0][2]])
|
^ *((Q_UINT32*)T3[temp[0][2]])
|
||||||
^ *((UINT32*)T4[temp[1][3]]);
|
^ *((Q_UINT32*)T4[temp[1][3]]);
|
||||||
*((UINT32*)(b +12)) = *((UINT32*)T1[temp[3][0]])
|
*((Q_UINT32*)(b +12)) = *((Q_UINT32*)T1[temp[3][0]])
|
||||||
^ *((UINT32*)T2[temp[0][1]])
|
^ *((Q_UINT32*)T2[temp[0][1]])
|
||||||
^ *((UINT32*)T3[temp[1][2]])
|
^ *((Q_UINT32*)T3[temp[1][2]])
|
||||||
^ *((UINT32*)T4[temp[2][3]]);
|
^ *((Q_UINT32*)T4[temp[2][3]]);
|
||||||
}
|
}
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)m_expandedKey[m_uRounds-1][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(b )) ^ *((Q_UINT32*)m_expandedKey[m_uRounds-1][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(b+ 4)) ^ *((UINT32*)m_expandedKey[m_uRounds-1][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(b+ 4)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds-1][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(b+ 8)) ^ *((UINT32*)m_expandedKey[m_uRounds-1][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(b+ 8)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds-1][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(b+12)) ^ *((UINT32*)m_expandedKey[m_uRounds-1][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(b+12)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds-1][3]);
|
||||||
b[ 0] = T1[temp[0][0]][1];
|
b[ 0] = T1[temp[0][0]][1];
|
||||||
b[ 1] = T1[temp[1][1]][1];
|
b[ 1] = T1[temp[1][1]][1];
|
||||||
b[ 2] = T1[temp[2][2]][1];
|
b[ 2] = T1[temp[2][2]][1];
|
||||||
|
@ -1520,66 +1520,66 @@ void Rijndael::encrypt(const UINT8 a[16], UINT8 b[16])
|
||||||
b[13] = T1[temp[0][1]][1];
|
b[13] = T1[temp[0][1]][1];
|
||||||
b[14] = T1[temp[1][2]][1];
|
b[14] = T1[temp[1][2]][1];
|
||||||
b[15] = T1[temp[2][3]][1];
|
b[15] = T1[temp[2][3]][1];
|
||||||
*((UINT32*)(b )) ^= *((UINT32*)m_expandedKey[m_uRounds][0]);
|
*((Q_UINT32*)(b )) ^= *((Q_UINT32*)m_expandedKey[m_uRounds][0]);
|
||||||
*((UINT32*)(b+ 4)) ^= *((UINT32*)m_expandedKey[m_uRounds][1]);
|
*((Q_UINT32*)(b+ 4)) ^= *((Q_UINT32*)m_expandedKey[m_uRounds][1]);
|
||||||
*((UINT32*)(b+ 8)) ^= *((UINT32*)m_expandedKey[m_uRounds][2]);
|
*((Q_UINT32*)(b+ 8)) ^= *((Q_UINT32*)m_expandedKey[m_uRounds][2]);
|
||||||
*((UINT32*)(b+12)) ^= *((UINT32*)m_expandedKey[m_uRounds][3]);
|
*((Q_UINT32*)(b+12)) ^= *((Q_UINT32*)m_expandedKey[m_uRounds][3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rijndael::decrypt(const UINT8 a[16], UINT8 b[16])
|
void Rijndael::decrypt(const Q_UINT8 a[16], Q_UINT8 b[16])
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
UINT8 temp[4][4];
|
Q_UINT8 temp[4][4];
|
||||||
|
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(a )) ^ *((UINT32*)m_expandedKey[m_uRounds][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(a )) ^ *((Q_UINT32*)m_expandedKey[m_uRounds][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(a+ 4)) ^ *((UINT32*)m_expandedKey[m_uRounds][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(a+ 4)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(a+ 8)) ^ *((UINT32*)m_expandedKey[m_uRounds][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(a+ 8)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(a+12)) ^ *((UINT32*)m_expandedKey[m_uRounds][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(a+12)) ^ *((Q_UINT32*)m_expandedKey[m_uRounds][3]);
|
||||||
|
|
||||||
*((UINT32*)(b )) = *((UINT32*)T5[temp[0][0]])
|
*((Q_UINT32*)(b )) = *((Q_UINT32*)T5[temp[0][0]])
|
||||||
^ *((UINT32*)T6[temp[3][1]])
|
^ *((Q_UINT32*)T6[temp[3][1]])
|
||||||
^ *((UINT32*)T7[temp[2][2]])
|
^ *((Q_UINT32*)T7[temp[2][2]])
|
||||||
^ *((UINT32*)T8[temp[1][3]]);
|
^ *((Q_UINT32*)T8[temp[1][3]]);
|
||||||
*((UINT32*)(b+ 4)) = *((UINT32*)T5[temp[1][0]])
|
*((Q_UINT32*)(b+ 4)) = *((Q_UINT32*)T5[temp[1][0]])
|
||||||
^ *((UINT32*)T6[temp[0][1]])
|
^ *((Q_UINT32*)T6[temp[0][1]])
|
||||||
^ *((UINT32*)T7[temp[3][2]])
|
^ *((Q_UINT32*)T7[temp[3][2]])
|
||||||
^ *((UINT32*)T8[temp[2][3]]);
|
^ *((Q_UINT32*)T8[temp[2][3]]);
|
||||||
*((UINT32*)(b+ 8)) = *((UINT32*)T5[temp[2][0]])
|
*((Q_UINT32*)(b+ 8)) = *((Q_UINT32*)T5[temp[2][0]])
|
||||||
^ *((UINT32*)T6[temp[1][1]])
|
^ *((Q_UINT32*)T6[temp[1][1]])
|
||||||
^ *((UINT32*)T7[temp[0][2]])
|
^ *((Q_UINT32*)T7[temp[0][2]])
|
||||||
^ *((UINT32*)T8[temp[3][3]]);
|
^ *((Q_UINT32*)T8[temp[3][3]]);
|
||||||
*((UINT32*)(b+12)) = *((UINT32*)T5[temp[3][0]])
|
*((Q_UINT32*)(b+12)) = *((Q_UINT32*)T5[temp[3][0]])
|
||||||
^ *((UINT32*)T6[temp[2][1]])
|
^ *((Q_UINT32*)T6[temp[2][1]])
|
||||||
^ *((UINT32*)T7[temp[1][2]])
|
^ *((Q_UINT32*)T7[temp[1][2]])
|
||||||
^ *((UINT32*)T8[temp[0][3]]);
|
^ *((Q_UINT32*)T8[temp[0][3]]);
|
||||||
for(r = m_uRounds-1; r > 1; r--)
|
for(r = m_uRounds-1; r > 1; r--)
|
||||||
{
|
{
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)m_expandedKey[r][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(b )) ^ *((Q_UINT32*)m_expandedKey[r][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(b+ 4)) ^ *((UINT32*)m_expandedKey[r][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(b+ 4)) ^ *((Q_UINT32*)m_expandedKey[r][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(b+ 8)) ^ *((UINT32*)m_expandedKey[r][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(b+ 8)) ^ *((Q_UINT32*)m_expandedKey[r][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(b+12)) ^ *((UINT32*)m_expandedKey[r][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(b+12)) ^ *((Q_UINT32*)m_expandedKey[r][3]);
|
||||||
*((UINT32*)(b )) = *((UINT32*)T5[temp[0][0]])
|
*((Q_UINT32*)(b )) = *((Q_UINT32*)T5[temp[0][0]])
|
||||||
^ *((UINT32*)T6[temp[3][1]])
|
^ *((Q_UINT32*)T6[temp[3][1]])
|
||||||
^ *((UINT32*)T7[temp[2][2]])
|
^ *((Q_UINT32*)T7[temp[2][2]])
|
||||||
^ *((UINT32*)T8[temp[1][3]]);
|
^ *((Q_UINT32*)T8[temp[1][3]]);
|
||||||
*((UINT32*)(b+ 4)) = *((UINT32*)T5[temp[1][0]])
|
*((Q_UINT32*)(b+ 4)) = *((Q_UINT32*)T5[temp[1][0]])
|
||||||
^ *((UINT32*)T6[temp[0][1]])
|
^ *((Q_UINT32*)T6[temp[0][1]])
|
||||||
^ *((UINT32*)T7[temp[3][2]])
|
^ *((Q_UINT32*)T7[temp[3][2]])
|
||||||
^ *((UINT32*)T8[temp[2][3]]);
|
^ *((Q_UINT32*)T8[temp[2][3]]);
|
||||||
*((UINT32*)(b+ 8)) = *((UINT32*)T5[temp[2][0]])
|
*((Q_UINT32*)(b+ 8)) = *((Q_UINT32*)T5[temp[2][0]])
|
||||||
^ *((UINT32*)T6[temp[1][1]])
|
^ *((Q_UINT32*)T6[temp[1][1]])
|
||||||
^ *((UINT32*)T7[temp[0][2]])
|
^ *((Q_UINT32*)T7[temp[0][2]])
|
||||||
^ *((UINT32*)T8[temp[3][3]]);
|
^ *((Q_UINT32*)T8[temp[3][3]]);
|
||||||
*((UINT32*)(b+12)) = *((UINT32*)T5[temp[3][0]])
|
*((Q_UINT32*)(b+12)) = *((Q_UINT32*)T5[temp[3][0]])
|
||||||
^ *((UINT32*)T6[temp[2][1]])
|
^ *((Q_UINT32*)T6[temp[2][1]])
|
||||||
^ *((UINT32*)T7[temp[1][2]])
|
^ *((Q_UINT32*)T7[temp[1][2]])
|
||||||
^ *((UINT32*)T8[temp[0][3]]);
|
^ *((Q_UINT32*)T8[temp[0][3]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
*((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)m_expandedKey[1][0]);
|
*((Q_UINT32*)temp[0]) = *((Q_UINT32*)(b )) ^ *((Q_UINT32*)m_expandedKey[1][0]);
|
||||||
*((UINT32*)temp[1]) = *((UINT32*)(b+ 4)) ^ *((UINT32*)m_expandedKey[1][1]);
|
*((Q_UINT32*)temp[1]) = *((Q_UINT32*)(b+ 4)) ^ *((Q_UINT32*)m_expandedKey[1][1]);
|
||||||
*((UINT32*)temp[2]) = *((UINT32*)(b+ 8)) ^ *((UINT32*)m_expandedKey[1][2]);
|
*((Q_UINT32*)temp[2]) = *((Q_UINT32*)(b+ 8)) ^ *((Q_UINT32*)m_expandedKey[1][2]);
|
||||||
*((UINT32*)temp[3]) = *((UINT32*)(b+12)) ^ *((UINT32*)m_expandedKey[1][3]);
|
*((Q_UINT32*)temp[3]) = *((Q_UINT32*)(b+12)) ^ *((Q_UINT32*)m_expandedKey[1][3]);
|
||||||
b[ 0] = S5[temp[0][0]];
|
b[ 0] = S5[temp[0][0]];
|
||||||
b[ 1] = S5[temp[3][1]];
|
b[ 1] = S5[temp[3][1]];
|
||||||
b[ 2] = S5[temp[2][2]];
|
b[ 2] = S5[temp[2][2]];
|
||||||
|
@ -1596,10 +1596,10 @@ void Rijndael::decrypt(const UINT8 a[16], UINT8 b[16])
|
||||||
b[13] = S5[temp[2][1]];
|
b[13] = S5[temp[2][1]];
|
||||||
b[14] = S5[temp[1][2]];
|
b[14] = S5[temp[1][2]];
|
||||||
b[15] = S5[temp[0][3]];
|
b[15] = S5[temp[0][3]];
|
||||||
*((UINT32*)(b )) ^= *((UINT32*)m_expandedKey[0][0]);
|
*((Q_UINT32*)(b )) ^= *((Q_UINT32*)m_expandedKey[0][0]);
|
||||||
*((UINT32*)(b+ 4)) ^= *((UINT32*)m_expandedKey[0][1]);
|
*((Q_UINT32*)(b+ 4)) ^= *((Q_UINT32*)m_expandedKey[0][1]);
|
||||||
*((UINT32*)(b+ 8)) ^= *((UINT32*)m_expandedKey[0][2]);
|
*((Q_UINT32*)(b+ 8)) ^= *((Q_UINT32*)m_expandedKey[0][2]);
|
||||||
*((UINT32*)(b+12)) ^= *((UINT32*)m_expandedKey[0][3]);
|
*((Q_UINT32*)(b+12)) ^= *((Q_UINT32*)m_expandedKey[0][3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,9 +101,9 @@ protected:
|
||||||
State m_state;
|
State m_state;
|
||||||
Mode m_mode;
|
Mode m_mode;
|
||||||
Direction m_direction;
|
Direction m_direction;
|
||||||
UINT8 m_initVector[MAX_IV_SIZE];
|
Q_UINT8 m_initVector[MAX_IV_SIZE];
|
||||||
UINT32 m_uRounds;
|
Q_UINT32 m_uRounds;
|
||||||
UINT8 m_expandedKey[_MAX_ROUNDS+1][4][4];
|
Q_UINT8 m_expandedKey[_MAX_ROUNDS+1][4][4];
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// API
|
// API
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
// this CAN be binary data (it is not expected to be null terminated)
|
// this CAN be binary data (it is not expected to be null terminated)
|
||||||
// keyLen : Rijndael::Key16Bytes , Rijndael::Key24Bytes or Rijndael::Key32Bytes
|
// keyLen : Rijndael::Key16Bytes , Rijndael::Key24Bytes or Rijndael::Key32Bytes
|
||||||
// initVector: initialization vector, you will usually use 0 here
|
// initVector: initialization vector, you will usually use 0 here
|
||||||
int init(Mode mode,Direction dir,const UINT8 *key,KeyLength keyLen,UINT8 * initVector = 0);
|
int init(Mode mode,Direction dir,const Q_UINT8 *key,KeyLength keyLen,Q_UINT8 * initVector = 0);
|
||||||
// Encrypts the input array (can be binary data)
|
// Encrypts the input array (can be binary data)
|
||||||
// The input array length must be a multiple of 16 bytes, the remaining part
|
// The input array length must be a multiple of 16 bytes, the remaining part
|
||||||
// is DISCARDED.
|
// is DISCARDED.
|
||||||
|
@ -131,28 +131,28 @@ public:
|
||||||
// Input len is in BITS!
|
// Input len is in BITS!
|
||||||
// outBuffer must be at least inputLen / 8 bytes long.
|
// outBuffer must be at least inputLen / 8 bytes long.
|
||||||
// Returns the encrypted buffer length in BITS or an error code < 0 in case of error
|
// Returns the encrypted buffer length in BITS or an error code < 0 in case of error
|
||||||
int blockEncrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer);
|
int blockEncrypt(const Q_UINT8 *input, int inputLen, Q_UINT8 *outBuffer);
|
||||||
// Encrypts the input array (can be binary data)
|
// Encrypts the input array (can be binary data)
|
||||||
// The input array can be any length , it is automatically padded on a 16 byte boundary.
|
// The input array can be any length , it is automatically padded on a 16 byte boundary.
|
||||||
// Input len is in BYTES!
|
// Input len is in BYTES!
|
||||||
// outBuffer must be at least (inputLen + 16) bytes long
|
// outBuffer must be at least (inputLen + 16) bytes long
|
||||||
// Returns the encrypted buffer length in BYTES or an error code < 0 in case of error
|
// Returns the encrypted buffer length in BYTES or an error code < 0 in case of error
|
||||||
int padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer);
|
int padEncrypt(const Q_UINT8 *input, int inputOctets, Q_UINT8 *outBuffer);
|
||||||
// Decrypts the input vector
|
// Decrypts the input vector
|
||||||
// Input len is in BITS!
|
// Input len is in BITS!
|
||||||
// outBuffer must be at least inputLen / 8 bytes long
|
// outBuffer must be at least inputLen / 8 bytes long
|
||||||
// Returns the decrypted buffer length in BITS and an error code < 0 in case of error
|
// Returns the decrypted buffer length in BITS and an error code < 0 in case of error
|
||||||
int blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer);
|
int blockDecrypt(const Q_UINT8 *input, int inputLen, Q_UINT8 *outBuffer);
|
||||||
// Decrypts the input vector
|
// Decrypts the input vector
|
||||||
// Input len is in BYTES!
|
// Input len is in BYTES!
|
||||||
// outBuffer must be at least inputLen bytes long
|
// outBuffer must be at least inputLen bytes long
|
||||||
// Returns the decrypted buffer length in BYTES and an error code < 0 in case of error
|
// Returns the decrypted buffer length in BYTES and an error code < 0 in case of error
|
||||||
int padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer);
|
int padDecrypt(const Q_UINT8 *input, int inputOctets, Q_UINT8 *outBuffer);
|
||||||
protected:
|
protected:
|
||||||
void keySched(UINT8 key[_MAX_KEY_COLUMNS][4]);
|
void keySched(Q_UINT8 key[_MAX_KEY_COLUMNS][4]);
|
||||||
void keyEncToDec();
|
void keyEncToDec();
|
||||||
void encrypt(const UINT8 a[16], UINT8 b[16]);
|
void encrypt(const Q_UINT8 a[16], Q_UINT8 b[16]);
|
||||||
void decrypt(const UINT8 a[16], UINT8 b[16]);
|
void decrypt(const Q_UINT8 a[16], Q_UINT8 b[16]);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RIJNDAEL_H_
|
#endif // _RIJNDAEL_H_
|
||||||
|
|
|
@ -76,7 +76,7 @@ void CSHA1::Reset()
|
||||||
}
|
}
|
||||||
void CSHA1::Update(unsigned char* data, int len){
|
void CSHA1::Update(unsigned char* data, int len){
|
||||||
|
|
||||||
UINT_32 i, j;
|
Q_UINT_32 i, j;
|
||||||
|
|
||||||
j = (m_count[0] >> 3) & 63;
|
j = (m_count[0] >> 3) & 63;
|
||||||
|
|
||||||
|
@ -102,10 +102,10 @@ void CSHA1::Update(unsigned char* data, int len){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CSHA1::Transform(UINT_32 *state, UINT_8 *buffer)
|
void CSHA1::Transform(Q_UINT_32 *state, Q_UINT_8 *buffer)
|
||||||
{
|
{
|
||||||
// Copy state[] to working vars
|
// Copy state[] to working vars
|
||||||
UINT_32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
|
Q_UINT_32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
|
||||||
|
|
||||||
memcpy(m_block, buffer, 64);
|
memcpy(m_block, buffer, 64);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ bool CSHA1::HashFile(char *szFileName)
|
||||||
{
|
{
|
||||||
unsigned long ulFileSize, ulRest, ulBlocks;
|
unsigned long ulFileSize, ulRest, ulBlocks;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
UINT_8 uData[SHA1_MAX_FILE_BUFFER];
|
Q_UINT_8 uData[SHA1_MAX_FILE_BUFFER];
|
||||||
FILE *fIn;
|
FILE *fIn;
|
||||||
|
|
||||||
if(szFileName == NULL) return false;
|
if(szFileName == NULL) return false;
|
||||||
|
@ -176,13 +176,13 @@ bool CSHA1::HashFile(char *szFileName)
|
||||||
for(i = 0; i < ulBlocks; i++)
|
for(i = 0; i < ulBlocks; i++)
|
||||||
{
|
{
|
||||||
fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
|
fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
|
||||||
Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
|
Update((Q_UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ulRest != 0)
|
if(ulRest != 0)
|
||||||
{
|
{
|
||||||
fread(uData, 1, ulRest, fIn);
|
fread(uData, 1, ulRest, fIn);
|
||||||
Update((UINT_8 *)uData, ulRest);
|
Update((Q_UINT_8 *)uData, ulRest);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fIn); fIn = NULL;
|
fclose(fIn); fIn = NULL;
|
||||||
|
@ -191,23 +191,23 @@ bool CSHA1::HashFile(char *szFileName)
|
||||||
|
|
||||||
void CSHA1::Final()
|
void CSHA1::Final()
|
||||||
{
|
{
|
||||||
UINT_32 i;
|
Q_UINT_32 i;
|
||||||
UINT_8 finalcount[8];
|
Q_UINT_8 finalcount[8];
|
||||||
|
|
||||||
for(i = 0; i < 8; i++)
|
for(i = 0; i < 8; i++)
|
||||||
finalcount[i] = (UINT_8)((m_count[((i >= 4) ? 0 : 1)]
|
finalcount[i] = (Q_UINT_8)((m_count[((i >= 4) ? 0 : 1)]
|
||||||
>> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
|
>> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
|
||||||
|
|
||||||
Update((UINT_8 *)"\200", 1);
|
Update((Q_UINT_8 *)"\200", 1);
|
||||||
|
|
||||||
while ((m_count[0] & 504) != 448)
|
while ((m_count[0] & 504) != 448)
|
||||||
Update((UINT_8 *)"\0", 1);
|
Update((Q_UINT_8 *)"\0", 1);
|
||||||
|
|
||||||
Update(finalcount, 8); // Cause a SHA1Transform()
|
Update(finalcount, 8); // Cause a SHA1Transform()
|
||||||
|
|
||||||
for(i = 0; i < 20; i++)
|
for(i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
m_digest[i] = (UINT_8)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
|
m_digest[i] = (Q_UINT_8)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wipe variables for security reasons
|
// Wipe variables for security reasons
|
||||||
|
@ -255,7 +255,7 @@ void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the raw message digest
|
// Get the raw message digest
|
||||||
void CSHA1::GetHash(UINT_8 *puDest)
|
void CSHA1::GetHash(Q_UINT_8 *puDest)
|
||||||
{
|
{
|
||||||
memcpy(puDest, m_digest, 20);
|
memcpy(puDest, m_digest, 20);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,12 +38,12 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Define 8- and 32-bit variables
|
// Define 8- and 32-bit variables
|
||||||
|
|
||||||
#ifndef UINT_32
|
#ifndef Q_UINT_32
|
||||||
#define UINT_8 unsigned char
|
#define Q_UINT_8 unsigned char
|
||||||
#if (ULONG_MAX == 0xFFFFFFFF)
|
#if (ULONG_MAX == 0xFFFFFFFF)
|
||||||
#define UINT_32 unsigned long
|
#define Q_UINT_32 unsigned long
|
||||||
#else
|
#else
|
||||||
#define UINT_32 unsigned int
|
#define Q_UINT_32 unsigned int
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
UINT_8 c[64];
|
Q_UINT_8 c[64];
|
||||||
UINT_32 l[16];
|
Q_UINT_32 l[16];
|
||||||
} SHA1_WORKSPACE_BLOCK;
|
} SHA1_WORKSPACE_BLOCK;
|
||||||
|
|
||||||
class CSHA1
|
class CSHA1
|
||||||
|
@ -71,10 +71,10 @@ public:
|
||||||
CSHA1();
|
CSHA1();
|
||||||
~CSHA1();
|
~CSHA1();
|
||||||
|
|
||||||
UINT_32 m_state[5];
|
Q_UINT_32 m_state[5];
|
||||||
UINT_32 m_count[2];
|
Q_UINT_32 m_count[2];
|
||||||
UINT_8 m_buffer[64];
|
Q_UINT_8 m_buffer[64];
|
||||||
UINT_8 m_digest[20];
|
Q_UINT_8 m_digest[20];
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
@ -85,14 +85,14 @@ public:
|
||||||
// Finalize hash and report
|
// Finalize hash and report
|
||||||
void Final();
|
void Final();
|
||||||
void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
|
void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
|
||||||
void GetHash(UINT_8 *puDest);
|
void GetHash(Q_UINT_8 *puDest);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private SHA-1 transformation
|
// Private SHA-1 transformation
|
||||||
void Transform(UINT_32 *state, UINT_8 *buffer);
|
void Transform(Q_UINT_32 *state, Q_UINT_8 *buffer);
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
UINT_8 m_workspace[64];
|
Q_UINT_8 m_workspace[64];
|
||||||
SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
|
SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "sha256.h"
|
#include "sha256.h"
|
||||||
|
|
||||||
#define GET_UINT32(n,b,i) \
|
#define GET_Q_UINT32(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(n) = ( (uint32) (b)[(i) ] << 24 ) \
|
(n) = ( (uint32) (b)[(i) ] << 24 ) \
|
||||||
| ( (uint32) (b)[(i) + 1] << 16 ) \
|
| ( (uint32) (b)[(i) + 1] << 16 ) \
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
| ( (uint32) (b)[(i) + 3] ); \
|
| ( (uint32) (b)[(i) + 3] ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PUT_UINT32(n,b,i) \
|
#define PUT_Q_UINT32(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(b)[(i) ] = (uint8) ( (n) >> 24 ); \
|
(b)[(i) ] = (uint8) ( (n) >> 24 ); \
|
||||||
(b)[(i) + 1] = (uint8) ( (n) >> 16 ); \
|
(b)[(i) + 1] = (uint8) ( (n) >> 16 ); \
|
||||||
|
@ -58,22 +58,22 @@ void sha256_process( sha256_context *ctx, uint8 data[64] )
|
||||||
uint32 temp1, temp2, W[64];
|
uint32 temp1, temp2, W[64];
|
||||||
uint32 A, B, C, D, E, F, G, H;
|
uint32 A, B, C, D, E, F, G, H;
|
||||||
|
|
||||||
GET_UINT32( W[0], data, 0 );
|
GET_Q_UINT32( W[0], data, 0 );
|
||||||
GET_UINT32( W[1], data, 4 );
|
GET_Q_UINT32( W[1], data, 4 );
|
||||||
GET_UINT32( W[2], data, 8 );
|
GET_Q_UINT32( W[2], data, 8 );
|
||||||
GET_UINT32( W[3], data, 12 );
|
GET_Q_UINT32( W[3], data, 12 );
|
||||||
GET_UINT32( W[4], data, 16 );
|
GET_Q_UINT32( W[4], data, 16 );
|
||||||
GET_UINT32( W[5], data, 20 );
|
GET_Q_UINT32( W[5], data, 20 );
|
||||||
GET_UINT32( W[6], data, 24 );
|
GET_Q_UINT32( W[6], data, 24 );
|
||||||
GET_UINT32( W[7], data, 28 );
|
GET_Q_UINT32( W[7], data, 28 );
|
||||||
GET_UINT32( W[8], data, 32 );
|
GET_Q_UINT32( W[8], data, 32 );
|
||||||
GET_UINT32( W[9], data, 36 );
|
GET_Q_UINT32( W[9], data, 36 );
|
||||||
GET_UINT32( W[10], data, 40 );
|
GET_Q_UINT32( W[10], data, 40 );
|
||||||
GET_UINT32( W[11], data, 44 );
|
GET_Q_UINT32( W[11], data, 44 );
|
||||||
GET_UINT32( W[12], data, 48 );
|
GET_Q_UINT32( W[12], data, 48 );
|
||||||
GET_UINT32( W[13], data, 52 );
|
GET_Q_UINT32( W[13], data, 52 );
|
||||||
GET_UINT32( W[14], data, 56 );
|
GET_Q_UINT32( W[14], data, 56 );
|
||||||
GET_UINT32( W[15], data, 60 );
|
GET_Q_UINT32( W[15], data, 60 );
|
||||||
|
|
||||||
#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
|
#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
|
||||||
#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
|
#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
|
||||||
|
@ -241,8 +241,8 @@ void sha256_finish( sha256_context *ctx, uint8 digest[32] )
|
||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
low = ( ctx->total[0] << 3 );
|
low = ( ctx->total[0] << 3 );
|
||||||
|
|
||||||
PUT_UINT32( high, msglen, 0 );
|
PUT_Q_UINT32( high, msglen, 0 );
|
||||||
PUT_UINT32( low, msglen, 4 );
|
PUT_Q_UINT32( low, msglen, 4 );
|
||||||
|
|
||||||
last = ctx->total[0] & 0x3F;
|
last = ctx->total[0] & 0x3F;
|
||||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
|
@ -250,14 +250,14 @@ void sha256_finish( sha256_context *ctx, uint8 digest[32] )
|
||||||
sha256_update( ctx, sha256_padding, padn );
|
sha256_update( ctx, sha256_padding, padn );
|
||||||
sha256_update( ctx, msglen, 8 );
|
sha256_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
PUT_UINT32( ctx->state[0], digest, 0 );
|
PUT_Q_UINT32( ctx->state[0], digest, 0 );
|
||||||
PUT_UINT32( ctx->state[1], digest, 4 );
|
PUT_Q_UINT32( ctx->state[1], digest, 4 );
|
||||||
PUT_UINT32( ctx->state[2], digest, 8 );
|
PUT_Q_UINT32( ctx->state[2], digest, 8 );
|
||||||
PUT_UINT32( ctx->state[3], digest, 12 );
|
PUT_Q_UINT32( ctx->state[3], digest, 12 );
|
||||||
PUT_UINT32( ctx->state[4], digest, 16 );
|
PUT_Q_UINT32( ctx->state[4], digest, 16 );
|
||||||
PUT_UINT32( ctx->state[5], digest, 20 );
|
PUT_Q_UINT32( ctx->state[5], digest, 20 );
|
||||||
PUT_UINT32( ctx->state[6], digest, 24 );
|
PUT_Q_UINT32( ctx->state[6], digest, 24 );
|
||||||
PUT_UINT32( ctx->state[7], digest, 28 );
|
PUT_Q_UINT32( ctx->state[7], digest, 28 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
|
@ -40,7 +40,7 @@ CTwofish::~CTwofish()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTwofish::init(UINT8 *pKey, unsigned long uKeyLen, UINT8 *initVector)
|
bool CTwofish::init(Q_UINT8 *pKey, unsigned long uKeyLen, Q_UINT8 *initVector)
|
||||||
{
|
{
|
||||||
//ASSERT(pKey != NULL);
|
//ASSERT(pKey != NULL);
|
||||||
if(pKey == NULL) return false;
|
if(pKey == NULL) return false;
|
||||||
|
@ -61,10 +61,10 @@ bool CTwofish::init(UINT8 *pKey, unsigned long uKeyLen, UINT8 *initVector)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTwofish::padEncrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
int CTwofish::padEncrypt(Q_UINT8 *pInput, int nInputOctets, Q_UINT8 *pOutBuffer)
|
||||||
{
|
{
|
||||||
int i, numBlocks, padLen;
|
int i, numBlocks, padLen;
|
||||||
UINT8 block[16], *iv;
|
Q_UINT8 block[16], *iv;
|
||||||
|
|
||||||
//ASSERT((pInput != NULL) && (nInputOctets != NULL) && (pOutBuffer != NULL));
|
//ASSERT((pInput != NULL) && (nInputOctets != NULL) && (pOutBuffer != NULL));
|
||||||
if((pInput == NULL) || (nInputOctets <= 0) || (pOutBuffer == NULL)) return 0;
|
if((pInput == NULL) || (nInputOctets <= 0) || (pOutBuffer == NULL)) return 0;
|
||||||
|
@ -74,10 +74,10 @@ int CTwofish::padEncrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
||||||
iv = m_pInitVector;
|
iv = m_pInitVector;
|
||||||
for(i = numBlocks; i > 0; i--)
|
for(i = numBlocks; i > 0; i--)
|
||||||
{
|
{
|
||||||
((UINT32*)block)[0] = ((UINT32*)pInput)[0] ^ ((UINT32*)iv)[0];
|
((Q_UINT32*)block)[0] = ((Q_UINT32*)pInput)[0] ^ ((Q_UINT32*)iv)[0];
|
||||||
((UINT32*)block)[1] = ((UINT32*)pInput)[1] ^ ((UINT32*)iv)[1];
|
((Q_UINT32*)block)[1] = ((Q_UINT32*)pInput)[1] ^ ((Q_UINT32*)iv)[1];
|
||||||
((UINT32*)block)[2] = ((UINT32*)pInput)[2] ^ ((UINT32*)iv)[2];
|
((Q_UINT32*)block)[2] = ((Q_UINT32*)pInput)[2] ^ ((Q_UINT32*)iv)[2];
|
||||||
((UINT32*)block)[3] = ((UINT32*)pInput)[3] ^ ((UINT32*)iv)[3];
|
((Q_UINT32*)block)[3] = ((Q_UINT32*)pInput)[3] ^ ((Q_UINT32*)iv)[3];
|
||||||
|
|
||||||
Twofish_encrypt(&m_key, (Twofish_Byte *)block, (Twofish_Byte *)pOutBuffer);
|
Twofish_encrypt(&m_key, (Twofish_Byte *)block, (Twofish_Byte *)pOutBuffer);
|
||||||
|
|
||||||
|
@ -90,12 +90,12 @@ int CTwofish::padEncrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
||||||
|
|
||||||
for (i = 0; i < 16 - padLen; i++)
|
for (i = 0; i < 16 - padLen; i++)
|
||||||
{
|
{
|
||||||
block[i] = (UINT8)(pInput[i] ^ iv[i]);
|
block[i] = (Q_UINT8)(pInput[i] ^ iv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 16 - padLen; i < 16; i++)
|
for (i = 16 - padLen; i < 16; i++)
|
||||||
{
|
{
|
||||||
block[i] = (UINT8)((UINT8)padLen ^ iv[i]);
|
block[i] = (Q_UINT8)((Q_UINT8)padLen ^ iv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Twofish_encrypt(&m_key, (Twofish_Byte *)block, (Twofish_Byte *)pOutBuffer);
|
Twofish_encrypt(&m_key, (Twofish_Byte *)block, (Twofish_Byte *)pOutBuffer);
|
||||||
|
@ -103,11 +103,11 @@ int CTwofish::padEncrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
||||||
return 16 * (numBlocks + 1);
|
return 16 * (numBlocks + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTwofish::padDecrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
int CTwofish::padDecrypt(Q_UINT8 *pInput, int nInputOctets, Q_UINT8 *pOutBuffer)
|
||||||
{
|
{
|
||||||
int i, numBlocks, padLen;
|
int i, numBlocks, padLen;
|
||||||
UINT8 block[16];
|
Q_UINT8 block[16];
|
||||||
UINT32 iv[4];
|
Q_UINT32 iv[4];
|
||||||
|
|
||||||
//ASSERT((pInput != NULL) && (nInputOctets != NULL) && (pOutBuffer != NULL));
|
//ASSERT((pInput != NULL) && (nInputOctets != NULL) && (pOutBuffer != NULL));
|
||||||
if((pInput == NULL) || (nInputOctets <= 0) || (pOutBuffer == NULL)) return 0;
|
if((pInput == NULL) || (nInputOctets <= 0) || (pOutBuffer == NULL)) return 0;
|
||||||
|
@ -121,10 +121,10 @@ int CTwofish::padDecrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
||||||
for(i = numBlocks - 1; i > 0; i--)
|
for(i = numBlocks - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
Twofish_decrypt(&m_key, (Twofish_Byte *)pInput, (Twofish_Byte *)block);
|
Twofish_decrypt(&m_key, (Twofish_Byte *)pInput, (Twofish_Byte *)block);
|
||||||
((UINT32*)block)[0] ^= iv[0];
|
((Q_UINT32*)block)[0] ^= iv[0];
|
||||||
((UINT32*)block)[1] ^= iv[1];
|
((Q_UINT32*)block)[1] ^= iv[1];
|
||||||
((UINT32*)block)[2] ^= iv[2];
|
((Q_UINT32*)block)[2] ^= iv[2];
|
||||||
((UINT32*)block)[3] ^= iv[3];
|
((Q_UINT32*)block)[3] ^= iv[3];
|
||||||
memcpy(iv, pInput, 16);
|
memcpy(iv, pInput, 16);
|
||||||
memcpy(pOutBuffer, block, 16);
|
memcpy(pOutBuffer, block, 16);
|
||||||
pInput += 16;
|
pInput += 16;
|
||||||
|
@ -132,10 +132,10 @@ int CTwofish::padDecrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
Twofish_decrypt(&m_key, (Twofish_Byte *)pInput, (Twofish_Byte *)block);
|
Twofish_decrypt(&m_key, (Twofish_Byte *)pInput, (Twofish_Byte *)block);
|
||||||
((UINT32*)block)[0] ^= iv[0];
|
((Q_UINT32*)block)[0] ^= iv[0];
|
||||||
((UINT32*)block)[1] ^= iv[1];
|
((Q_UINT32*)block)[1] ^= iv[1];
|
||||||
((UINT32*)block)[2] ^= iv[2];
|
((Q_UINT32*)block)[2] ^= iv[2];
|
||||||
((UINT32*)block)[3] ^= iv[3];
|
((Q_UINT32*)block)[3] ^= iv[3];
|
||||||
padLen = block[15];
|
padLen = block[15];
|
||||||
if(padLen <= 0 || padLen > 16) return -1;
|
if(padLen <= 0 || padLen > 16) return -1;
|
||||||
for(i = 16 - padLen; i < 16; i++)
|
for(i = 16 - padLen; i < 16; i++)
|
||||||
|
|
|
@ -39,14 +39,14 @@ public:
|
||||||
CTwofish();
|
CTwofish();
|
||||||
virtual ~CTwofish();
|
virtual ~CTwofish();
|
||||||
|
|
||||||
bool init(UINT8 *pKey, unsigned long uKeyLen, UINT8 *initVector = NULL);
|
bool init(Q_UINT8 *pKey, unsigned long uKeyLen, Q_UINT8 *initVector = NULL);
|
||||||
|
|
||||||
int padEncrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer);
|
int padEncrypt(Q_UINT8 *pInput, int nInputOctets, Q_UINT8 *pOutBuffer);
|
||||||
int padDecrypt(UINT8 *pInput, int nInputOctets, UINT8 *pOutBuffer);
|
int padDecrypt(Q_UINT8 *pInput, int nInputOctets, Q_UINT8 *pOutBuffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Twofish_key m_key;
|
Twofish_key m_key;
|
||||||
UINT8 m_pInitVector[16];
|
Q_UINT8 m_pInitVector[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -245,7 +245,7 @@
|
||||||
*
|
*
|
||||||
* Unfortunately there is no portable way of writing the constant
|
* Unfortunately there is no portable way of writing the constant
|
||||||
* 0xffffffff. You don't know which suffix to use (U, or UL?)
|
* 0xffffffff. You don't know which suffix to use (U, or UL?)
|
||||||
* The UINT32_MASK definition uses a bit of trickery. Shift-left
|
* The Q_UINT32_MASK definition uses a bit of trickery. Shift-left
|
||||||
* is only defined if the shift amount is strictly less than the size
|
* is only defined if the shift amount is strictly less than the size
|
||||||
* of the UInt32, so we can't use (1<<32). The answer it to take the value
|
* of the UInt32, so we can't use (1<<32). The answer it to take the value
|
||||||
* 2, cast it to a UInt32, shift it left 31 positions, and subtract one.
|
* 2, cast it to a UInt32, shift it left 31 positions, and subtract one.
|
||||||
|
@ -263,11 +263,11 @@
|
||||||
* For example, MS compilers have the __rotl and __rotr functions
|
* For example, MS compilers have the __rotl and __rotr functions
|
||||||
* that generate x86 rotation instructions.
|
* that generate x86 rotation instructions.
|
||||||
*/
|
*/
|
||||||
#define UINT32_MASK ( (((Twofish_UInt32)2)<<31) - 1 )
|
#define Q_UINT32_MASK ( (((Twofish_UInt32)2)<<31) - 1 )
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#define ROL32(x,n) ( (x)<<(n) | ((x) & UINT32_MASK) >> (32-(n)) )
|
#define ROL32(x,n) ( (x)<<(n) | ((x) & Q_UINT32_MASK) >> (32-(n)) )
|
||||||
#define ROR32(x,n) ( (x)>>(n) | ((x) & UINT32_MASK) << (32-(n)) )
|
#define ROR32(x,n) ( (x)>>(n) | ((x) & Q_UINT32_MASK) << (32-(n)) )
|
||||||
#else
|
#else
|
||||||
#define ROL32(x,n) (_lrotl((x), (n)))
|
#define ROL32(x,n) (_lrotl((x), (n)))
|
||||||
#define ROR32(x,n) (_lrotr((x), (n)))
|
#define ROR32(x,n) (_lrotr((x), (n)))
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
* This macro does not affect the conversion of the inputs and outputs
|
* This macro does not affect the conversion of the inputs and outputs
|
||||||
* of the cipher. See the CONVERT_USING_CASTS macro for that.
|
* of the cipher. See the CONVERT_USING_CASTS macro for that.
|
||||||
*/
|
*/
|
||||||
#define SELECT_BYTE_FROM_UINT32_IN_MEMORY 0 /* default = 0 */
|
#define SELECT_BYTE_FROM_Q_UINT32_IN_MEMORY 0 /* default = 0 */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -331,7 +331,7 @@
|
||||||
* This option does not work unless a UInt32 is exactly 32 bits.
|
* This option does not work unless a UInt32 is exactly 32 bits.
|
||||||
*
|
*
|
||||||
* This macro only changes the reading/writing of the plaintext/ciphertext.
|
* This macro only changes the reading/writing of the plaintext/ciphertext.
|
||||||
* See the SELECT_BYTE_FROM_UINT32_IN_MEMORY to affect the way in which
|
* See the SELECT_BYTE_FROM_Q_UINT32_IN_MEMORY to affect the way in which
|
||||||
* a UInt32 is split into 4 bytes for the S-box selection.
|
* a UInt32 is split into 4 bytes for the S-box selection.
|
||||||
*/
|
*/
|
||||||
#define CONVERT_USING_CASTS 0 /* default = 0 */
|
#define CONVERT_USING_CASTS 0 /* default = 0 */
|
||||||
|
@ -339,7 +339,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Endianness switch.
|
* Endianness switch.
|
||||||
* Only relevant if SELECT_BYTE_FROM_UINT32_IN_MEMORY or
|
* Only relevant if SELECT_BYTE_FROM_Q_UINT32_IN_MEMORY or
|
||||||
* CONVERT_USING_CASTS is set.
|
* CONVERT_USING_CASTS is set.
|
||||||
*
|
*
|
||||||
* Set to 1 on a big-endian machine, and to 0 on a little-endian machine.
|
* Set to 1 on a big-endian machine, and to 0 on a little-endian machine.
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
/*
|
/*
|
||||||
* Compute byte offset within a UInt32 stored in memory.
|
* Compute byte offset within a UInt32 stored in memory.
|
||||||
*
|
*
|
||||||
* This is only used when SELECT_BYTE_FROM_UINT32_IN_MEMORY is set.
|
* This is only used when SELECT_BYTE_FROM_Q_UINT32_IN_MEMORY is set.
|
||||||
*
|
*
|
||||||
* The input is the byte number 0..3, 0 for least significant.
|
* The input is the byte number 0..3, 0 for least significant.
|
||||||
* Note the use of sizeof() to support UInt32 types that are larger
|
* Note the use of sizeof() to support UInt32 types that are larger
|
||||||
|
@ -424,7 +424,7 @@
|
||||||
* Macro to get Byte no. b from UInt32 value X.
|
* Macro to get Byte no. b from UInt32 value X.
|
||||||
* We use two different definition, depending on the settings.
|
* We use two different definition, depending on the settings.
|
||||||
*/
|
*/
|
||||||
#if SELECT_BYTE_FROM_UINT32_IN_MEMORY
|
#if SELECT_BYTE_FROM_Q_UINT32_IN_MEMORY
|
||||||
/* Pick the byte from the memory in which X is stored. */
|
/* Pick the byte from the memory in which X is stored. */
|
||||||
#define SELECT_BYTE( X, b ) (((Twofish_Byte *)(&(X)))[BYTE_OFFSET(b)])
|
#define SELECT_BYTE( X, b ) (((Twofish_Byte *)(&(X)))[BYTE_OFFSET(b)])
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qscrollview.h>
|
#include <q3scrollview.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
|
|
||||||
#include "AboutDlg.h"
|
#include "AboutDlg.h"
|
||||||
|
|
||||||
CAboutDialog::CAboutDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CAboutDialog::CAboutDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: AboutDlg(parent,name, modal,fl)
|
: AboutDlg(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
mainwnd=((CMainWindow*)parentWidget());
|
mainwnd=((CMainWindow*)parentWidget());
|
||||||
|
@ -57,7 +57,7 @@ close();
|
||||||
void CAboutDialog::OnLicenseClicked(){
|
void CAboutDialog::OnLicenseClicked(){
|
||||||
|
|
||||||
QDialog dlg(this,NULL,true);
|
QDialog dlg(this,NULL,true);
|
||||||
QScrollView scroll(&dlg);
|
Q3ScrollView scroll(&dlg);
|
||||||
QLabel label(&scroll,"License-Scroll");
|
QLabel label(&scroll,"License-Scroll");
|
||||||
scroll.addChild(&label);
|
scroll.addChild(&label);
|
||||||
QFile gpl(((CMainWindow*)parentWidget())->appdir+"/../share/keepass/license.txt");
|
QFile gpl(((CMainWindow*)parentWidget())->appdir+"/../share/keepass/license.txt");
|
||||||
|
@ -68,7 +68,7 @@ QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Die Datei '%1' konnte nicht
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!gpl.open(IO_ReadOnly)){
|
if(!gpl.open(QIODevice::ReadOnly)){
|
||||||
QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Die Datei '%1' konnte nicht geöffnet werden.")
|
QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Die Datei '%1' konnte nicht geöffnet werden.")
|
||||||
.arg("'license.txt'")+trUtf8("Es trat folgender Fehler auf:\n%1").arg(gpl.errorString())
|
.arg("'license.txt'")+trUtf8("Es trat folgender Fehler auf:\n%1").arg(gpl.errorString())
|
||||||
,trUtf8("OK"),0,0,2,1);
|
,trUtf8("OK"),0,0,2,1);
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CAboutDialog : public AboutDlg
|
||||||
|
|
||||||
LinkLabel *Link_Homepage,*Link_EMail,*Link_License;
|
LinkLabel *Link_Homepage,*Link_EMail,*Link_License;
|
||||||
public:
|
public:
|
||||||
CAboutDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CAboutDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CAboutDialog();
|
~CAboutDialog();
|
||||||
|
|
||||||
CMainWindow* mainwnd;
|
CMainWindow* mainwnd;
|
||||||
|
|
|
@ -27,12 +27,12 @@
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qfiledialog.h>
|
#include <q3filedialog.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CChangeKeyDlg::CChangeKeyDlg(QWidget* parent,PwDatabase* _db,const char* name, bool modal, WFlags fl)
|
CChangeKeyDlg::CChangeKeyDlg(QWidget* parent,PwDatabase* _db,const char* name, bool modal, Qt::WFlags fl)
|
||||||
: ChangeKeyDialog(parent,name, modal,fl)
|
: ChangeKeyDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
db=_db;
|
db=_db;
|
||||||
|
@ -78,8 +78,8 @@ else
|
||||||
return;}
|
return;}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 file_key[32]={0};
|
Q_UINT8 file_key[32]={0};
|
||||||
UINT8 pw_key[32]={0};
|
Q_UINT8 pw_key[32]={0};
|
||||||
|
|
||||||
if(keyfile!=""){
|
if(keyfile!=""){
|
||||||
QFile file(keyfile);
|
QFile file(keyfile);
|
||||||
|
@ -87,7 +87,7 @@ if(file.exists()){
|
||||||
int r=QMessageBox::warning(this,trUtf8("Vorhandene Datei überschreiben?"),trUtf8("Unter dem gewählten Dateinamen existiert bereits eine Datei.\nSoll sie überschrieben werden?"),"Ja","Nein",NULL,1,1);
|
int r=QMessageBox::warning(this,trUtf8("Vorhandene Datei überschreiben?"),trUtf8("Unter dem gewählten Dateinamen existiert bereits eine Datei.\nSoll sie überschrieben werden?"),"Ja","Nein",NULL,1,1);
|
||||||
if(r==1)return;}
|
if(r==1)return;}
|
||||||
getRandomBytes(file_key,1,32,true);
|
getRandomBytes(file_key,1,32,true);
|
||||||
if(file.open(IO_WriteOnly | IO_Truncate)==false){
|
if(file.open(QIODevice::WriteOnly | QIODevice::Truncate)==false){
|
||||||
QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Schlüsseldatei konnte nicht geöffnet werden."),"OK",0,0,2,1);
|
QMessageBox::critical(this,trUtf8("Fehler"),trUtf8("Schlüsseldatei konnte nicht geöffnet werden."),"OK",0,0,2,1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ done(1);
|
||||||
void CChangeKeyDlg::OnSelect()
|
void CChangeKeyDlg::OnSelect()
|
||||||
{
|
{
|
||||||
if(Button_Browse->isEnabled()){
|
if(Button_Browse->isEnabled()){
|
||||||
keyfile=QFileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Schlüsseldatei öffnen"));
|
keyfile=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Schlüsseldatei öffnen"));
|
||||||
if(keyfile=="")return;
|
if(keyfile=="")return;
|
||||||
Combo_Dirs->insertItem(keyfile);
|
Combo_Dirs->insertItem(keyfile);
|
||||||
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
||||||
|
@ -131,7 +131,7 @@ IsFile.append(true);
|
||||||
|
|
||||||
void CChangeKeyDlg::OnBrowse()
|
void CChangeKeyDlg::OnBrowse()
|
||||||
{
|
{
|
||||||
QString dir=QFileDialog::getExistingDirectory(QDir::homeDirPath(),NULL,trUtf8("Verzeichnis wählen"));
|
QString dir=Q3FileDialog::getExistingDirectory(QDir::homeDirPath(),NULL,trUtf8("Verzeichnis wählen"));
|
||||||
if(dir=="")return;
|
if(dir=="")return;
|
||||||
keyfile=dir+"/pwsafe.key";
|
keyfile=dir+"/pwsafe.key";
|
||||||
Combo_Dirs->insertItem(dir);
|
Combo_Dirs->insertItem(dir);
|
||||||
|
@ -190,8 +190,8 @@ Edit_Password_2->setDisabled(true);}
|
||||||
|
|
||||||
void CChangeKeyDlg::OnCheckBoxChanged(int i)
|
void CChangeKeyDlg::OnCheckBoxChanged(int i)
|
||||||
{
|
{
|
||||||
if(i==QButton::NoChange)return;
|
if(i==QCheckBox::NoChange)return;
|
||||||
if(i==QButton::On){
|
if(i==QCheckBox::On){
|
||||||
Combo_Dirs->setEnabled(true);
|
Combo_Dirs->setEnabled(true);
|
||||||
Button_Browse->setEnabled(true);
|
Button_Browse->setEnabled(true);
|
||||||
Edit_Password->setEnabled(true);
|
Edit_Password->setEnabled(true);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#define _CHANGEKEYDLG_H_
|
#define _CHANGEKEYDLG_H_
|
||||||
#include "ui_ChangeKeyDlg.h"
|
#include "ui_ChangeKeyDlg.h"
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qvaluelist.h>
|
#include <q3valuelist.h>
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
|
|
||||||
class CChangeKeyDlg : public ChangeKeyDialog
|
class CChangeKeyDlg : public ChangeKeyDialog
|
||||||
|
@ -30,7 +30,7 @@ class CChangeKeyDlg : public ChangeKeyDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CChangeKeyDlg(QWidget* parent,PwDatabase* db, const char* name = 0, bool modal = true, WFlags fl = 0 );
|
CChangeKeyDlg(QWidget* parent,PwDatabase* db, const char* name = 0, bool modal = true, Qt::WFlags fl = 0 );
|
||||||
~CChangeKeyDlg();
|
~CChangeKeyDlg();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ private:
|
||||||
PwDatabase* db;
|
PwDatabase* db;
|
||||||
CMainWindow* parentwnd;
|
CMainWindow* parentwnd;
|
||||||
QStringList Paths;
|
QStringList Paths;
|
||||||
QValueList<bool> IsFile;
|
Q3ValueList<bool> IsFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString keyfile;
|
QString keyfile;
|
||||||
|
|
|
@ -20,11 +20,13 @@
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "DatabaseSettingsDlg.h"
|
#include "DatabaseSettingsDlg.h"
|
||||||
|
|
||||||
|
|
||||||
CDbSettingsDlg::CDbSettingsDlg(CMainWindow* parent,Database* db, const char* name, bool modal, WFlags fl)
|
CDbSettingsDlg::CDbSettingsDlg(CMainWindow* parent,Database* db, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: dbsettingdlg_base(parent,name, modal,fl)
|
: dbsettingdlg_base(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
database=db;
|
database=db;
|
||||||
|
|
|
@ -22,13 +22,15 @@
|
||||||
#include "ui_DatabaseSettingsDlg.h"
|
#include "ui_DatabaseSettingsDlg.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
class CDbSettingsDlg : public dbsettingdlg_base
|
class CDbSettingsDlg : public dbsettingdlg_base
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDbSettingsDlg(CMainWindow* parent,Database* db,const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CDbSettingsDlg(CMainWindow* parent,Database* db,const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CDbSettingsDlg();
|
~CDbSettingsDlg();
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *);
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
|
@ -24,16 +24,18 @@
|
||||||
#include <qfont.h>
|
#include <qfont.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qprogressbar.h>
|
#include <q3progressbar.h>
|
||||||
#include <qtextedit.h>
|
#include <q3textedit.h>
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
#include <qcolor.h>
|
#include <qcolor.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
#include <qpen.h>
|
#include <qpen.h>
|
||||||
#include <qfiledialog.h>
|
#include <q3filedialog.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qtoolbutton.h>
|
#include <qtoolbutton.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
|
||||||
#include "PasswordGenDlg.h"
|
#include "PasswordGenDlg.h"
|
||||||
|
@ -41,7 +43,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CEditEntryDlg::CEditEntryDlg(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CEditEntryDlg::CEditEntryDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: EditEntryDialog(parent,name, modal,fl)
|
: EditEntryDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -261,17 +263,17 @@ Edit_Expire_Time->setPaletteBackgroundColor(QColor(255,255,255));///@FIXME Stand
|
||||||
|
|
||||||
void CEditEntryDlg::OnNewAttachment()
|
void CEditEntryDlg::OnNewAttachment()
|
||||||
{
|
{
|
||||||
QString filename=QFileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Anhang hinzufügen..."));
|
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Anhang hinzufügen..."));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if(file.open(IO_ReadOnly)==false){
|
if(file.open(QIODevice::ReadOnly)==false){
|
||||||
file.close();
|
file.close();
|
||||||
QMessageBox::warning(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht geöffnet werden."),"OK");
|
QMessageBox::warning(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht geöffnet werden."),"OK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModFlag=true;
|
ModFlag=true;
|
||||||
if(entry->pBinaryData)delete [] entry->pBinaryData;
|
if(entry->pBinaryData)delete [] entry->pBinaryData;
|
||||||
entry->pBinaryData = new UINT8 [file.size()];
|
entry->pBinaryData = new Q_UINT8 [file.size()];
|
||||||
|
|
||||||
if(entry->pBinaryData==NULL){
|
if(entry->pBinaryData==NULL){
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -300,7 +302,7 @@ ButtonDeleteAttachment->setEnabled(true);
|
||||||
|
|
||||||
void CEditEntryDlg::OnSaveAttachment()
|
void CEditEntryDlg::OnSaveAttachment()
|
||||||
{
|
{
|
||||||
QString filename=QFileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Anhang speichern..."));
|
QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Anhang speichern..."));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
|
@ -310,7 +312,7 @@ if(file.remove()==false){
|
||||||
QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht überschrieben werden."),"OK");
|
QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht überschrieben werden."),"OK");
|
||||||
return;}
|
return;}
|
||||||
}
|
}
|
||||||
if(file.open(IO_WriteOnly)==false){
|
if(file.open(QIODevice::WriteOnly)==false){
|
||||||
QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht erstellt werden."),"OK");
|
QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht erstellt werden."),"OK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,16 @@
|
||||||
#ifndef EDITENTRYDLG_H
|
#ifndef EDITENTRYDLG_H
|
||||||
#define EDITENTRYDLG_H
|
#define EDITENTRYDLG_H
|
||||||
#include "ui_EditEntryDlg.h"
|
#include "ui_EditEntryDlg.h"
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
class CEditEntryDlg : public EditEntryDialog
|
class CEditEntryDlg : public EditEntryDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CEditEntryDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
|
CEditEntryDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0);
|
||||||
~CEditEntryDlg();
|
~CEditEntryDlg();
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *);
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
|
@ -22,10 +22,12 @@
|
||||||
|
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
#include "EditGroupDlg.h"
|
#include "EditGroupDlg.h"
|
||||||
|
|
||||||
|
|
||||||
CEditGroupDialog::CEditGroupDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CEditGroupDialog::CEditGroupDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: EditGroupDialog(parent,name, modal,fl)
|
: EditGroupDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
IconID=0;
|
IconID=0;
|
||||||
|
|
|
@ -23,13 +23,15 @@
|
||||||
|
|
||||||
#include "ui_EditGroupDlg.h"
|
#include "ui_EditGroupDlg.h"
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
class CEditGroupDialog : public EditGroupDialog
|
class CEditGroupDialog : public EditGroupDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CEditGroupDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CEditGroupDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CEditGroupDialog();
|
~CEditGroupDialog();
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
#include <qtranslator.h>
|
#include <qtranslator.h>
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qlistview.h>
|
#include <q3listview.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
|
|
||||||
const char* infostrings[]={
|
const char* infostrings[]={
|
||||||
|
@ -35,13 +37,13 @@ const char* msg[]={QT_TRANSLATE_NOOP("_MSG","Die Änderung der Sprache wird erst
|
||||||
QT_TRANSLATE_NOOP("_MSG","OK"),
|
QT_TRANSLATE_NOOP("_MSG","OK"),
|
||||||
QT_TRANSLATE_NOOP("_MSG","Hinweis")};
|
QT_TRANSLATE_NOOP("_MSG","Hinweis")};
|
||||||
|
|
||||||
CLanguageDlg::CLanguageDlg(QWidget* parent, const char* name, WFlags fl)
|
CLanguageDlg::CLanguageDlg(QWidget* parent, const char* name, Qt::WFlags fl)
|
||||||
: LanguageDlg(parent,name,fl)
|
: LanguageDlg(parent,name,fl)
|
||||||
{
|
{
|
||||||
parentwnd=((CMainWindow*)parentWidget());
|
parentwnd=((CMainWindow*)parentWidget());
|
||||||
parentwnd->CreateBanner(Banner,parentwnd->Icon_I18n32x32,trUtf8("Spracheinstellungen"));
|
parentwnd->CreateBanner(Banner,parentwnd->Icon_I18n32x32,trUtf8("Spracheinstellungen"));
|
||||||
|
|
||||||
QListViewItem* item;
|
Q3ListViewItem* item;
|
||||||
QString& config_lang=parentwnd->config->Language;
|
QString& config_lang=parentwnd->config->Language;
|
||||||
QStringList files;
|
QStringList files;
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ if(dir.exists()){
|
||||||
files=dir.entryList("*.qm",QDir::Files);
|
files=dir.entryList("*.qm",QDir::Files);
|
||||||
}
|
}
|
||||||
|
|
||||||
List->insertItem(item=new QListViewItem(List,"","Deutsch","-","-"));
|
List->insertItem(item=new Q3ListViewItem(List,"","Deutsch","-","-"));
|
||||||
if(config_lang=="_DEUTSCH_")item->setPixmap(0,*parentwnd->Icon_Ok16x16);
|
if(config_lang=="_DEUTSCH_")item->setPixmap(0,*parentwnd->Icon_Ok16x16);
|
||||||
pItems.push_back(item);
|
pItems.push_back(item);
|
||||||
filenames.push_back("_DEUTSCH_");
|
filenames.push_back("_DEUTSCH_");
|
||||||
|
@ -62,9 +64,9 @@ QTranslator translator;
|
||||||
if(!translator.load(langdir+files[i])){
|
if(!translator.load(langdir+files[i])){
|
||||||
QMessageBox::warning(this,tr("Warnung"),tr("Die Datei '%1' konnte nicht geladen werden.").arg(files[i]),tr("OK"),0,0,2,1);
|
QMessageBox::warning(this,tr("Warnung"),tr("Die Datei '%1' konnte nicht geladen werden.").arg(files[i]),tr("OK"),0,0,2,1);
|
||||||
continue;}
|
continue;}
|
||||||
List->insertItem(item=new QListViewItem(List,"",translator.findMessage("_INFO","$TRANSL_LANGUAGE").translation()
|
List->insertItem(item=new Q3ListViewItem(List,"",translator.translate("_INFO","$TRANSL_LANGUAGE")
|
||||||
,translator.findMessage("_INFO","$TRANSL_VERSION").translation()
|
,translator.translate("_INFO","$TRANSL_VERSION")
|
||||||
,translator.findMessage("_INFO","$TRANSL_AUTHOR").translation()));
|
,translator.translate("_INFO","$TRANSL_AUTHOR")));
|
||||||
if(config_lang==files[i])item->setPixmap(0,*parentwnd->Icon_Ok16x16);
|
if(config_lang==files[i])item->setPixmap(0,*parentwnd->Icon_Ok16x16);
|
||||||
pItems.push_back(item);
|
pItems.push_back(item);
|
||||||
filenames.push_back(files[i]);
|
filenames.push_back(files[i]);
|
||||||
|
@ -85,13 +87,13 @@ List->setColumnWidth(3,width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLanguageDlg::OnItemRightClick(QListViewItem* item)
|
void CLanguageDlg::OnItemRightClick(Q3ListViewItem* item)
|
||||||
{
|
{
|
||||||
//CTX-MENU
|
//CTX-MENU
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLanguageDlg::OnItemDoubleClicked(QListViewItem* item) // == Slot für Button "wählen"
|
void CLanguageDlg::OnItemDoubleClicked(Q3ListViewItem* item) // == Slot für Button "wählen"
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
QString langdir=parentwnd->appdir+"/../share/keepass/i18n/";
|
QString langdir=parentwnd->appdir+"/../share/keepass/i18n/";
|
||||||
|
@ -99,7 +101,7 @@ QString langdir=parentwnd->appdir+"/../share/keepass/i18n/";
|
||||||
for(i=0;i<pItems.size();i++){
|
for(i=0;i<pItems.size();i++){
|
||||||
if(item==pItems[i])break;
|
if(item==pItems[i])break;
|
||||||
if(i==pItems.size()-1){
|
if(i==pItems.size()-1){
|
||||||
cout << QString("unexpected error in %1, line %2").arg(__FILE__).arg(__LINE__) << endl;
|
qWarning(QString("unexpected error in %1, line %2").arg(__FILE__).arg(__LINE__)+"\n");
|
||||||
exit(-1);}
|
exit(-1);}
|
||||||
}
|
}
|
||||||
if(filenames[i]!="_DEUTSCH_"){
|
if(filenames[i]!="_DEUTSCH_"){
|
||||||
|
@ -108,10 +110,10 @@ if(!translator.load(langdir+filenames[i])){
|
||||||
QMessageBox::warning(this,tr("Warnung"),tr("Die Datei '%1' konnte nicht geladen werden.").arg(filenames[i]),tr("OK"),0,0,2,1);
|
QMessageBox::warning(this,tr("Warnung"),tr("Die Datei '%1' konnte nicht geladen werden.").arg(filenames[i]),tr("OK"),0,0,2,1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMessageBox::information(this,translator.findMessage("_MSG",msg[2]).translation()
|
QMessageBox::information(this,translator.translate("_MSG",msg[2])
|
||||||
,translator.findMessage("_MSG",msg[0]).translation()
|
,translator.translate("_MSG",msg[0])
|
||||||
,translator.findMessage("_MSG",msg[1]).translation()
|
,translator.translate("_MSG",msg[1])
|
||||||
,0,0);
|
,0,0,0);
|
||||||
}
|
}
|
||||||
else QMessageBox::information(this,QString::fromUtf8(msg[2]),QString::fromUtf8(msg[0]),QString::fromUtf8(msg[1]),0,0,2,1);
|
else QMessageBox::information(this,QString::fromUtf8(msg[2]),QString::fromUtf8(msg[0]),QString::fromUtf8(msg[1]),0,0,2,1);
|
||||||
parentwnd->config->Language=filenames[i];
|
parentwnd->config->Language=filenames[i];
|
||||||
|
@ -130,7 +132,7 @@ List->setColumnWidth(3,width);
|
||||||
|
|
||||||
void CLanguageDlg::OnApplyButtonClicked()
|
void CLanguageDlg::OnApplyButtonClicked()
|
||||||
{
|
{
|
||||||
QListViewItem* item=List->selectedItem();
|
Q3ListViewItem* item=List->selectedItem();
|
||||||
if(item)OnItemDoubleClicked(item);
|
if(item)OnItemDoubleClicked(item);
|
||||||
else QMessageBox::information(this,tr("Hinweis"),trUtf8("Es ist keine Übersetzung aufsgewählt."),tr("OK"),0,0,2,1);
|
else QMessageBox::information(this,tr("Hinweis"),trUtf8("Es ist keine Übersetzung aufsgewählt."),tr("OK"),0,0,2,1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#define _LANGUAGEDLG_H_
|
#define _LANGUAGEDLG_H_
|
||||||
#include "ui_LanguageDlg.h"
|
#include "ui_LanguageDlg.h"
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,11 +32,11 @@ class CLanguageDlg : public LanguageDlg
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLanguageDlg(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
|
CLanguageDlg(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
|
||||||
~CLanguageDlg();
|
~CLanguageDlg();
|
||||||
CMainWindow* parentwnd;
|
CMainWindow* parentwnd;
|
||||||
vector<QString> filenames;
|
vector<QString> filenames;
|
||||||
vector<QListViewItem*> pItems;
|
vector<Q3ListViewItem*> pItems;
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -48,8 +50,8 @@ protected:
|
||||||
protected slots:
|
protected slots:
|
||||||
/*$PROTECTED_SLOTS$*/
|
/*$PROTECTED_SLOTS$*/
|
||||||
virtual void showEvent(QShowEvent *e);
|
virtual void showEvent(QShowEvent *e);
|
||||||
virtual void OnItemDoubleClicked(QListViewItem* item);
|
virtual void OnItemDoubleClicked(Q3ListViewItem* item);
|
||||||
virtual void OnItemRightClick(QListViewItem* item);
|
virtual void OnItemRightClick(Q3ListViewItem* item);
|
||||||
virtual void OnButtonCloseClicked();
|
virtual void OnButtonCloseClicked();
|
||||||
virtual void OnApplyButtonClicked();
|
virtual void OnApplyButtonClicked();
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qvaluelist.h>
|
#include <q3valuelist.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qfiledialog.h>
|
#include <q3filedialog.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: PasswordDlg(parent,name, modal,fl)
|
: PasswordDlg(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
parentwnd=((CMainWindow*)parentWidget());
|
parentwnd=((CMainWindow*)parentWidget());
|
||||||
|
@ -95,7 +95,7 @@ return;
|
||||||
void CPasswordDialog::OnButtonBrowse()
|
void CPasswordDialog::OnButtonBrowse()
|
||||||
{
|
{
|
||||||
///@PlatformSpecific
|
///@PlatformSpecific
|
||||||
QString dir=QFileDialog::getExistingDirectory(QDir::homeDirPath(),NULL,QString::fromUtf8("Verzeichnis wählen"));
|
QString dir=Q3FileDialog::getExistingDirectory(QDir::homeDirPath(),NULL,QString::fromUtf8("Verzeichnis wählen"));
|
||||||
if(dir=="")return;
|
if(dir=="")return;
|
||||||
|
|
||||||
QFile file(dir+"/pwsafe.key");
|
QFile file(dir+"/pwsafe.key");
|
||||||
|
@ -117,7 +117,7 @@ QMessageBox::warning(this,"Datei nicht gefunden",QString::fromUtf8("Im gewählte
|
||||||
void CPasswordDialog::OnSelectClicked()
|
void CPasswordDialog::OnSelectClicked()
|
||||||
{
|
{
|
||||||
if(Button_Browse->isEnabled()){
|
if(Button_Browse->isEnabled()){
|
||||||
keyfile=QFileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Schlüsseldatei öffnen"));
|
keyfile=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Schlüsseldatei öffnen"));
|
||||||
if(keyfile=="")return;
|
if(keyfile=="")return;
|
||||||
Combo_Dirs->insertItem(keyfile);
|
Combo_Dirs->insertItem(keyfile);
|
||||||
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
Combo_Dirs->setCurrentItem(Combo_Dirs->count()-1);
|
||||||
|
@ -172,7 +172,7 @@ Button_Browse->setEnabled(true);}
|
||||||
|
|
||||||
void CPasswordDialog::OnCheckBox_BothChanged(int state)
|
void CPasswordDialog::OnCheckBox_BothChanged(int state)
|
||||||
{
|
{
|
||||||
if(state==QButton::On){
|
if(state==QCheckBox::On){
|
||||||
Combo_Dirs->setEnabled(true);
|
Combo_Dirs->setEnabled(true);
|
||||||
Button_Browse->setEnabled(true);
|
Button_Browse->setEnabled(true);
|
||||||
Edit_Password->setEnabled(true);}
|
Edit_Password->setEnabled(true);}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#define PASSWORDDIALOG_H
|
#define PASSWORDDIALOG_H
|
||||||
#include "lib/UrlLabel.h"
|
#include "lib/UrlLabel.h"
|
||||||
#include "ui_PasswordDlg.h"
|
#include "ui_PasswordDlg.h"
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <Q3ValueList>
|
||||||
|
|
||||||
class CPasswordDialog : public PasswordDlg
|
class CPasswordDialog : public PasswordDlg
|
||||||
{
|
{
|
||||||
|
@ -31,7 +33,7 @@ private:
|
||||||
CMainWindow* parentwnd;
|
CMainWindow* parentwnd;
|
||||||
int NumComboEntries;
|
int NumComboEntries;
|
||||||
QStringList Paths;
|
QStringList Paths;
|
||||||
QValueList<bool> IsFile;
|
Q3ValueList<bool> IsFile;
|
||||||
LinkLabel* Label_select;
|
LinkLabel* Label_select;
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ bool canceled;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPasswordDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CPasswordDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CPasswordDialog();
|
~CPasswordDialog();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
#include <qradiobutton.h>
|
#include <qradiobutton.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qprogressbar.h>
|
#include <q3progressbar.h>
|
||||||
|
|
||||||
CGenPwDialog::CGenPwDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CGenPwDialog::CGenPwDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: GenPwDlg(parent,name, modal,fl)
|
: GenPwDlg(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
mainwnd=(CMainWindow*)(((CEditEntryDlg*)parentWidget())->parentWidget());
|
mainwnd=(CMainWindow*)(((CEditEntryDlg*)parentWidget())->parentWidget());
|
||||||
|
@ -47,7 +47,7 @@ CGenPwDialog::~CGenPwDialog()
|
||||||
void CGenPwDialog::OnRadio1StateChanged(int state)
|
void CGenPwDialog::OnRadio1StateChanged(int state)
|
||||||
{
|
{
|
||||||
switch (state){
|
switch (state){
|
||||||
case QButton::On:
|
case QCheckBox::On:
|
||||||
Radio_2->setChecked(false);
|
Radio_2->setChecked(false);
|
||||||
checkBox1->setEnabled(true);
|
checkBox1->setEnabled(true);
|
||||||
checkBox2->setEnabled(true);
|
checkBox2->setEnabled(true);
|
||||||
|
@ -58,7 +58,7 @@ switch (state){
|
||||||
checkBox7->setEnabled(true);
|
checkBox7->setEnabled(true);
|
||||||
checkBox8->setEnabled(true);
|
checkBox8->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case QButton::Off:
|
case QCheckBox::Off:
|
||||||
if(Radio_2->isChecked()==false)Radio_2->setChecked(true);
|
if(Radio_2->isChecked()==false)Radio_2->setChecked(true);
|
||||||
checkBox1->setDisabled(true);
|
checkBox1->setDisabled(true);
|
||||||
checkBox2->setDisabled(true);
|
checkBox2->setDisabled(true);
|
||||||
|
@ -70,7 +70,7 @@ switch (state){
|
||||||
checkBox8->setDisabled(true);
|
checkBox8->setDisabled(true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case QButton::NoChange:
|
case QCheckBox::NoChange:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,15 +79,15 @@ switch (state){
|
||||||
void CGenPwDialog::OnRadio2StateChanged(int state)
|
void CGenPwDialog::OnRadio2StateChanged(int state)
|
||||||
{
|
{
|
||||||
switch (state){
|
switch (state){
|
||||||
case QButton::On:
|
case QCheckBox::On:
|
||||||
Radio_1->setChecked(false);
|
Radio_1->setChecked(false);
|
||||||
Edit_chars->setEnabled(true);
|
Edit_chars->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case QButton::Off:
|
case QCheckBox::Off:
|
||||||
if(Radio_1->isChecked()==false)Radio_1->setChecked(true);
|
if(Radio_1->isChecked()==false)Radio_1->setChecked(true);
|
||||||
Edit_chars->setDisabled(true);
|
Edit_chars->setDisabled(true);
|
||||||
break;
|
break;
|
||||||
case QButton::NoChange:
|
case QCheckBox::NoChange:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ num+=AddToAssoctable(assoctable,128,255,num);
|
||||||
QString str=Edit_chars->text();
|
QString str=Edit_chars->text();
|
||||||
int i=0;
|
int i=0;
|
||||||
while(str.length()>0){
|
while(str.length()>0){
|
||||||
assoctable[i]=(char)((QChar)str[0]);
|
assoctable[i]=((QChar)str[0]).toAscii();
|
||||||
str.remove(str[0]);
|
str.remove(str[0]);
|
||||||
i++;
|
i++;
|
||||||
num++;
|
num++;
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
int AddToAssoctable(char* table,int start,int end,int pos);
|
int AddToAssoctable(char* table,int start,int end,int pos);
|
||||||
bool trim(unsigned char &value,int range);
|
bool trim(unsigned char &value,int range);
|
||||||
public:
|
public:
|
||||||
CGenPwDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CGenPwDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CGenPwDialog();
|
~CGenPwDialog();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
|
||||||
CSearchDlg::CSearchDlg(CGroup* pGroup,QWidget* parent, const char* name, bool modal, WFlags fl)
|
CSearchDlg::CSearchDlg(CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: Search_Dlg(parent,name, modal,fl)
|
: Search_Dlg(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
parentwnd=(CMainWindow*)parent;
|
parentwnd=(CMainWindow*)parent;
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CSearchDlg : public Search_Dlg
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSearchDlg(CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CSearchDlg(CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CSearchDlg();
|
~CSearchDlg();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "SettingsDlg.h"
|
#include "SettingsDlg.h"
|
||||||
|
|
||||||
|
|
||||||
CSettingsDlg::CSettingsDlg(QWidget* parent, const char* name, bool modal, WFlags fl)
|
CSettingsDlg::CSettingsDlg(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: SettingsDialog(parent,name, modal,fl)
|
: SettingsDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
pw=((CMainWindow*)parentWidget())->db;
|
pw=((CMainWindow*)parentWidget())->db;
|
||||||
|
@ -36,13 +36,13 @@ mainwnd->CreateBanner(Banner,mainwnd->Icon_Settings32x32,trUtf8("Einstellungen")
|
||||||
CheckBox_OpenLast->setChecked(mainwnd->config->OpenLast);
|
CheckBox_OpenLast->setChecked(mainwnd->config->OpenLast);
|
||||||
SpinBox_ClipboardTime->setValue(mainwnd->config->ClipboardTimeOut);
|
SpinBox_ClipboardTime->setValue(mainwnd->config->ClipboardTimeOut);
|
||||||
pixmTextColor->setPixmap(*(new QPixmap(pixmTextColor->width(),pixmTextColor->height())));
|
pixmTextColor->setPixmap(*(new QPixmap(pixmTextColor->width(),pixmTextColor->height())));
|
||||||
pixmTextColor->pixmap()->fill(mainwnd->config->BannerTextColor);
|
//pixmTextColor->pixmap()->fill(mainwnd->config->BannerTextColor);
|
||||||
|
|
||||||
pixmColor1->setPixmap(*(new QPixmap(pixmColor1->width(),pixmColor1->height())));
|
pixmColor1->setPixmap(*(new QPixmap(pixmColor1->width(),pixmColor1->height())));
|
||||||
pixmColor1->pixmap()->fill(mainwnd->config->BannerColor1);
|
//pixmColor1->pixmap()->fill(mainwnd->config->BannerColor1);
|
||||||
|
|
||||||
pixmColor2->setPixmap(*(new QPixmap(pixmColor2->width(),pixmColor2->height())));
|
pixmColor2->setPixmap(*(new QPixmap(pixmColor2->width(),pixmColor2->height())));
|
||||||
pixmColor2->pixmap()->fill(mainwnd->config->BannerColor2);
|
//pixmColor2->pixmap()->fill(mainwnd->config->BannerColor2);
|
||||||
|
|
||||||
color1=mainwnd->config->BannerColor1;
|
color1=mainwnd->config->BannerColor1;
|
||||||
color2=mainwnd->config->BannerColor2;
|
color2=mainwnd->config->BannerColor2;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CSettingsDlg : public SettingsDialog
|
||||||
public:
|
public:
|
||||||
CMainWindow* mainwnd;
|
CMainWindow* mainwnd;
|
||||||
PwDatabase* pw;
|
PwDatabase* pw;
|
||||||
CSettingsDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CSettingsDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CSettingsDlg();
|
~CSettingsDlg();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
|
|
||||||
CSimplePasswordDialog::CSimplePasswordDialog(bool HidePw,QWidget* parent, const char* name, bool modal, WFlags fl)
|
CSimplePasswordDialog::CSimplePasswordDialog(bool HidePw,QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
|
||||||
: SimplePasswordDialog(parent,name, modal,fl)
|
: SimplePasswordDialog(parent,name, modal,fl)
|
||||||
{
|
{
|
||||||
if(HidePw)Button_HidePassword->toggle();
|
if(HidePw)Button_HidePassword->toggle();
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CSimplePasswordDialog : public SimplePasswordDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSimplePasswordDialog(bool HidePw,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
CSimplePasswordDialog(bool HidePw,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
|
||||||
~CSimplePasswordDialog();
|
~CSimplePasswordDialog();
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,14 @@ QFile file(FileName);
|
||||||
if(!file.exists()){
|
if(!file.exists()){
|
||||||
err+=QObject::trUtf8("Datei nicht gefunden");
|
err+=QObject::trUtf8("Datei nicht gefunden");
|
||||||
return false;}
|
return false;}
|
||||||
if(!file.open(IO_ReadOnly)){
|
if(!file.open(QIODevice::ReadOnly)){
|
||||||
err+=QObject::trUtf8("Datei konnte nicht geöffnet werden");
|
err+=QObject::trUtf8("Datei konnte nicht geöffnet werden");
|
||||||
return false;}
|
return false;}
|
||||||
int len=file.size();
|
int len=file.size();
|
||||||
if(len==0){
|
if(len==0){
|
||||||
err+=QObject::trUtf8("Datei ist leer");
|
err+=QObject::trUtf8("Datei ist leer");
|
||||||
return false;}
|
return false;}
|
||||||
UINT8* buffer=new UINT8[len];
|
Q_UINT8* buffer=new Q_UINT8[len];
|
||||||
file.readBlock((char*)buffer,len);
|
file.readBlock((char*)buffer,len);
|
||||||
file.close();
|
file.close();
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
|
@ -44,7 +44,7 @@ QString xmlerr;
|
||||||
int col,line;
|
int col,line;
|
||||||
if(!doc.setContent(QString::fromUtf8((char*)buffer,len),false,&xmlerr,&line,&col)){
|
if(!doc.setContent(QString::fromUtf8((char*)buffer,len),false,&xmlerr,&line,&col)){
|
||||||
cout << "Import_PwManager::parseXmlContent():" << endl;
|
cout << "Import_PwManager::parseXmlContent():" << endl;
|
||||||
cout << (xmlerr+" (Line:%1 Column:%2)").arg(line).arg(col) << endl;
|
cout << (xmlerr+" (Line:%1 Column:%2)").arg(line).arg(col).ascii() << endl;
|
||||||
err+=QObject::trUtf8("Ungültiges XML-Dokument");
|
err+=QObject::trUtf8("Ungültiges XML-Dokument");
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return false;}
|
return false;}
|
||||||
|
@ -93,7 +93,7 @@ int offset=0;
|
||||||
if(len<48){
|
if(len<48){
|
||||||
err+=QObject::trUtf8("Unerwartete Dateilänge");
|
err+=QObject::trUtf8("Unerwartete Dateilänge");
|
||||||
return false;}
|
return false;}
|
||||||
UINT8* buffer=new UINT8[len];
|
Q_UINT8* buffer=new Q_UINT8[len];
|
||||||
int df=file.readBlock((char*)buffer,len);
|
int df=file.readBlock((char*)buffer,len);
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ char* buffer=NULL;
|
||||||
int offset=0;
|
int offset=0;
|
||||||
int len=0;
|
int len=0;
|
||||||
if(!file.exists()){err+=QObject::trUtf8("Die angegebene Datei existiert nicht."); return false;}
|
if(!file.exists()){err+=QObject::trUtf8("Die angegebene Datei existiert nicht."); return false;}
|
||||||
if(!file.open(IO_ReadOnly)){err+=QObject::trUtf8("Datei konnte nicht geöffnet werden."); return false;}
|
if(!file.open(QIODevice::ReadOnly)){err+=QObject::trUtf8("Datei konnte nicht geöffnet werden."); return false;}
|
||||||
if(len=file.size()) buffer=new char[len];
|
if(len=file.size()) buffer=new char[len];
|
||||||
else {err+=QObject::trUtf8("Datei ist leer"); return false;}
|
else {err+=QObject::trUtf8("Datei ist leer"); return false;}
|
||||||
file.readBlock(buffer,len);
|
file.readBlock(buffer,len);
|
||||||
|
@ -116,7 +116,7 @@ QString err;
|
||||||
int col,line;
|
int col,line;
|
||||||
if(!db.setContent(QString::fromUtf8(content,strlen(content)-1),false,&err,&line,&col)){
|
if(!db.setContent(QString::fromUtf8(content,strlen(content)-1),false,&err,&line,&col)){
|
||||||
cout << "Import_PwManager::parseXmlContent():" << endl;
|
cout << "Import_PwManager::parseXmlContent():" << endl;
|
||||||
cout << (err+" (Line:%1 Column:%2)").arg(line).arg(col) << endl;
|
cout << (err+" (Line:%1 Column:%2)").arg(line).arg(col).ascii() << endl;
|
||||||
return false;}
|
return false;}
|
||||||
QDomElement root=db.documentElement();
|
QDomElement root=db.documentElement();
|
||||||
if(root.tagName()!="P")return false;
|
if(root.tagName()!="P")return false;
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
|
|
||||||
void CPwmTime::Set(unsigned char* pBytes){
|
void CPwmTime::Set(unsigned char* pBytes){
|
||||||
UINT32 dw1, dw2, dw3, dw4, dw5;
|
Q_UINT32 dw1, dw2, dw3, dw4, dw5;
|
||||||
dw1 = (UINT32)pBytes[0]; dw2 = (UINT32)pBytes[1]; dw3 = (UINT32)pBytes[2];
|
dw1 = (Q_UINT32)pBytes[0]; dw2 = (Q_UINT32)pBytes[1]; dw3 = (Q_UINT32)pBytes[2];
|
||||||
dw4 = (UINT32)pBytes[3]; dw5 = (UINT32)pBytes[4];
|
dw4 = (Q_UINT32)pBytes[3]; dw5 = (Q_UINT32)pBytes[4];
|
||||||
// Unpack 5 byte structure to date and time
|
// Unpack 5 byte structure to date and time
|
||||||
///@FIXME nicht Endian-sicher
|
///@FIXME nicht Endian-sicher
|
||||||
Year = (dw1 << 6) | (dw2 >> 2);
|
Year = (dw1 << 6) | (dw2 >> 2);
|
||||||
|
@ -36,14 +36,14 @@ Second = dw5 & 0x0000003F;
|
||||||
|
|
||||||
void CPwmTime::GetPackedTime(unsigned char* pBytes){
|
void CPwmTime::GetPackedTime(unsigned char* pBytes){
|
||||||
///@FIXME nicht Endian-sicher
|
///@FIXME nicht Endian-sicher
|
||||||
pBytes[0] = (UINT8)(((UINT32)Year >> 6) & 0x0000003F);
|
pBytes[0] = (Q_UINT8)(((Q_UINT32)Year >> 6) & 0x0000003F);
|
||||||
pBytes[1] = (UINT8)((((UINT32)Year & 0x0000003F) << 2) | (((UINT32)Month >> 2) & 0x00000003));
|
pBytes[1] = (Q_UINT8)((((Q_UINT32)Year & 0x0000003F) << 2) | (((Q_UINT32)Month >> 2) & 0x00000003));
|
||||||
pBytes[2] = (UINT8)((((UINT32)Month & 0x00000003) << 6) | (((UINT32)Day & 0x0000001F) << 1) | (((UINT32)Hour >> 4) & 0x00000001));
|
pBytes[2] = (Q_UINT8)((((Q_UINT32)Month & 0x00000003) << 6) | (((Q_UINT32)Day & 0x0000001F) << 1) | (((Q_UINT32)Hour >> 4) & 0x00000001));
|
||||||
pBytes[3] = (UINT8)((((UINT32)Hour & 0x0000000F) << 4) | (((UINT32)Minute >> 2) & 0x0000000F));
|
pBytes[3] = (Q_UINT8)((((Q_UINT32)Hour & 0x0000000F) << 4) | (((Q_UINT32)Minute >> 2) & 0x0000000F));
|
||||||
pBytes[4] = (UINT8)((((UINT32)Minute & 0x00000003) << 6) | ((UINT32)Second & 0x0000003F));
|
pBytes[4] = (Q_UINT8)((((Q_UINT32)Minute & 0x00000003) << 6) | ((Q_UINT32)Second & 0x0000003F));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CPwmTime::GetString(UINT16 format){
|
QString CPwmTime::GetString(Q_UINT16 format){
|
||||||
QString str;
|
QString str;
|
||||||
switch(format){
|
switch(format){
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -88,7 +88,7 @@ str=str.arg(Second);}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPwmTime::Set(UINT8 iDay,UINT8 iMonth,UINT16 iYear,UINT8 iHour,UINT8 iMinute,UINT8 iSecond){
|
void CPwmTime::Set(Q_UINT8 iDay,Q_UINT8 iMonth,Q_UINT16 iYear,Q_UINT8 iHour,Q_UINT8 iMinute,Q_UINT8 iSecond){
|
||||||
Day=iDay;
|
Day=iDay;
|
||||||
Month=iMonth;
|
Month=iMonth;
|
||||||
Year=iYear;
|
Year=iYear;
|
||||||
|
|
|
@ -25,15 +25,15 @@
|
||||||
class CPwmTime;
|
class CPwmTime;
|
||||||
class CPwmTime{
|
class CPwmTime{
|
||||||
public:
|
public:
|
||||||
UINT16 Year;
|
Q_UINT16 Year;
|
||||||
UINT8 Month;
|
Q_UINT8 Month;
|
||||||
UINT8 Day;
|
Q_UINT8 Day;
|
||||||
UINT8 Hour;
|
Q_UINT8 Hour;
|
||||||
UINT8 Minute;
|
Q_UINT8 Minute;
|
||||||
UINT8 Second;
|
Q_UINT8 Second;
|
||||||
|
|
||||||
QString GetString(UINT16 format);
|
QString GetString(Q_UINT16 format);
|
||||||
void Set(UINT8,UINT8,UINT16,UINT8,UINT8,UINT8);
|
void Set(Q_UINT8,Q_UINT8,Q_UINT16,Q_UINT8,Q_UINT8,Q_UINT8);
|
||||||
void Set(unsigned char* packedTime);
|
void Set(unsigned char* packedTime);
|
||||||
void GetPackedTime(unsigned char* dst);
|
void GetPackedTime(unsigned char* dst);
|
||||||
static bool IsValidDate(QString& string);
|
static bool IsValidDate(QString& string);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
|
||||||
UINT8 SecString::Key[32]={0};
|
Q_UINT8 SecString::Key[32]={0};
|
||||||
|
|
||||||
SecString::SecString(){
|
SecString::SecString(){
|
||||||
data=NULL;
|
data=NULL;
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
static void generateSessionKey();
|
static void generateSessionKey();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static UINT8 Key[32];
|
static Q_UINT8 Key[32];
|
||||||
QString plaintext;
|
QString plaintext;
|
||||||
char* data;
|
char* data;
|
||||||
int len;
|
int len;
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
#include <qcolor.h>
|
#include <qcolor.h>
|
||||||
#include <qcursor.h>
|
#include <qcursor.h>
|
||||||
#include <qfontmetrics.h>
|
#include <qfontmetrics.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
LinkLabel::LinkLabel(QWidget *parent, const char* name,const QString& text, int x, int y,WFlags f) : QLabel(parent,name,f){
|
LinkLabel::LinkLabel(QWidget *parent, const char* name,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,name,f){
|
||||||
QFont font(parentWidget()->font()); font.setUnderline(true);
|
QFont font(parentWidget()->font()); font.setUnderline(true);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
setPaletteForegroundColor(QColor(20,20,255));
|
setPaletteForegroundColor(QColor(20,20,255));
|
||||||
setCursor(PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
setText(text);
|
setText(text);
|
||||||
setPos(x,y);
|
setPos(x,y);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +42,7 @@ LinkLabel::~LinkLabel(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkLabel::mouseReleaseEvent(QMouseEvent* event){
|
void LinkLabel::mouseReleaseEvent(QMouseEvent* event){
|
||||||
if(event->button()==LeftButton)
|
if(event->button()==Qt::LeftButton)
|
||||||
clicked();
|
clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,14 @@
|
||||||
#ifndef _LINKLABEL_H_
|
#ifndef _LINKLABEL_H_
|
||||||
#define _LINKLABEL_H_
|
#define _LINKLABEL_H_
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qsignal.h>
|
#include <q3signal.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
class LinkLabel : public QLabel{
|
class LinkLabel : public QLabel{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LinkLabel(QWidget *parent, const char* name = 0,const QString& text=QString::null, int x=0, int y=0,WFlags f=0);
|
LinkLabel(QWidget *parent, const char* name = 0,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);
|
||||||
~LinkLabel();
|
~LinkLabel();
|
||||||
void setPos(int x,int y);
|
void setPos(int x,int y);
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ else{
|
||||||
dev_random = fopen("/dev/urandom","r");}
|
dev_random = fopen("/dev/urandom","r");}
|
||||||
|
|
||||||
if (dev_random==NULL){
|
if (dev_random==NULL){
|
||||||
cout << QObject::tr("/dev/random konnte nicht geöffnet werden - nutze Standardbibliothek (stdlib)") << endl;
|
qWarning(QObject::tr("/dev/random konnte nicht geöffnet werden - nutze Standardbibliothek (stdlib)")+"\n");
|
||||||
srand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
srand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
||||||
for(int i=0;i<NumBlocks*BlockSize;i++){
|
for(int i=0;i<NumBlocks*BlockSize;i++){
|
||||||
UINT8 rnd=rand()%256;
|
Q_UINT8 rnd=rand()%256;
|
||||||
((UINT8*)buffer)[i]=rnd;
|
((Q_UINT8*)buffer)[i]=rnd;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <qlocale.h>
|
#include <qlocale.h>
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
#include "pwsafe.h"
|
#include "pwsafe.h"
|
||||||
#include "PwmConfig.h"
|
#include "PwmConfig.h"
|
||||||
|
|
|
@ -21,23 +21,28 @@
|
||||||
//QT
|
//QT
|
||||||
#include <qtoolbutton.h>
|
#include <qtoolbutton.h>
|
||||||
#include <qmenubar.h>
|
#include <qmenubar.h>
|
||||||
#include <qpopupmenu.h>
|
#include <q3popupmenu.h>
|
||||||
#include <qaction.h>
|
#include <qaction.h>
|
||||||
#include <qimage.h>
|
#include <qimage.h>
|
||||||
#include <qlistview.h>
|
#include <q3listview.h>
|
||||||
#include <qtextedit.h>
|
#include <q3textedit.h>
|
||||||
#include <qclipboard.h>
|
#include <qclipboard.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qprocess.h>
|
#include <q3process.h>
|
||||||
#include <qfiledialog.h>
|
#include <q3filedialog.h>
|
||||||
#include <qpoint.h>
|
#include <qpoint.h>
|
||||||
#include <qstatusbar.h>
|
#include <qstatusbar.h>
|
||||||
#include <qcolor.h>
|
#include <qcolor.h>
|
||||||
#include <qsplitter.h>
|
#include <qsplitter.h>
|
||||||
#include <qvaluelist.h>
|
#include <q3valuelist.h>
|
||||||
#include <qlocale.h>
|
#include <qlocale.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qlibrary.h>
|
#include <qlibrary.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QShowEvent>
|
||||||
//STD
|
//STD
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
//local
|
//local
|
||||||
|
@ -61,7 +66,7 @@
|
||||||
#include "import/Import_PwManager.h"
|
#include "import/Import_PwManager.h"
|
||||||
#include "import/Import_KWalletXml.h"
|
#include "import/Import_KWalletXml.h"
|
||||||
|
|
||||||
CMainWindow::CMainWindow(QApplication* app,QString ArgFile,CConfig* cfg,QWidget* parent,const char* name, WFlags fl)
|
CMainWindow::CMainWindow(QApplication* app,QString ArgFile,CConfig* cfg,QWidget* parent,const char* name, Qt::WFlags fl)
|
||||||
: MainFrame(parent,name,fl)
|
: MainFrame(parent,name,fl)
|
||||||
{
|
{
|
||||||
config=cfg;
|
config=cfg;
|
||||||
|
@ -111,8 +116,8 @@ Icon_Search32x32=new QPixmap;
|
||||||
|
|
||||||
// Signal-Slot Connections //
|
// Signal-Slot Connections //
|
||||||
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimerEvent()));
|
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimerEvent()));
|
||||||
connect(GroupView,SIGNAL(collapsed(QListViewItem*)),this, SLOT(OnGroupItemCollapsed(QListViewItem*)));
|
connect(GroupView,SIGNAL(collapsed(Q3ListViewItem*)),this, SLOT(OnGroupItemCollapsed(Q3ListViewItem*)));
|
||||||
connect(GroupView,SIGNAL(expanded(QListViewItem*)),this, SLOT(OnGroupItemExpanded(QListViewItem*)));
|
connect(GroupView,SIGNAL(expanded(Q3ListViewItem*)),this, SLOT(OnGroupItemExpanded(Q3ListViewItem*)));
|
||||||
|
|
||||||
|
|
||||||
// MainWnd //
|
// MainWnd //
|
||||||
|
@ -207,7 +212,7 @@ else
|
||||||
{
|
{
|
||||||
QFileInfo file(ArgFile);
|
QFileInfo file(ArgFile);
|
||||||
if(file.exists() && file.isFile())OpenDatabase(ArgFile);
|
if(file.exists() && file.isFile())OpenDatabase(ArgFile);
|
||||||
else {cout << "file not found "<< ArgFile << endl;}
|
else {cout << "file not found "<< ArgFile.ascii() << endl;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +252,7 @@ void CMainWindow::OnMainWinResize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnFileOpen(){
|
void CMainWindow::OnFileOpen(){
|
||||||
QString filename=QFileDialog::getOpenFileName(QDir::homeDirPath(),"*.kdb",this,trUtf8("Datenbank öffnen"));
|
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"*.kdb",this,trUtf8("Datenbank öffnen"));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
OpenDatabase(filename);
|
OpenDatabase(filename);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +294,7 @@ else{
|
||||||
delete db;
|
delete db;
|
||||||
FileOpen=false;
|
FileOpen=false;
|
||||||
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Beim öffnen der Datenbank ist ein Fehler aufgetreten:\n%1")
|
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Beim öffnen der Datenbank ist ein Fehler aufgetreten:\n%1")
|
||||||
.arg(err),trUtf8("OK"),0,0);
|
.arg(err),trUtf8("OK"),0,0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +334,7 @@ for(int i=0;i<GroupItems.size();i++){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMainWindow::OnGroupChanged(QListViewItem* item){
|
void CMainWindow::OnGroupChanged(Q3ListViewItem* item){
|
||||||
if(item){
|
if(item){
|
||||||
SetEditMenuState(STATE_SingleGroupSelected);
|
SetEditMenuState(STATE_SingleGroupSelected);
|
||||||
setCurrentGroup((GroupItem*)item);
|
setCurrentGroup((GroupItem*)item);
|
||||||
|
@ -426,7 +431,7 @@ tmp->setText(j++,entry->BinaryDesc);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnEntryChanged(QListViewItem* item){
|
void CMainWindow::OnEntryChanged(Q3ListViewItem* item){
|
||||||
if(item)SetEditMenuState(STATE_SingleEntrySelected);
|
if(item)SetEditMenuState(STATE_SingleEntrySelected);
|
||||||
else SetEditMenuState(STATE_NoEntrySelected);
|
else SetEditMenuState(STATE_NoEntrySelected);
|
||||||
updateEntryDetails((EntryItem*)item);
|
updateEntryDetails((EntryItem*)item);
|
||||||
|
@ -436,7 +441,7 @@ updateEntryDetails((EntryItem*)item);
|
||||||
void CMainWindow::showEvent(QShowEvent *event){
|
void CMainWindow::showEvent(QShowEvent *event){
|
||||||
if(event->spontaneous()==false){
|
if(event->spontaneous()==false){
|
||||||
SetEditMenuState(STATE_NoGroupSelected);
|
SetEditMenuState(STATE_NoGroupSelected);
|
||||||
QValueList<int> s;
|
Q3ValueList<int> s;
|
||||||
s.push_back(25); s.push_back(100);
|
s.push_back(25); s.push_back(100);
|
||||||
parentWidget()->resize(750,450);
|
parentWidget()->resize(750,450);
|
||||||
splitter->setSizes(s);
|
splitter->setSizes(s);
|
||||||
|
@ -466,7 +471,7 @@ SetFileMenuState(STATE_FileOpen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnEntryDoubleClicked(QListViewItem* item,const QPoint& Point, int column){
|
void CMainWindow::OnEntryDoubleClicked(Q3ListViewItem* item,const QPoint& Point, int column){
|
||||||
if(item && (column==0)){
|
if(item && (column==0)){
|
||||||
OnEditEntry();
|
OnEditEntry();
|
||||||
}
|
}
|
||||||
|
@ -487,7 +492,7 @@ float b1[3];
|
||||||
float b2[3];
|
float b2[3];
|
||||||
float a1,a2;
|
float a1,a2;
|
||||||
QPixmap* banner_pixmap=new QPixmap(w,h); ///@FIXME löscht der Destruktor von QLabel die Pixmap zum schluss???
|
QPixmap* banner_pixmap=new QPixmap(w,h); ///@FIXME löscht der Destruktor von QLabel die Pixmap zum schluss???
|
||||||
QPainter painter(banner_pixmap,24);
|
QPainter painter(banner_pixmap);
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setWidth(1);
|
pen.setWidth(1);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
|
@ -562,7 +567,7 @@ if(db->SaveDataBase(db->filename))setModFlag(false);
|
||||||
|
|
||||||
void CMainWindow::OnFileSaveAs()
|
void CMainWindow::OnFileSaveAs()
|
||||||
{
|
{
|
||||||
QString filename=QFileDialog::getSaveFileName(QDir::homeDirPath(),"*.kdb",this,trUtf8("Datenbank öffnen"));
|
QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"*.kdb",this,trUtf8("Datenbank öffnen"));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
db->filename=filename;
|
db->filename=filename;
|
||||||
config->LastFile=filename;
|
config->LastFile=filename;
|
||||||
|
@ -741,7 +746,7 @@ OpenURL(currentEntry()->URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OpenURL(QString url){
|
void CMainWindow::OpenURL(QString url){
|
||||||
QProcess browser;
|
Q3Process browser;
|
||||||
browser.setArguments(QStringList::split(' ',config->OpenUrlCommand.arg(url)));
|
browser.setArguments(QStringList::split(' ',config->OpenUrlCommand.arg(url)));
|
||||||
browser.start();
|
browser.start();
|
||||||
}
|
}
|
||||||
|
@ -753,7 +758,7 @@ if(entry.BinaryDataLength==0){
|
||||||
QMessageBox::information(NULL,trUtf8("Hinweis"),trUtf8("Dieser Eintrag hat keinen Dateianhang."),"OK");
|
QMessageBox::information(NULL,trUtf8("Hinweis"),trUtf8("Dieser Eintrag hat keinen Dateianhang."),"OK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString filename=QFileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Anhang speichern..."));
|
QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Anhang speichern..."));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
|
@ -763,7 +768,7 @@ if(file.remove()==false){
|
||||||
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht überschrieben werden."),trUtf8("OK"));
|
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht überschrieben werden."),trUtf8("OK"));
|
||||||
return;}
|
return;}
|
||||||
}
|
}
|
||||||
if(file.open(IO_WriteOnly)==false){
|
if(file.open(QIODevice::WriteOnly)==false){
|
||||||
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht erstellt werden."),trUtf8("OK"));
|
QMessageBox::critical(NULL,trUtf8("Fehler"),trUtf8("Datei konnte nicht erstellt werden."),trUtf8("OK"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -896,11 +901,11 @@ updateGroupView();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnEntryRightClicked(QListViewItem* item, const QPoint& pos,int column)
|
void CMainWindow::OnEntryRightClicked(Q3ListViewItem* item, const QPoint& pos,int column)
|
||||||
{
|
{
|
||||||
if(!FileOpen)return;
|
if(!FileOpen)return;
|
||||||
if(!CurrentGroup) return;
|
if(!CurrentGroup) return;
|
||||||
QPopupMenu menu;
|
Q3PopupMenu menu;
|
||||||
connect(&menu, SIGNAL(activated(int)), this, SLOT(OnEntryCtxMenuClicked(int)));
|
connect(&menu, SIGNAL(activated(int)), this, SLOT(OnEntryCtxMenuClicked(int)));
|
||||||
menu.insertItem(trUtf8("Passwort in Zwischenablage kopieren"),1);
|
menu.insertItem(trUtf8("Passwort in Zwischenablage kopieren"),1);
|
||||||
menu.insertItem(trUtf8("Benutzername in Zwischenablage kopieren"),2);
|
menu.insertItem(trUtf8("Benutzername in Zwischenablage kopieren"),2);
|
||||||
|
@ -951,11 +956,11 @@ break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnGroupRightClicked(QListViewItem* item, const QPoint& pos, int column)
|
void CMainWindow::OnGroupRightClicked(Q3ListViewItem* item, const QPoint& pos, int column)
|
||||||
{
|
{
|
||||||
if(!FileOpen)return;
|
if(!FileOpen)return;
|
||||||
|
|
||||||
QPopupMenu menu;
|
Q3PopupMenu menu;
|
||||||
if(column!=-1){
|
if(column!=-1){
|
||||||
if(((GroupItem*)item)->pGroup->ID!=db->SearchGroupID){
|
if(((GroupItem*)item)->pGroup->ID!=db->SearchGroupID){
|
||||||
connect(&menu, SIGNAL(activated(int)), this, SLOT(OnGroupCtxMenuClicked(int)));
|
connect(&menu, SIGNAL(activated(int)), this, SLOT(OnGroupCtxMenuClicked(int)));
|
||||||
|
@ -1146,7 +1151,7 @@ updateEntryView();
|
||||||
|
|
||||||
void CMainWindow::OnExtrasLanguage()
|
void CMainWindow::OnExtrasLanguage()
|
||||||
{
|
{
|
||||||
CLanguageDlg dlg(this,0,true);
|
CLanguageDlg dlg(this,0/*,QT3 modal? = true*/);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1166,11 +1171,11 @@ modflag=flag;
|
||||||
toolButtonSave->setEnabled(flag);
|
toolButtonSave->setEnabled(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnGroupItemExpanded(QListViewItem* item){
|
void CMainWindow::OnGroupItemExpanded(Q3ListViewItem* item){
|
||||||
((GroupItem*)item)->pGroup->UI_ItemIsExpanded=true;
|
((GroupItem*)item)->pGroup->UI_ItemIsExpanded=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnGroupItemCollapsed(QListViewItem* item){
|
void CMainWindow::OnGroupItemCollapsed(Q3ListViewItem* item){
|
||||||
((GroupItem*)item)->pGroup->UI_ItemIsExpanded=false;
|
((GroupItem*)item)->pGroup->UI_ItemIsExpanded=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1191,7 @@ if(db->Groups.size()){
|
||||||
//cout << "Start: 0x" << QString::number((unsigned int)&db->Groups.front(),16) << endl;
|
//cout << "Start: 0x" << QString::number((unsigned int)&db->Groups.front(),16) << endl;
|
||||||
//cout << "End: 0x" << QString::number((unsigned int)&db->Groups.back(),16) << endl;
|
//cout << "End: 0x" << QString::number((unsigned int)&db->Groups.back(),16) << endl;
|
||||||
for(int i=0;i<db->Groups.size();i++){
|
for(int i=0;i<db->Groups.size();i++){
|
||||||
cout << QString("(+%1) '%2', Level=%3, ID=%4").arg(i).arg(db->Groups[i].Name).arg(db->Groups[i].Level).arg(db->Groups[i].ID)
|
cout << QString("(+%1) '%2', Level=%3, ID=%4").arg(i).arg(db->Groups[i].Name).arg(db->Groups[i].Level).arg(db->Groups[i].ID).ascii()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1201,7 +1206,7 @@ QString groupname="???";
|
||||||
groupname="'"+db->Groups[j].Name+"'";
|
groupname="'"+db->Groups[j].Name+"'";
|
||||||
break;}
|
break;}
|
||||||
}
|
}
|
||||||
cout << QString("(+%1) '%2', GroupID=%3 [%4], sID=%5").arg(i).arg(db->Entries[i].Title).arg(db->Entries[i].GroupID).arg(groupname).arg(db->Entries[i].sID)
|
cout << QString("(+%1) '%2', GroupID=%3 [%4], sID=%5").arg(i).arg(db->Entries[i].Title).arg(db->Entries[i].GroupID).arg(groupname).arg(db->Entries[i].sID).ascii()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1233,7 +1238,7 @@ switch(ret){
|
||||||
case 2: return;
|
case 2: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString filename=QFileDialog::getOpenFileName(QDir::homeDirPath(),"*.pwm",this,trUtf8("Datenbank importieren"));
|
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"*.pwm",this,trUtf8("Datenbank importieren"));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
CSimplePasswordDialog dlg(!config->ShowPasswords,this,"SimplePasswordDlg",true);
|
CSimplePasswordDialog dlg(!config->ShowPasswords,this,"SimplePasswordDlg",true);
|
||||||
if(!dlg.exec())return;
|
if(!dlg.exec())return;
|
||||||
|
@ -1305,7 +1310,7 @@ switch(ret){
|
||||||
case 2: return;
|
case 2: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString filename=QFileDialog::getOpenFileName(QDir::homeDirPath(),"*.xml",this,trUtf8("Datenbank importieren"));
|
QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"*.xml",this,trUtf8("Datenbank importieren"));
|
||||||
if(filename=="")return;
|
if(filename=="")return;
|
||||||
Import_KWalletXml importer;
|
Import_KWalletXml importer;
|
||||||
QString err;
|
QString err;
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
//Added by qt3to4:
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QTranslator>
|
||||||
|
#include <QDropEvent>
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include "ListViews.h"
|
#include "ListViews.h"
|
||||||
#include "PwmConfig.h"
|
#include "PwmConfig.h"
|
||||||
|
@ -40,7 +44,7 @@ Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*$PUBLIC_FUNCTIONS$*/
|
/*$PUBLIC_FUNCTIONS$*/
|
||||||
CMainWindow(QApplication* app,QString ArgFile,CConfig* config, QWidget* parent = 0,const char* name = 0, WFlags fl = 0 );
|
CMainWindow(QApplication* app,QString ArgFile,CConfig* config, QWidget* parent = 0,const char* name = 0, Qt::WFlags fl = 0 );
|
||||||
~CMainWindow();
|
~CMainWindow();
|
||||||
protected:
|
protected:
|
||||||
/*$PROTECTED_FUNCTIONS$*/
|
/*$PROTECTED_FUNCTIONS$*/
|
||||||
|
@ -54,9 +58,9 @@ public slots:
|
||||||
virtual void OnClose();
|
virtual void OnClose();
|
||||||
virtual void OnMainWinResize();
|
virtual void OnMainWinResize();
|
||||||
virtual void OnFileOpen();
|
virtual void OnFileOpen();
|
||||||
virtual void OnGroupChanged(QListViewItem*);
|
virtual void OnGroupChanged(Q3ListViewItem*);
|
||||||
virtual void OnEntryChanged(QListViewItem*);
|
virtual void OnEntryChanged(Q3ListViewItem*);
|
||||||
virtual void OnEntryDoubleClicked(QListViewItem*,const QPoint&,int);
|
virtual void OnEntryDoubleClicked(Q3ListViewItem*,const QPoint&,int);
|
||||||
virtual void OnMenu_closeDB();
|
virtual void OnMenu_closeDB();
|
||||||
virtual void OnFileSaveAs();
|
virtual void OnFileSaveAs();
|
||||||
virtual void OnFileSave();
|
virtual void OnFileSave();
|
||||||
|
@ -76,9 +80,9 @@ public slots:
|
||||||
virtual void OnEditEntry();
|
virtual void OnEditEntry();
|
||||||
virtual void OnAddEntry();
|
virtual void OnAddEntry();
|
||||||
virtual void OnSaveAttachment();
|
virtual void OnSaveAttachment();
|
||||||
virtual void OnEntryRightClicked(QListViewItem* item, const QPoint& pos,int column);
|
virtual void OnEntryRightClicked(Q3ListViewItem* item, const QPoint& pos,int column);
|
||||||
virtual void OnEntryCtxMenuClicked(int id);
|
virtual void OnEntryCtxMenuClicked(int id);
|
||||||
virtual void OnGroupRightClicked(QListViewItem* item, const QPoint& pos, int column);
|
virtual void OnGroupRightClicked(Q3ListViewItem* item, const QPoint& pos, int column);
|
||||||
virtual void OnGroupCtxMenuClicked(int id);
|
virtual void OnGroupCtxMenuClicked(int id);
|
||||||
virtual void OnChangeDbKey();
|
virtual void OnChangeDbKey();
|
||||||
virtual void OnDbSettings();
|
virtual void OnDbSettings();
|
||||||
|
@ -100,8 +104,8 @@ public slots:
|
||||||
virtual void OnExtrasLanguage();
|
virtual void OnExtrasLanguage();
|
||||||
virtual void OnSearchGroupCtxMenuClicked(int);
|
virtual void OnSearchGroupCtxMenuClicked(int);
|
||||||
virtual void OnQickSearch();
|
virtual void OnQickSearch();
|
||||||
virtual void OnGroupItemExpanded(QListViewItem* item);
|
virtual void OnGroupItemExpanded(Q3ListViewItem* item);
|
||||||
virtual void OnGroupItemCollapsed(QListViewItem* item);
|
virtual void OnGroupItemCollapsed(Q3ListViewItem* item);
|
||||||
virtual void DEBUG_OnPrintDbStucture();
|
virtual void DEBUG_OnPrintDbStucture();
|
||||||
virtual void OnImportPwManagerFile();
|
virtual void OnImportPwManagerFile();
|
||||||
virtual void OnView_HideUsernamesToggled(bool state);
|
virtual void OnView_HideUsernamesToggled(bool state);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "pwsafe.h"
|
#include "pwsafe.h"
|
||||||
|
|
||||||
PwSafe::PwSafe(QApplication* app,QString& ArgFile,CConfig* cfg):QMainWindow( 0, "Keepass")
|
PwSafe::PwSafe(QApplication* app,QString& ArgFile,CConfig* cfg):Q3MainWindow( 0, "Keepass")
|
||||||
{
|
{
|
||||||
|
|
||||||
mainWin=new CMainWindow(app,ArgFile,cfg,this);
|
mainWin=new CMainWindow(app,ArgFile,cfg,this);
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
#define _PWSAFE_H_
|
#define _PWSAFE_H_
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qmainwindow.h>
|
#include <q3mainwindow.h>
|
||||||
#include "PwmConfig.h"
|
#include "PwmConfig.h"
|
||||||
|
|
||||||
class CMainWindow;
|
class CMainWindow;
|
||||||
|
|
||||||
class PwSafe : public QMainWindow
|
class PwSafe : public Q3MainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -97,3 +97,8 @@ thread \
|
||||||
exceptions \
|
exceptions \
|
||||||
stl
|
stl
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
#The following line was inserted by qt3to4
|
||||||
|
QT += xml qt3support
|
||||||
|
#The following line was inserted by qt3to4
|
||||||
|
CONFIG += uic3
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue