From 1bd5b40ee131fd1548cdc1561a25957ea9f3a0c5 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 28 Nov 2021 11:27:52 -0600 Subject: [PATCH] SymmetricKey: add getMode() --- phpseclib/Crypt/Common/SymmetricKey.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpseclib/Crypt/Common/SymmetricKey.php b/phpseclib/Crypt/Common/SymmetricKey.php index dacd25f8..f6384724 100644 --- a/phpseclib/Crypt/Common/SymmetricKey.php +++ b/phpseclib/Crypt/Common/SymmetricKey.php @@ -3288,4 +3288,17 @@ abstract class SymmetricKey $mask = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"; return strrev($r->toBytes()) & $mask; } + + /** + * Return the mode + * + * You can do $obj instanceof AES or whatever to get the cipher but you can't do that to get the mode + * + * @access public + * @return string + */ + public function getMode() + { + return array_flip(self::MODE_MAP)[$this->mode]; + } } \ No newline at end of file