SymmetricKey: add getMode()

This commit is contained in:
terrafrost 2021-11-28 11:27:52 -06:00
parent a85c2f0d6e
commit 1bd5b40ee1

View File

@ -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];
}
}