00001
00002
00003
00004 #ifndef SST_SIGN_H
00005 #define SST_SIGN_H
00006
00007 #include <QString>
00008
00009 class QObject;
00010 class QByteArray;
00011
00012 namespace SST {
00013
00014 class SecureHash;
00015
00016 class SignKey
00017 {
00018 public:
00019 enum Type {
00020 Invalid = 0,
00021 Public = 1,
00022 Private = 2
00023 };
00024
00025 private:
00026 Type t;
00027
00028 public:
00029
00030 inline Type type() const { return t; }
00031
00032
00033
00034 virtual QByteArray id() const = 0;
00035
00036
00037 virtual QByteArray key(bool getPrivateKey = false) const = 0;
00038
00039
00040
00041 virtual SecureHash *newHash(QObject *parent = 0) const = 0;
00042
00043
00044 virtual QByteArray sign(const QByteArray &digest) const = 0;
00045 virtual bool verify(const QByteArray &digest,
00046 const QByteArray &sig) const = 0;
00047
00048 virtual ~SignKey();
00049
00050 protected:
00051 SignKey();
00052
00053 inline void setType(Type t) { this->t = t; }
00054 };
00055
00056 }
00057
00058 #endif // SST_SIGN_H