https://github.com/jigneshvasoya/pytlspsk
OpenSSL TLS-PSK wrapper for Python
https://github.com/jigneshvasoya/pytlspsk
socket ssl tls
Last synced: 5 months ago
JSON representation
OpenSSL TLS-PSK wrapper for Python
- Host: GitHub
- URL: https://github.com/jigneshvasoya/pytlspsk
- Owner: jigneshvasoya
- License: mit
- Fork: true (webgravel/common-ssl)
- Created: 2016-11-30T00:03:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-06T07:50:54.000Z (about 5 years ago)
- Last Synced: 2025-09-15T05:27:49.981Z (9 months ago)
- Topics: socket, ssl, tls
- Language: Python
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# TLSPSK Wrapper for Socket
OpenSSL TLS-PSK wrapper for Python. Plain socket can be wrapped by pytlspsk wrapper to enable TLS-PSK channel.
### Installation
`pip install pytlspsk`
### Sample Usage for Python
Use `ssl_psk.wrap_socket` with `psk` paramater set to PSK key string.
```
from pytlspsk import ssl_psk
...
...
wrapper = ssl_psk.wrap_socket(sock, psk='really secret secret', ciphers='PSK-AES256-CBC-SHA',
ssl_version=ssl.PROTOCOL_TLSv1,
server_side=True)
>> sock: plain socket
>> psk: psk key for the channel
```
### How to run test cases
#### Start server:
```
python test.py -v TLSPSKTest.testServer
```
This will keep server running until test client executes simple test case.
#### Run client:
```
python test.py -v TLSPSKTest.testClient
```
Client will send simple text to server and server will echo it back.