Skip to main content

python-nss-ng

Platform Compatibility CI/CD Pipeline Python 3.10+ License: MPL-2.0

Python bindings for Network Security Services (NSS) and Netscape Portable Runtime (NSPR).

Supported Platforms

python-nss-ng officially supports:

  • Linux (all major distributions)
  • macOS

Windows is NOT supported. Attempting to import python-nss-ng on Windows will raise a RuntimeError.

Overview

python-nss-ng is a Python binding for NSS (Network Security Services) and NSPR (Netscape Portable Runtime). NSS provides cryptography services supporting SSL, TLS, PKI, PKIX, X509, PKCS*, etc. NSS is an alternative to OpenSSL and used extensively by major software projects. NSS is FIPS-140 certified.

NSS uses NSPR because NSPR provides an abstraction of common operating system services, in the areas of networking and process management. Python also provides an abstraction of common operating system services but because NSS and NSPR have tight coupling, python-nss-ng exposes elements of NSPR.

Project Modernization (2025)

This project received modernization work to support current Python versions and build standards:

Changes Made

  • Python Support: Now supports Python 3.10, 3.11, 3.12, 3.13, and 3.14
  • Build System: Migrated from legacy distutils to modern setuptools with pyproject.toml
  • Version Management: Implemented dynamic versioning using setuptools-scm
  • Package Structure: Follows current PEP standards (PEP 517, PEP 518, PEP 621)
  • Development Tools: Added support for uv, modern testing with pytest, and code quality with ruff

NSS/NSPR Compatibility

✅ C Extension Compatibility: The C code now compiles with NSS 3.100+ and works with NSS 3.117.

Recent Fixes:

  • Resolved typedef conflicts (RSAPublicKey → PyRSAPublicKey, etc.)
  • Fixed SPDX comment block formatting issues
  • All 32 tests pass with NSS 3.117 and NSPR 4.38

Tested Versions:

  • NSS 3.117
  • NSPR 4.38.2
  • Python 3.10, 3.11, 3.12, 3.13, 3.14

System Requirements

Required Libraries

Before building python-nss-ng, you need the C language header files and libraries for both NSPR and NSS installed. This is system and distribution specific.

Fedora/RHEL/CentOS

sudo dnf install nss-devel nspr-devel

Debian/Ubuntu

sudo apt-get install libnss3-dev libnspr4-dev

macOS (Homebrew)

brew install nss nspr

Installation

# Create a virtual environment with Python 3.10+
uv venv --python 3.10

# Activate the environment
source .venv/bin/activate  # Linux/macOS
# or
.venv\Scripts\activate  # Windows

# Install in development mode
uv pip install -e ".[dev]"

Using pip

# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install in development mode
pip install -e ".[dev]"

Custom Include/Library Paths

If NSS/NSPR live in non-standard locations, set the NSS_INCLUDE_ROOTS environment variable:

export NSS_INCLUDE_ROOTS="/custom/path/include:/another/path/include"
pip install -e .

Development

Test Dependencies

The test suite requires NSS command-line tools for certificate generation:

NSS Tools: Fedora/RHEL/CentOS

sudo dnf install nss-tools

NSS Tools: Debian/Ubuntu

sudo apt-get install libnss3-tools

NSS Tools: macOS (Homebrew)

The nss package includes NSS tools:

brew install nss

Running Tests

Quick Start (Automated)

Use the comprehensive test runner script that handles all setup:

# Run all tests (handles setup, builds C extension, creates certificates)
./scripts/run-all-tests.sh

# Quick mode: pure Python tests only (no C extension build needed)
./scripts/run-all-tests.sh --quick

# Other options
./scripts/run-all-tests.sh --help

The script automatically:

  • Checks for dependencies (uv, NSS, NSPR)
  • Creates virtual environment
  • Installs test dependencies
  • Builds C extension (if needed)
  • Sets up test certificates
  • Runs tests

Manual Testing

# Install with test dependencies
uv pip install -e ".[test]"

# Run tests (recommended for reliability)
pytest test/ -n0

# Or run with parallel execution (may have occasional intermittent failures)
pytest test/

Note: Some tests have known intermittent failures with parallel execution. Tests automatically generate certificates in a pki/ directory within the test folder using certutil from nss-tools. For fully reliable results, use -n0 to disable parallel execution. See TESTING.md for details about test reliability and certificate generation.

Building

# Build source distribution and wheel
uv pip install build
python -m build

Build Performance ⚡

Builds are now 40-80% faster thanks to automatic optimizations:

  • Probe Caching: Library locations cached (27% faster)
  • Parallel Compilation: Uses all CPU cores (40% faster)
  • ccache in CI: Compilation results cached (78% faster CI)

All optimizations work automatically! For even faster local builds:

# Optional: Install ccache for 87% faster rebuilds
brew install ccache  # macOS
export CC="ccache clang"

See BUILD_OPTIMIZATION_QUICKSTART.md for details.

Code Quality

Check code style and format code:

ruff check .
ruff format .

Project Structure

python-nss-ng/
├── src/                    # C extension source files and Python package
│   ├── __init__.py        # Main package initialization
│   ├── py_nss.c           # NSS bindings
│   ├── py_ssl.c           # SSL/TLS bindings
│   ├── py_nspr_io.c       # NSPR I/O bindings
│   └── py_nspr_error.c    # NSPR error handling
├── test/                  # Test suite
├── doc/                   # Documentation
├── pyproject.toml        # Modern Python project configuration
├── meson.build           # Meson build configuration
└── MANIFEST.in           # Source distribution file inclusion rules

Documentation

More information on python-nss-ng is available on the python-nss-ng project page.

For information on NSS and NSPR, see the following:

License

This project is triple-licensed under:

  • Mozilla Public License 2.0 (MPL-2.0)
  • GNU General Public License v2 or later (GPLv2+)
  • GNU Lesser General Public License v2 or later (LGPLv2+)

See LICENSE.mpl, LICENSE.gpl, and LICENSE.lgpl files for details.

Contributing

This is a modernization effort for an existing project. Contributions to fix the NSS compatibility issues and modernize the C code are welcome!

Priority Issues

  1. Fix C code compatibility with NSS 3.100+
  2. Update API usage for modern NSS/NSPR
  3. Add comprehensive test coverage
  4. Improve documentation
  5. Add type hints to Python code

Authors and Maintainers

  • Original Author: John Dennis jdennis@redhat.com
  • Current Maintainer: Project seeking active maintainer

Support

Release files for python-nss-ng 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-nss-ng 1.3.1
File Size Uploaded
python_nss_ng-1.3.1.tar.gz 484.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-nss-ng 1.3.1
File
python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ x86-64 Details
python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ ARM64 Details
python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ x86-64 Details
python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ ARM64 Details
python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ x86-64 Details
python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ ARM64 Details
python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.38+ x86-64 Details
python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.38+ ARM64 Details
python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.38+ x86-64 Details
python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.38+ ARM64 Details

Total release size: 17.1 MB

Release files / python_nss_ng-1.3.1.tar.gz

Download URL python_nss_ng-1.3.1.tar.gz
Size 484.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2b5e7a313bd7c7151164355baef8ead22ac7003b687b3850688bc0887ba3464c
BLAKE2b-256 checksum
How to use checksums
be1bcf2edbb778be62543d0b05d9f687112cd81701e9410b7e8cb0a275024784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
c62ad2726b07c2ecb6abe2b8e7fa6a1f31465e56d11340dee8d5ca6c67f94c6f
BLAKE2b-256 checksum
How to use checksums
34fbef393dbaf8f53f7c3561192265eef06d467042d709a2c932f9ee1c94584f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.3.1-cp314-cp314-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.14 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
51c3084a370765a409c6a75fb2098a8480e3b3e20b63cbdf6753679364fb951e
BLAKE2b-256 checksum
How to use checksums
4bbc607fe2694f1e007a29789c64de27629133f9743235eac142bccb904d534a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.13 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
89ff4f8f8b65cb7e769a3e1b33f430ff81c1a3d244a54dfb34c25370c0434090
BLAKE2b-256 checksum
How to use checksums
4ec5f93605a221710b5b912b4716d0d40a471349adcba5967527c6cb03d91ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.3.1-cp313-cp313-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.13 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
d5e68c74a16d4a5119b1c04f3e2ab67cc769a6ab836a29a610737243c61b1230
BLAKE2b-256 checksum
How to use checksums
3451f45c668bafbc88baaa78ed3198547f46f5715cb5ebde380e354e222debb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.12 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
f11a9f4891842328581d6673d54404196aede36d687e47ecb33296b09019272a
BLAKE2b-256 checksum
How to use checksums
1a2dd417e3b34b43b27a1e5ce985d190b501e456c2bb655c922ca078c5e4bf68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.3.1-cp312-cp312-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.12 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
415d88b8a27f8cc970152d6d1faea7de5685f320a8459146d547c1aeef26e572
BLAKE2b-256 checksum
How to use checksums
86341b230999a4051db36722eca622f3474066ff43f8c85a95c1f226326ec35a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
7567197705476c314641fbb4492834dddec667089a606c5a5f104bf4e0ef0e32
BLAKE2b-256 checksum
How to use checksums
89e9c6bf311628690f3f23883aaf2a0713817e3d2d3023dd754644cbb94ec936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.3.1-cp311-cp311-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
b8a12666671158de9350b2861de933af1e7ddfcd7d45de7d756881fda4698958
BLAKE2b-256 checksum
How to use checksums
4ab88a841ba9d4db74ad8e108ed4d51019038ae1ddb4ecc43a617ff9e396a9ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
a47a1e326edb8c53cb70de7a82a72544d6a9439b17b23be5a362f19d8356a43d
BLAKE2b-256 checksum
How to use checksums
0181b4e6077982624cab55d6db2016df324b8ae4caf1b25e2e3d0b8f87307754
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.3.1-cp310-cp310-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
ead5cdaf353675a73229516f1a42b1c86ba6c7d7d2a23844bdd0703b1c421e21
BLAKE2b-256 checksum
How to use checksums
3702bd912ec22749fb33b68fa194354412f1e77415458b04130d6ebacb771fac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.1 This release

11 release files

1.3.0

11 release files

1.2.2

11 release files

1.2.1

11 release files

1.2.0

11 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page