Extended fix for the RSA boundary check

This patch makes the unit tests pass. It also add new ones (which should have been there in the first place).