From 7ba006ccdc963da127e985005124d48d700f6d78 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 7 Oct 2012 18:53:26 -0500 Subject: [PATCH] Add getSize() function to Crypt_RSA --- phpseclib/Crypt/RSA.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index a30ca152..567cbff8 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -1228,6 +1228,19 @@ class Crypt_RSA { } } + /** + * Returns the key size + * + * More specifically, this returns the size of the modulo in bits. + * + * @access public + * @return Integer + */ + function getSize() + { + return !isset($this->modulus) ? 0 : strlen($this->modulus->toBits()); + } + /** * Start Element Handler *