File python-nassl.spec of Package python-nassl

# spec file for package python-nassl
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           python-nassl
Version:        0.14.2
Release:        0
License:        GPL-2.0
Summary:        Experimental OpenSSL wrapper for Python 2.7 and SSLyze
Group:          Development/Languages/Python
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}


[![Build Status](](
[![PyPI version](](

Experimental OpenSSL wrapper for Python 2.7 and SSLyze. **Do NOT use for anything serious**. This code has not been 
properly tested/reviewed and is absolutely not production ready.

Quick Start

Nassl can be installed directly via pip:
    pip install nassl

On OS X and Linux, it is also easy to directly clone the repository, build the `_nassl` C extension and then run the
sample client:

    git clone
    cd nassl
    python build_ext -i

Building the C extension

Nassl relies on a C extension to call into OpenSSL; the extension can be directly built using the pre-compiled OpenSSL
binaries available in ./bin, by running the following command:

    python build_ext -i

On Windows, a "Platform Wheel" can be built using:

    python bdist_wheel
If you do not want to use the pre-compiled binaries, compiling the C extension requires successively building:
* [Zlib 1.2.8](
* A [special fork of OpenSSL 1.0.2]( (or the official OpenSSL 1.0.2e)
* The `_nassl` C extension itself

The whole build process is all taken care of by the _build\_from\_scratch.py_ script: 

    git clone
    cd nassl
    tar xvfz  zlib-1.2.8.tar.gz
    git clone
For Windows builds, Visual Studio is expected to be installed at the default location. 

The build script was tested on the following platforms: Windows 7 (32 and 64 bits), Debian 7 (32 and 64 bits),
macOS Sierra. It will build the C extension for the interpreter and platform that was used to run the script
(ie. no cross-compiling).

Project structure

### nassl/

Classes implemented in Python are part of the `nassl` namespace; they are designed to provide a simpler, higher-level 
interface to perform SSL connections.

### nassl/_nassl/

Classes implemented in C are part of the `nassl._nassl` namespace; they try to stay as close as possible to OpenSSL's 
API. In most cases, Python methods of such objects directly match the OpenSSL function with same name. For example the 
`` Python method matches OpenSSL's `SSL_read()` function. 

These classes should be considered internal.

Why another SSL library?

I'm the author of [SSLyze](, an SSL scanner written in Python. Scanning SSL servers 
requires access to low-level SSL functions within the OpenSSL API, for example to test for things like insecure 
renegotiation or session resumption.

None of the existing OpenSSL wrappers for Python (including ssl, M2Crypto and pyOpenSSL) expose the APIs that I need for 
SSLyze, so I had to write my own wrapper.


Licensed under the GPLv2; see ./LICENSE

Please contact me if this license doesn't work for you.


Alban Diquet - @nabla_c0d3 -

%setup -q -n nassl-%{version}

CFLAGS="%{optflags}" python build

python install --prefix=%{_prefix} --root=%{buildroot}

%doc LICENSE.txt