On Sunday, 19 March 2017 03:16:17 UTC, Arthur Darcet  wrote:
> On Sat, 18 Mar 2017 at 23:29, Ian Pilcher <arequip...@gmail.com> wrote:
> 
> > On 03/18/2017 05:15 PM, Chris Angelico wrote:
> > > So the question is: How well do you trust the examples? Are they
> > > likely to be instructing you in a safe way to use this
> > > potentially-dangerous module?
> >
> > But as far as I can tell, there's no way to use many of the non-hazmat
> > functions (e.g. parsing a certificate) without a backend, and all of the
> > backends are "hazmat".
> >
> > So what's the point of marking something as hazmat, if a large portion
> > of the rest of the module can't be used without it?
> >
> 
> If I'm not mistaken, the hazmat module contains functions that are easy to
> misuse, which is why they are hazardous.
> Using those same functions through the "safe" part of the library isn't
> dangerous

I do tend to agree with the OP. As someone who *definitely* doesn't claim to be 
a security expert, I'd prefer to stick solely to the "for non-expert users 
only" part of the module. As far as I can see, that part includes only:

1. Fernet symmetric encryption, which is fine, but needs me to manage the key 
safely (and offers no help in doing that)
2. X509, whose docs are a reference (that you need to understand X509 to 
follow) and a couple of tutorials on generating/requesting keys. Nothing on 
using X509 for encryption.

Some of the "obvious" things I'd like to be able to do (e.g., create a message 
digest, public key cryptography, hashing passwords for storage) are all in the 
"hazmat" part of the documentation.

So I'm left with the choice of using cryptography and explicitly using parts 
documented as not suitable for me, or using something else that claims to be 
robust (but which may not be, depending on whether I trust the author, or 
prefer to trust the PyCA, who seem to be implying that the subject is too 
complex for them to be able to provide a non-expert-friendly version, so how 
come other authors can?)

FWIW, for the 3 examples I gave above, quick Google searches found:

* message digest - the stdlib hashlib module
* public key - pycrypto
* password hashes - passlib

I have no idea whether these are "acceptable" solutions, but I'd tend to use 
them in preference to the cryptography library, simply because they don't claim 
that the functions needed are "dangerous to use".

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to