Example #1
0
  bool AsymmetricKey::VerifyKey(const AsymmetricKey &key) const
  {
    if(this->IsPrivateKey() == key.IsPrivateKey()) {
      return false;
    }

    QSharedPointer<AsymmetricKey> pkey0(this->GetPublicKey());
    QSharedPointer<AsymmetricKey> pkey1(key.GetPublicKey());
    return pkey0->Equals(*pkey1);
  }
Example #2
0
  bool LRSPublicKey::VerifyKey(AsymmetricKey &key) const
  {
    if(key.IsPrivateKey() ^ !IsPrivateKey()) {
      return false;
    }

    QSharedPointer<AsymmetricKey> key0(GetPublicKey());
    QSharedPointer<AsymmetricKey> key1(key.GetPublicKey());
    return key0 == key1;
  }
Example #3
0
 bool NullPublicKey::VerifyKey(AsymmetricKey &key) const
 {
   if(!IsValid() || !key.IsValid() || (IsPrivateKey() == key.IsPrivateKey())) {
     return false;
   }
     
   NullPublicKey *other = dynamic_cast<NullPublicKey *>(&key);
   if(!other) {
     return false;
   }
   
   return other->_key_id == _key_id;
 }
Example #4
0
bool ShuffleRound::Verify(const QByteArray &data, QByteArray &msg, const Id &id)
{
    AsymmetricKey *key = _group.GetKey(id);
    if(!key) {
        qWarning() << "Received malsigned data block, no such peer";
        return false;
    }

    int sig_size = AsymmetricKey::KeySize / 8;
    if(data.size() < sig_size) {
        qWarning() << "Received malsigned data block, not enough data blocks." <<
                   "Expected at least: " << sig_size << " got " << data.size();
        return false;
    }

    msg = QByteArray::fromRawData(data.data(), data.size() - sig_size);
    QByteArray sig = QByteArray::fromRawData(data.data() + msg.size(), sig_size);
    return key->Verify(msg, sig);
}
Example #5
0
 bool AsymmetricKey::Equals(const AsymmetricKey &key) const
 {
   return this->GetByteArray() == key.GetByteArray();
 }
 /**
  * Returns the not equivalence of the given key with the current key
  * @param key the given key
  */
 virtual bool operator!=(const AsymmetricKey &key) const
 {
   return this->GetByteArray() != key.GetByteArray();
 }