[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-25 Thread Antoine Pitrou
Antoine Pitrou added the comment: Your latest patch was committed, thank you! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker __

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset cdc6c1b072a5 by Antoine Pitrou in branch 'default': Issue #12803: SSLContext.load_cert_chain() now accepts a password argument http://hg.python.org/cpython/rev/cdc6c1b072a5 -- nosy: +python-dev ___ Pytho

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-24 Thread Adam Simpkins
Adam Simpkins added the comment: Here's a patch with updates to the documentation to more fully specify the behavior of the password field, including specifying that strings will be encoded using UTF-8. -- Added file: http://bugs.python.org/file23043/ssl-password.4.patch __

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-24 Thread Adam Simpkins
Adam Simpkins added the comment: OpenSSL doesn't appear to do any special handling for i18n, and just treats the strings as binary data. It uses fgets() to read the password from the terminal, so it will receive it however the terminal encodes it. It's not clear to me that PyUnicode_EncodeFSDe

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: I have one last concern: what is the character set of an OpenSSL password? I see you are using PyUnicode_AsEncodedString(x, NULL, NULL), which basically returns a utf8-encoded bytestring. Since the OpenSSL doc don't specify anything, we could accept it as a b

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-24 Thread Adam Simpkins
Adam Simpkins added the comment: Good catch. Here's an updated patch to fix the missing decref in _pwinfo_set() The length check in _password_callback() applies to both callback functions and predefined strings. The C API always uses a callback, so _password_callback() is used even when the p

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the patch. This is a generally useful functionality and the patch looks mostly good. I have a couple comments: - in _pwinfo_set(), you need to decref password_bytes when you're finished - you check the password size in _password_callback() but not i

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Adam Simpkins
Adam Simpkins added the comment: Here's a new patch that accepts any callable. The old patch only accepted actual function objects. -- Added file: http://bugs.python.org/file22975/ssl-password.2.patch ___ Python tracker

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Adam Simpkins
Adam Simpkins added the comment: > It seems a bit strange to me to accept string types or callable in the > same argument. If it just supported strings, people could still write > password=somefunction(), right? The function is only called if the private key is encrypted and a password is ne

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Éric Araujo
Éric Araujo added the comment: > I've attached a patch that adds an extra password argument, which can be > either a string, bytes, bytearray, or a function to call to get the password. It seems a bit strange to me to accept string types or callable in the same argument. If it just supported

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: -> patch review versions: +Python 3.3 -Python 3.1, Python 3.2 ___ Python tracker ___ ___ Python

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +giampaolo.rodola, janssen, pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue12803] SSLContext.load_cert_chain() should accept a password argument

2011-08-21 Thread Adam Simpkins
New submission from Adam Simpkins : The SSLContext.load_cert_chain() method should accept a password argument to use if the private key is encrypted. Currently it always uses OpenSSL's default password callback, which prompts the user interactively for a password. I've attached a patch that a