2005-01-06 22:46:08 +00:00
|
|
|
/*
|
|
|
|
* qca_securemessage.cpp - Qt Cryptographic Architecture
|
|
|
|
* Copyright (C) 2003-2005 Justin Karneges <justin@affinix.com>
|
|
|
|
* Copyright (C) 2004,2005 Brad Hards <bradh@frogmouth.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "qca_securemessage.h"
|
|
|
|
|
2005-01-07 08:53:39 +00:00
|
|
|
#include <qdatetime.h>
|
|
|
|
#include "qca_publickey.h"
|
|
|
|
#include "qca_cert.h"
|
|
|
|
|
2005-01-06 22:46:08 +00:00
|
|
|
namespace QCA {
|
|
|
|
|
2005-01-07 08:53:39 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// SecureMessageKey
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
SecureMessageKey::SecureMessageKey()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKey::SecureMessageKey(const SecureMessageKey &from)
|
|
|
|
{
|
|
|
|
Q_UNUSED(from);
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKey::~SecureMessageKey()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKey & SecureMessageKey::operator=(const SecureMessageKey &from)
|
|
|
|
{
|
|
|
|
Q_UNUSED(from);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKey::Type SecureMessageKey::type() const
|
|
|
|
{
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SecureMessageKey::pgpPublicKey() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SecureMessageKey::pgpSecretKey() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessageKey::setPGPPublicKey(const QString &id, const QString &name)
|
|
|
|
{
|
|
|
|
Q_UNUSED(id);
|
|
|
|
Q_UNUSED(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessageKey::setPGPSecretKey(const QString &id)
|
|
|
|
{
|
|
|
|
Q_UNUSED(id);
|
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
CertificateChain SecureMessageKey::x509CertificateChain() const
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
2005-01-08 23:38:02 +00:00
|
|
|
return CertificateChain();
|
2005-01-07 08:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PrivateKey SecureMessageKey::x509PrivateKey() const
|
|
|
|
{
|
|
|
|
return PrivateKey();
|
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
void SecureMessageKey::setX509CertificateChain(const CertificateChain &c)
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessageKey::setX509PrivateKey(const PrivateKey &k)
|
|
|
|
{
|
|
|
|
Q_UNUSED(k);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SecureMessageKey::havePrivate() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SecureMessageKey::id() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SecureMessageKey::name() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2005-01-06 22:46:08 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// SecureMessage
|
|
|
|
//----------------------------------------------------------------------------
|
2005-01-07 08:53:39 +00:00
|
|
|
SecureMessage::SecureMessage(SecureMessageSystem *system)
|
|
|
|
{
|
|
|
|
Q_UNUSED(system);
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessage::~SecureMessage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
/*void SecureMessage::encrypt(const QSecureArray &in, const SecureMessageKey &key)
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::encrypt(const QSecureArray &in, const SecureMessageKeyList &keys)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::encryptAndSign(const QSecureArray &in, const SecureMessageKey &key, const SecureMessageKey &signer, Mode m)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(key);
|
|
|
|
Q_UNUSED(signer);
|
|
|
|
Q_UNUSED(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::encryptAndSign(const QSecureArray &in, const SecureMessageKeyList &keys, const SecureMessageKey &signer, Mode m)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(keys);
|
|
|
|
Q_UNUSED(signer);
|
|
|
|
Q_UNUSED(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::decrypt(const QString &in)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::sign(const QSecureArray &in, const SecureMessageKey &signer)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(signer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::verify(const QSecureArray &in, const QString &sig)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
Q_UNUSED(sig);
|
2005-01-08 23:38:02 +00:00
|
|
|
}*/
|
|
|
|
|
|
|
|
bool SecureMessage::canSignMultiple() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setEnableBundleSigner(bool b)
|
|
|
|
{
|
|
|
|
Q_UNUSED(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setFormat(Format f)
|
|
|
|
{
|
|
|
|
Q_UNUSED(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setRecipient(const SecureMessageKey &key)
|
|
|
|
{
|
|
|
|
Q_UNUSED(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setRecipients(const SecureMessageKeyList &keys)
|
|
|
|
{
|
|
|
|
Q_UNUSED(keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setSigner(const SecureMessageKey &key)
|
|
|
|
{
|
|
|
|
Q_UNUSED(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::setSigners(const SecureMessageKeyList &keys)
|
|
|
|
{
|
|
|
|
Q_UNUSED(keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::startEncrypt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::startDecrypt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-01-16 11:37:17 +00:00
|
|
|
void SecureMessage::startSign(SignMode m)
|
2005-01-08 23:38:02 +00:00
|
|
|
{
|
2005-01-16 11:28:10 +00:00
|
|
|
Q_UNUSED(m);
|
2005-01-08 23:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::startVerify(const QSecureArray &sig)
|
|
|
|
{
|
|
|
|
Q_UNUSED(sig);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::startEncryptAndSign(Order o)
|
|
|
|
{
|
|
|
|
Q_UNUSED(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::startDecryptAndVerify(Order o)
|
|
|
|
{
|
|
|
|
Q_UNUSED(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::update(const QSecureArray &in)
|
|
|
|
{
|
|
|
|
Q_UNUSED(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSecureArray SecureMessage::read(int size)
|
|
|
|
{
|
|
|
|
Q_UNUSED(size);
|
|
|
|
return QSecureArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
int SecureMessage::bytesAvailable() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SecureMessage::end()
|
|
|
|
{
|
2005-01-07 08:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SecureMessage::waitForFinished()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SecureMessage::success() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessage::Error SecureMessage::errorCode() const
|
|
|
|
{
|
|
|
|
return ErrUnknown;
|
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
QSecureArray SecureMessage::signature() const
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
2005-01-08 23:38:02 +00:00
|
|
|
return QSecureArray();
|
2005-01-07 08:53:39 +00:00
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
SecureMessage::VerifyResult SecureMessage::verifyResult() const
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
2005-01-08 23:38:02 +00:00
|
|
|
return Invalid;
|
2005-01-07 08:53:39 +00:00
|
|
|
}
|
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
CertValidity SecureMessage::keyValidity() const
|
2005-01-07 08:53:39 +00:00
|
|
|
{
|
2005-01-08 23:38:02 +00:00
|
|
|
return QCA::Valid;
|
2005-01-07 08:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKey SecureMessage::key() const
|
|
|
|
{
|
|
|
|
return SecureMessageKey();
|
|
|
|
}
|
|
|
|
|
|
|
|
QDateTime SecureMessage::timestamp() const
|
|
|
|
{
|
|
|
|
return QDateTime();
|
|
|
|
}
|
|
|
|
|
2005-01-06 22:46:08 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// SecureMessageSystem
|
|
|
|
//----------------------------------------------------------------------------
|
2005-01-07 08:53:39 +00:00
|
|
|
SecureMessageSystem::SecureMessageSystem(QObject *parent, const char *name)
|
|
|
|
:QObject(parent, name)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageSystem::~SecureMessageSystem()
|
|
|
|
{
|
|
|
|
}
|
2005-01-06 22:46:08 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// OpenPGP
|
|
|
|
//----------------------------------------------------------------------------
|
2005-01-07 08:53:39 +00:00
|
|
|
OpenPGP::OpenPGP(QObject *parent, const char *name, const QString &provider)
|
|
|
|
:SecureMessageSystem(parent, name), Algorithm("openpgp", provider)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenPGP::~OpenPGP()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenPGP::setAllowAgent(bool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenPGP::submitPassphrase(const QSecureArray &passphrase)
|
|
|
|
{
|
|
|
|
Q_UNUSED(passphrase);
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKeyList OpenPGP::secretKeys() const
|
|
|
|
{
|
|
|
|
return SecureMessageKeyList();
|
|
|
|
}
|
|
|
|
|
|
|
|
SecureMessageKeyList OpenPGP::publicKeys() const
|
|
|
|
{
|
|
|
|
return SecureMessageKeyList();
|
|
|
|
}
|
2005-01-06 22:46:08 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// SMIME
|
|
|
|
//----------------------------------------------------------------------------
|
2005-01-07 08:53:39 +00:00
|
|
|
SMIME::SMIME(QObject *parent, const char *name, const QString &provider)
|
|
|
|
:SecureMessageSystem(parent, name), Algorithm("smime", provider)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SMIME::~SMIME()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SMIME::setStore(const Store &store)
|
|
|
|
{
|
|
|
|
Q_UNUSED(store);
|
|
|
|
}
|
2005-01-06 22:46:08 +00:00
|
|
|
|
2005-01-08 23:38:02 +00:00
|
|
|
void SMIME::setPrivateKeys(const QValueList<PrivateKey> &keys)
|
|
|
|
{
|
|
|
|
Q_UNUSED(keys);
|
|
|
|
}
|
|
|
|
|
2005-01-06 22:46:08 +00:00
|
|
|
}
|