Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating a Context with SSLv2_METHOD #40

Merged
merged 1 commit into from Mar 1, 2014

Conversation

andrew-d
Copy link
Contributor

Hi there,

It appears that it's not possible to create a new Context with SSLv2_METHOD. I realize this is horribly insecure, but I'm attempting to use pyOpenSSL to scan for insecure HTTPS settings, and this error occurs. Here's the message:

$ python
Python 2.7.6 (default, Feb 19 2014, 19:58:32)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenSSL import SSL
>>> ctx = SSL.Context(SSL.SSLv2_METHOD)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/andrew/.virtualenvs/ssl/lib/python2.7/site-packages/OpenSSL/SSL.py",
 line 261, in __init__
    raise ValueError("No such protocol")
ValueError: No such protocol
>>>

I've attached a patch that fixes this.

Thanks! 馃槃

@exarkun
Copy link
Member

exarkun commented Feb 25, 2014

Thanks. Can you add a unit test as well? I see the documentation doesn't need updating because it already claims SSLv2_METHOD is supported.

@exarkun
Copy link
Member

exarkun commented Feb 25, 2014

Hm. Or maybe you can't. There is already a unit test that tries to create a Context with SSLv2_METHOD. Apparently it's hard to distinguish between the bug being fixed here and the case where OpenSSL doesn't support SSLv2...

@andrew-d
Copy link
Contributor Author

Yes, I looked at the test to see if I could add it, but the only thing I could think of was to refactor the way pyOpenSSL handles unknown methods vs. OpenSSL not supporting them - creating a new exception, for example. That seemed like overkill to me...

exarkun added a commit that referenced this pull request Mar 1, 2014
Allow creating a Context with SSLv2_METHOD, a feature which was accidentally dropped in the Python port.
@exarkun exarkun merged commit 24bf119 into pyca:master Mar 1, 2014
@exarkun
Copy link
Member

exarkun commented Mar 1, 2014

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants