In my view, "incorrect passphrase for key" vs "corrupt key or unsupported
key format" is always a okay distinction to make.

From what I see, the distinction between error types doesn't matter too
much here.

Can you list a message you want to surpress?   Are there two messages such
that you'd want to hide the difference between them?


On Tue, Oct 1, 2013 at 8:49 AM, Vladimir Diaz <notifications@github.com>wrote:

> In tuf/repo/keystore.py:
>
> > @@ -583,7 +609,11 @@ def _encrypt(key_data, derived_key_information):
> >    # repetitions are performed by AES, 14 cycles for 256-bit keys.
> >    try:
> >      ciphertext = aes_cipher.encrypt(key_data)
> > -  except:
> > +
> > +  # Raise generic exception message to avoid revealing sensitive information,
> > +  # such as invalid passwords, encryption keys, etc., that an attacker can use
> > +  # to his advantage.
> > +  except Exception, e:
>
> Anyone who queries signatures, imports/exports keys, or who gains access
> to any of the encrypted keys (or indirectly?). I have avoided propagating
> errors messages from crypto libraries, so it is in the cases where crypto
> operations are executed.
>
> PyCrypto example:
>
> https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/RSA.py#L658-L660
>
> I wouldn't intentionally print private keys, although the crypto library
> might if it encounters an unexpected exception.
>
> Not sure if Zane is asking if the error string is too generic or
> requesting that we propagate exceptions from crypto libraries.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/theupdateframework/tuf/pull/124/files#r6685049>
> .
>