In this document
- Project Information
- Licensing Information
- Project History
- Documentation
- How to Report a Bug
- Source Download
- Mozilla CVS Information
- Release Information
Project Information
python-nss 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 is built upon NSPR because NSPR provides an abstraction of common operating system services, particularly in the areas of networking and process management. Python also provides an abstraction of common operating system services but because NSS and NSPR are tightly bound python-nss exposes elements of NSPR.
For information on NSS and NSPR, see the following:
- Network Security Services (NSS). NSS project page.
- Netscape Portable Runtime. NSPR project page.
- NSPR Reference. NSPR API documentation.
Design Goals
NSS and NSPR are C language API's which python-nss "wraps" and exposes to Python programs. The design of python-nss follows these basic guiding principles:
- Be a thin layer with almost a one-to-one mapping of NSS/NSPR calls to python methods and functions. Programmers already familiar with NSS/NSPR will be quite comfortable with python-nss.
- Be "Pythonic". The term Pythonic means to follow accepted Python paradigms and idoms in the Python language and libraries. Thus when deciding if the NSS/NSPR API should be rigidly followed or a more Pythonic API provided the Pythonic implementation wins because Python programmers do not want to write C programs in Python, rather they want their Python code to feel like Python code with the richness of full Python.
-
Identifer names follow the preferred Python style instead of the
style in the NSS/NSPR C header files.
- Classes are camel-case. Class names always begin with a upper case letter and are then followed by a mix of lower and upper case letters, a upper case letter is used to separate words. Acronyms always appear as a contiguous string of upper case letters.
- Method, function and property names are always lower case with words seperated by underscores.
- Constants are all upper case with words seperated by underscores, they match the NSS/NSPR C API.
- Every module, class, function, and method has associated documentation and is exposed via the standard Python methodology. This documentation is available via the numerous Python documentation extraction tools. Also see the generated HTML documentation provided with each release. The current release's documentation can be found here.
- NSS/NSPR structs are exposed as Python objects.
- NSS/NSPR functions which operate on a NSS/NSPR object (i.e. struct) become methods of that object.
- NSS/NSPR objects which are collections support the Python iteration protocol. In other words they can be iterated over, indexed by position, or used as slices.
- NSS/NSPR objects whose collection elements can be referenced by name support associative indexing.
- NSS/NSPR objects which have "get" and "set" API function calls are exposed as Python properties.
- All NSS/NSPR Python objects can print their current value by evaluting the Python object in a string context or by using the Python str() function.
- Support threading. The Python Global Interpreter Lock (GIL) is released prior to calling NSS/NSPR C functions and reaquired after the NSS/NSPR C function returns. This allows other Python threads to execute during the time a NSS/NSPR function is progress in another thread. Also, any "global" values which are set in python-nss are actually thread-local. Examples of this are the various callbacks which can be set and their parameters. Thus each thread gets it own set of callbacks.
- Many methods/functions provide sane default (keyword) parameters freeing the Python programmer from having to specify all parameters yet allowing them to be overriden when necessary.
- Error codes are never returned from methods/functions. python-nss follows the existing Python exception mechanism. Any error reported by NSS/NSPR is converted into a Python exception and raised. The exact error code, error description, and often contextual error information will be present in the exception object.
- Enumerated constants used in the NSS/NSPR API's are available in the Python module under the exact same name as they appear in the C header files of NSS/NSPR.
- Convenience functions are provided to translate between the numeric value of an enumerated constant and it's string representation and visa versa.
- python-nss internally supports UTF-8. Strings may be Python str objects or Python unicode objects. If a Python unicode object is passed to a NSS/NSPR function it will be encoded as UTF-8 first before being passed to NSS/NSPR.
- python-nss tries to be flexible when generating a print representation of complex objects. For simplicity you can receive a block of formatted text but if you need more control, such as when building GUI elments you can access a list of "lines", each line is paired with an indentation level value. The (indent, text) pairs allow you to insert the item into a GUI tree structure or simply change the indentation formatting.
- Deprecated elements of the python-nss API are marked with Python deprecation warnings as well as being documented in the nss module documentation. As of Python 2.7 deprecation warnings are no longer reported by default. It is suggested Python developers using python-nss periodically run their code with deprecation warnings enabled. Depercated elements will persist for a least two releases before being removed from the API entirely.
Project History
Red Hat utilizes both NSS and Python in many of it's projects, however it was not previously possible to call NSS directly from Python. To solve this problem Red Hat generously funded the initial development of python-nss as well as it's continued maintenance. Red Hat following it's open source philosophy has contributed the source to the Mozilla security project. Red Hat welcomes all interested contributors who would like to contribute the the python-nss project as part of an open source community. The initial release of python-nss occurred in September 2008 with it's inclusion in the Fedora distribution. The source code to python-nss was first imported into the Mozilla CVS repository on June 9th 2009. python-nss is currently available in:- Fedora
- RHEL 6
- Miloslav Trmač mitr@redhat.com
The python-nss binding is still young despite having been utilized in several major software projects. Thus it's major version number is still at zero. This is primarily so the developers can make changes to the API as experiece grows with it. For example it is already known there are some naming inconsistencies. Elments of the API are probably not ideally partitioned into proper namespaces via Python modules. Some functionality and interface have already been deprecated due to lessons learned. Thus at some point in the future when it is felt the API has solidified and been further proven in the field a 1.0 release will be made. At that point in time existing users of the python-nss API will need to some elements of their code. A migration script will be provided to assist them.
Licensing Information
python-nss is available under the Mozilla Public License, the GNU General Public License, and the GNU Lesser General Public License. For information on downloading python-nss releases as tar files, see Source Download.
Documentation
python-nss API documentation
The python-nss API documentation for the current release can be viewed at python-nss API documentation.
The API documentation is generated from the python-nss source code and
compiled modules. You can build it yourself via ./setup.py
build_doc. Most distributions include the python-nss API
documentation in the python-nss packaging. Consult your distribution
for more information.
Example Code
The doc/examples directory contains numerous examples of python-nss programs and libraries you may wish to consult. They illustrate suggested usage and best practice.
Test Code
In addition the test directory contains unit tests that also illustrate python-nss usage, however unlike the examples the unit tests are geared towards testing rather than expository illustration.
Other Documentation
The doc directory contains other files you may wish to review.
How to Report a Bug
python-nss bugs are currently being tracked in the Red Hat bugzilla system for Fedora. You can enter a bug report here.
Source Download Area
Source downloads are maintained here. Links to download URL for a specific release can be found in the Release Information section.
Mozilla CVS Information
The CVS tags for various python-nss releases can be found in the Release Information.
You may want to review the Getting Mozilla Source Code Using CVS documentation.
python-nss source code is in the mozilla/security/python/nss directories.
Release Information
Release 0.12.0
| Release Date | 2011-06-06 |
| CVS Tag | PYNSS_RELEASE_0_12_0 |
| Source Download | ftp://ftp.mozilla.org/pub/mozilla.org/security/python-nss/releases/PYNSS_RELEASE_0_12_0/src |
| Change Log |
The following classes were replaced
The following classes were added
The following class methods were added
The following class properties were added
The following module functions were added
The following constants were added
The following files were added
Deprecated Functionality
|
Release 0.11.0
| Release Date | 2011-02-21 |
| CVS Tag | PYNSS_RELEASE_0_11_0 |
| Source Download | ftp://ftp.mozilla.org/pub/mozilla.org/security/python-nss/releases/PYNSS_RELEASE_0_11_0/src |
| Change Log |
External Changes
Deprecated Functionality
Internal Changes
|
Release 0.10.0
| Release Date | 2010-07-25 |
| CVS Tag | PYNSS_RELEASE_0_10_0 |
| Source Download | ftp://ftp.mozilla.org/pub/mozilla.org/security/python-nss/releases/PYNSS_RELEASE_0_10_0/src |
| Change Log |
The following classes were added:
The following module functions were added:
The following constants were added:
The following file was added:
|
Release 0.9.0
| Release Date | 2010-05-28 |
| CVS Tag | PYNSS_RELEASE_0_9_0 |
| Source Download | |
| Change Log |
General Modifications:
The following classes were added:
The following module functions were added:
The following class methods and properties were added:Note: it's a method if the name is suffixed with (), a propety otherwise
The following module functions were removed:Note: use nss.nss.oid_tag() instead
The following files were added:
|
Release 0.8.0
| Release Date | 2009-09-21 |
| CVS Tag | PYNSS_RELEASE_0_8_0 |
| Source Download | |
| Change Log |
General Modifications:
The following were added:
|
Release 0.7.0
| Release Date | 2009-09-18 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
The following classes added:
The following methods and functions added:
The following files added:
|
Release 0.6.0
| Release Date | 2009-07-08 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
|
Release 0.5.0
| Release Date | 2009-07-01 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
|
Release 0.4.0
| Release Date | 2009-06-30 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
|
Release 0.3.0
| Release Date | 2009-06-04 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
|
Release 0.2.0
| Release Date | 2009-05-21 |
| CVS Tag | |
| Source Download | |
| Change Log |
General Modifications:
The following were added:
|
Release 0.1.0
| Release Date | 2008-07-09 |
| CVS Tag | |
| Source Download | |
| Change Log | Initial release |
