Hmmm. Could use some other opinions here.


On Thu, Apr 24, 2014 at 3:37 PM, Paul Kehrer <notifications@github.com>wrote:

> In tests/hazmat/primitives/test_rsa.py:
>
> > +    )
> > +    def test_rsa_encrypt_key_too_small(self, key_size, pad, backend):
> > +        private_key = rsa.RSAPrivateKey.generate(
> > +            public_exponent=65537,
> > +            key_size=key_size,
> > +            backend=backend
> > +        )
> > +        public_key = private_key.public_key()
> > +        with pytest.raises(ValueError):
> > +            public_key.encrypt(
> > +                b"\x00" * (key_size // 8 - 1),
> > +                pad,
> > +                backend
> > +            )
> > +
> > +    def test_rsa_encrypt_data_too_large(self, backend):
>
> It will catch it when encrypting but when decrypting it will just raise
> ValueError("Decryption failed"). I originally added the check to give some
> info as to why the decryption might not be working (this is safe info to
> provide since it's implicit in the length of the ciphertext), but if people
> would prefer it to be removed I can certainly do that.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pyca/cryptography/pull/962/files#r11976191>
> .
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084