Basic framework for textbook rsa