DI Management Home > SC14N > Python

Python Interface to SC14N


A Python interface to SC14N for Windows.

Download and installation | Examples | Documentation | Contact

Download and installation

Automatic install from PyPi (recommended)

pip install sc14npy

Manual install

  1. Download the distribution file sc14npy-x.x.x.zip from the Python Package Index (PyPi).
  2. Open a command line console in the same directory as the zip file, then type
    pip install sc14npy-x.x.x.zip
    
    where "x.x.x" is the current version number.

Verify installation

Use Gen.version() to test the installation is correct.

>>> from sc14n import *
>>> Gen.version()
900

Examples

>>> # Example 1. Excludes the first element with the tag name <Signature>
>>> r = C14n.file2file("c14nfile1.txt", "input.xml", "Signature", Tran.EXCLUDEBYTAG)
True
>>> # Example 2. Finds and transforms the first element with the tag name <SignedInfo>
>>> r = C14n.file2file("c14nfile2.txt", "input.xml", "SignedInfo", Tran.SUBSETBYTAG)
True
>>> # Example 3. Finds and transforms the third element with the tag name <Data>
>>> r = C14n.file2file("c14nfile3.txt", "input.xml", "Data[3]", Tran.SUBSETBYTAG)
True
>>> # Example 4. Finds and transforms the element with attribute Id="foo"
>>> r = C14n.file2file("c14nfile4.txt", "input.xml", "foo", Tran.SUBSETBYID)
True
>>> # Example 5. Finds and transforms the element with attribute ID="bar"
>>> r = C14n.file2file("c14nfile5.txt", "input.xml", "ID=bar", Tran.SUBSETBYID)
True
>>> # Example 6. Excludes element with attribute Id="thesig"
>>> r = C14n.file2file("c14nfile6.txt", "input.xml", "thesig", Tran.EXCLUDEBYID)
True

Example Python program using SC14N

Some tests for sc14n.py the Python interface to SC14N.

Example Python program using SC14N and CryptoSys PKI

Some tests for sc14n.py the Python interface to SC14N using CryptoSys PKI..

The above two programs and the test files are in the distribution file sc14npy-x.x.x.zip available at the Python Package Index (PyPi).

Documentation

Read the Sc14n Py documentation and the README document.

Contact

To comment on this page, make a suggestion for improvement, or just to say you liked it, please send us a message.

This page first published 12 July 2017. Last updated 15 August 2017.