Skip to main content

python-nss-ng

Platform Compatibility CI/CD Pipeline Python 3.11+ 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.11, 3.12, 3.13, 3.14, and 3.15
  • 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.11, 3.12, 3.13, 3.14, 3.15

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.11+
uv venv --python 3.11

# 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

Metadata

Release files for python-nss-ng 1.4.0

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.4.0
File Size Uploaded Provenance Actions
python_nss_ng-1.4.0.tar.gz 488.7 kB With provenance Details for python_nss_ng-1.4.0.tar.gz

Built distributions (wheels)

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

Total release size: 17.4 MB

Release files / python_nss_ng-1.4.0.tar.gz

Download URL python_nss_ng-1.4.0.tar.gz
Size 488.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ce525aefd1edfc5305c46e2a8071e4d32b0d3c7c8405d92d0316647772790803
BLAKE2b-256 checksum
How to use checksums
878fca2ab8f32b67c0a5a9209487ed77f213b1cbd1f4c7a91370a90667b6aedd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

Release files / python_nss_ng-1.4.0-cp315-cp315-manylinux_2_38_x86_64.whl

Download URL python_nss_ng-1.4.0-cp315-cp315-manylinux_2_38_x86_64.whl
Size 1.7 MB
Tags CPython 3.15 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
19ed76105479ea4b5ae13d6b589485b9febf8ea4473f04b353c5d3e517490d37
BLAKE2b-256 checksum
How to use checksums
82f74f30dff7de4573e8d20eb0aa2112ce0a03331dc2b80d5012a036f7fda251
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

Release files / python_nss_ng-1.4.0-cp315-cp315-manylinux_2_38_aarch64.whl

Download URL python_nss_ng-1.4.0-cp315-cp315-manylinux_2_38_aarch64.whl
Size 1.7 MB
Tags CPython 3.15 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
a42db6c3cc65b71b8eaa7e677e77361de4fa27c580f0c971c53109a71c7c8583
BLAKE2b-256 checksum
How to use checksums
accdc177281f1607d381fafe477954513a2e2dd64c9082bf6053175c1706cc3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
281661490cea69525fa830628bdc0ab5403f0fddc7f23734fda15f37b30aac0e
BLAKE2b-256 checksum
How to use checksums
fda60929ad860ad5d9904d9fe206c9b1022cd2edb9b4fdb35e7b200f42e2f55f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
d98bff5b216416e3381dad23df1d11f2f03b635340e389d4d094165cff721542
BLAKE2b-256 checksum
How to use checksums
0524c2d77edb5e2601b88dac096705adeab81bd6baee0cfc786d664d70666d65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
358e94bef858f1d2489d892dfad4cc6869ffac17a55326bcdb9dd6ab6807d2d7
BLAKE2b-256 checksum
How to use checksums
179d2692f8ab57a4636fd5279b30f372804f8214b01e34cec5aa70ff82c1422b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
f19bc861acda2089ad970d5df0af91f3430d01cb556bc89775449193d026eb1f
BLAKE2b-256 checksum
How to use checksums
5128c405a028933b3bb76094bd46b112a8bf029af6afee2f3e4cd6d6ceda363e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
939402b919be380086ac28929eb2a56b7c4f5325d54ae28ef4e5db556ca5dcd9
BLAKE2b-256 checksum
How to use checksums
59fe4e3a1b3e9a346d3dec03a576e26fa2774b68e4e91b5dbaf3b7ff7fd9bfdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
334698c7fce8497c03c811d90552c14308ad2072c451eac4ae205642c1f8bd2f
BLAKE2b-256 checksum
How to use checksums
86398025da27fbe70e4582123eb98a4da8d69bd22db1d1c97480a509b4a2f564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
9be2b7e3af5bda11196ce40a0e481bec062847ecbc61bfcdde055f00ccf6024f
BLAKE2b-256 checksum
How to use checksums
2e0d7e01dbc058efc316c267a604d819118240db92d1f90b1b96eb9e1fc734ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

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

Download URL python_nss_ng-1.4.0-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
d4a87a41a4228df244457110941f00687d96e5345effdf4864995eb5a4cf8606
BLAKE2b-256 checksum
How to use checksums
199c5e0d1eef4190d0c6c48eb48972385f79bdb7e7ce9c40e1aaf768b16eef24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

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 Dec 4, 2026.

Transparency log

Security for python-nss-ng 1.4.0

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.

Full provenance

All 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for python_nss_ng-1.4.0.tar.gz

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 Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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