4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-08 08:49:34 +00:00

ability to compare keys

svn path=/trunk/kdesupport/qca/; revision=394989
This commit is contained in:
Justin Karneges 2005-03-05 04:04:38 +00:00
parent 9e0128f477
commit d93a2e610e
2 changed files with 16 additions and 0 deletions

@ -121,6 +121,9 @@ namespace QCA
PublicKey toPublicKey() const;
PrivateKey toPrivateKey() const;
bool operator==(const PKey &a) const;
bool operator!=(const PKey &a) const;
protected:
PKey(const QString &type, const QString &provider);
void set(const PKey &k);

@ -224,6 +224,19 @@ DHPrivateKey PKey::toDHPrivateKey() const
return k;
}
bool PKey::operator==(const PKey &a) const
{
if(a.isPrivate())
return (toPrivateKey().toDER() == a.toPrivateKey().toDER());
else
return (toPublicKey().toDER() == a.toPublicKey().toDER());
}
bool PKey::operator!=(const PKey &a) const
{
return !(*this == a);
}
//----------------------------------------------------------------------------
// PublicKey
//----------------------------------------------------------------------------