Public-Key Cryptography with Tight Security