From 704de04a078e75c72bfd64c69474dc53b2e39fef Mon Sep 17 00:00:00 2001 From: Justin Karneges Date: Mon, 4 Apr 2005 00:34:13 +0000 Subject: [PATCH] key bitsize svn path=/trunk/kdesupport/qca/; revision=402997 --- include/QtCrypto/qca_publickey.h | 1 + include/QtCrypto/qcaprovider.h | 1 + plugins/qca-openssl/qca-openssl.cpp | 15 +++++++++++++++ src/qca_publickey.cpp | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/include/QtCrypto/qca_publickey.h b/include/QtCrypto/qca_publickey.h index 5953b44d..5280d4ea 100644 --- a/include/QtCrypto/qca_publickey.h +++ b/include/QtCrypto/qca_publickey.h @@ -142,6 +142,7 @@ namespace QCA bool isNull() const; Type type() const; + int bitSize() const; bool isRSA() const; bool isDSA() const; diff --git a/include/QtCrypto/qcaprovider.h b/include/QtCrypto/qcaprovider.h index e056d68d..fb58ed3a 100644 --- a/include/QtCrypto/qcaprovider.h +++ b/include/QtCrypto/qcaprovider.h @@ -138,6 +138,7 @@ public: virtual bool isNull() const = 0; virtual bool isPrivate() const = 0; virtual void convertToPublic() = 0; + virtual int bits() const = 0; // encrypt/decrypt virtual int maximumEncryptSize(EncryptionAlgorithm alg) const; diff --git a/plugins/qca-openssl/qca-openssl.cpp b/plugins/qca-openssl/qca-openssl.cpp index 3dbf6864..64f5df3d 100644 --- a/plugins/qca-openssl/qca-openssl.cpp +++ b/plugins/qca-openssl/qca-openssl.cpp @@ -1466,6 +1466,11 @@ public: sec = false; } + virtual int bits() const + { + return 0; // FIXME + } + virtual int maximumEncryptSize(QCA::EncryptionAlgorithm alg) const { RSA *rsa = evp.pkey->pkey.rsa; @@ -1780,6 +1785,11 @@ public: sec = false; } + virtual int bits() const + { + return 0; // FIXME + } + virtual void startSign(QCA::SignatureAlgorithm, QCA::SignatureFormat format) { // openssl native format is DER, so transform otherwise @@ -2025,6 +2035,11 @@ public: sec = false; } + virtual int bits() const + { + return 0; // FIXME + } + virtual QCA::SymmetricKey deriveKey(const PKeyBase &theirs) const { DH *dh = evp.pkey->pkey.dh; diff --git a/src/qca_publickey.cpp b/src/qca_publickey.cpp index 55b0aa87..2df081c4 100644 --- a/src/qca_publickey.cpp +++ b/src/qca_publickey.cpp @@ -231,6 +231,11 @@ PKey::Type PKey::type() const return static_cast(context())->type(); } +int PKey::bitSize() const +{ + return static_cast(context())->bits(); +} + bool PKey::isRSA() const { return (type() == RSA);