2 ms·
Look at this code from urllib3 (requests bundles this code): https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py https://github.com/shazo
by wolf550e 10y ago
Look at this code from urllib3 (requests bundles this code):
https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py https://github.com/shazow/urllib3/blob/master/urllib3/contri...
If you install the dependencies, requests uses the package cryptography to use openssl to validate certificates, by running that code.
Note that openssl does not validate certificates the way Mozilla Firefox does, even if they use the exact same root CA bundle, because some of the validation logic is code in NSS instead of data (e.g. certificate transparency requirements). Ryan Sleevi wrote on tweeter that Red Hat are working on doing something to let applications using openssl use Firefox's full cert validation logic.
- wbond 10y ago(Just to note, this wasn't me looking for help in how to accomplish that task.) That said, does the proverbial "you" know all of the chain validation features that are NOT implemented by OpenSSL when using code such as in urllib3? What if you actually care more about revocation than utmost in connection performance? How does one trust a custom CA root? What if you want to verify a cert chain for something other than a TLS connection? My main point is: here we are with people needing crypto, and (it seems) no one has taken it upon themselves to write good crypto libraries for (some of) the types of tasks that are fairly common. The obvious exception being NaCl. However, that has issues with pragmatic things like distribution due to CPU optimizations, hence libsodium.
- daenney 10y ago> Look at this code from urllib3 (requests bundles this code): https://github.com/shazow/urllib3/blob/master/urllib3/contri.. https://github.com/shazow/urllib3/blob/master/urllib3/contri.... This only underscores/validates wbond's critique though. Apparently the advise on how to figure this stuff out isn't even through "RTFM", docs or an easy to use library, it's "go look at the dependency of this other library which uses that other dependency that you want to use on how it is done". And then copy-paste that and hopefully not get anything wrong along the way.