././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1762874576.341085 xmlsec-1.3.17/0000755000076500000240000000000015104652320011743 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762872928.0 xmlsec-1.3.17/.pre-commit-config.yaml0000644000076500000240000000206415104647140016232 0ustar00aminstaff# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.14.4 hooks: - id: ruff args: ["--fix"] types: [python] - id: ruff-format types: [python] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: no-commit-to-branch - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - id: check-ast - id: check-merge-conflict - id: check-json - id: detect-private-key exclude: ^.*/rsakey.pem$ - id: mixed-line-ending - id: pretty-format-json args: [--autofix] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.18.2 hooks: - id: mypy exclude: (setup.py|tests|build_support/.*.py|doc/.*) types: [] files: ^.*.pyi?$ additional_dependencies: [lxml-stubs, types-docutils] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: - id: rst-backticks ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/.readthedocs.yaml0000644000076500000240000000032214441560770015201 0ustar00aminstaffversion: 2 build: os: ubuntu-20.04 tools: python: '3.9' sphinx: configuration: doc/source/conf.py python: install: - method: pip path: . - requirements: doc/source/requirements.txt ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/LICENSE0000644000076500000240000000206614441560770012766 0ustar00aminstaffThe MIT License (MIT) Copyright (c) 2014 Ryan Leckey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/MANIFEST.in0000644000076500000240000000046314441560770013516 0ustar00aminstaffrecursive-include src * recursive-include tests * prune */__pycache__ prune .github prune doc exclude .appveyor.yml exclude .editorconfig exclude .travis.yml exclude .gitattributes exclude .gitignore exclude requirements-test.txt exclude requirements.txt exclude xmlsec_extra.py exclude xmlsec_setupinfo.py ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3409913 xmlsec-1.3.17/PKG-INFO0000644000076500000240000001516615104652320013051 0ustar00aminstaffMetadata-Version: 2.4 Name: xmlsec Version: 1.3.17 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin Author-email: support@mehcode.com Maintainer: Oleg Hoefling Maintainer-email: oleg.hoefling@gmail.com License: MIT Project-URL: Documentation, https://xmlsec.readthedocs.io Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: C Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Typing :: Typed Requires-Python: >=3.9 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: lxml>=3.8 Dynamic: author Dynamic: author-email Dynamic: classifier Dynamic: description Dynamic: description-content-type Dynamic: home-page Dynamic: keywords Dynamic: license Dynamic: license-file Dynamic: maintainer Dynamic: maintainer-email Dynamic: project-url Dynamic: requires-dist Dynamic: requires-python Dynamic: summary # python-xmlsec [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg)](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml) [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec) [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest) Python bindings for the [XML Security Library](https://www.aleksey.com/xmlsec/). ## Documentation Documentation for `xmlsec` can be found at [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/). ## Usage Check the [examples](https://xmlsec.readthedocs.io/en/latest/examples.html) section in the documentation to see various examples of signing and verifying using the library. ## Requirements - `libxml2 >= 2.9.1` - `libxmlsec1 >= 1.2.33` ## Install `xmlsec` is available on PyPI: ``` bash pip install xmlsec ``` Depending on your OS, you may need to install the required native libraries first: ### Linux (Debian) ``` bash apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl ``` Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually. ``` bash wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz tar -xvf libxml2-2.9.1.tar.gz cd libxml2-2.9.1 ./configure && make && make install ``` ### Linux (CentOS) ``` bash yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Linux (Fedora) ``` bash dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Mac ``` bash brew install libxml2 libxmlsec1 pkg-config ``` or ``` bash port install libxml2 xmlsec pkgconfig ``` ### Alpine ``` bash apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec ``` ## Troubleshooting ### Mac If you get any fatal errors about missing `.h` files, update your `C_INCLUDE_PATH` environment variable to include the appropriate files from the `libxml2` and `libxmlsec1` libraries. ### Windows Starting with 1.3.7, prebuilt wheels are available for Windows, so running `pip install xmlsec` should suffice. If you want to build from source: 1. Configure build environment, see [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for more details. 2. Install from source dist: ``` bash pip install xmlsec --no-binary=xmlsec ``` ## Building from source 1. Clone the `xmlsec` source code repository to your local computer. ``` bash git clone https://github.com/xmlsec/python-xmlsec.git ``` 2. Change into the `python-xmlsec` root directory. ``` bash cd /path/to/xmlsec ``` 3. Install the project and all its dependencies using `pip`. ``` bash pip install . ``` ## Contributing ### Setting up your environment 1. Follow steps 1 and 2 of the [manual installation instructions](#building-from-source). 2. Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identical versions of packages. ``` bash mkvirtualenv xmlsec ``` The `mkvirtualenv` command is available from `virtualenvwrapper` package which can be installed by following [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation). 3. Activate the created virtual environment: ``` bash workon xmlsec ``` 4. Install `xmlsec` in development mode with testing enabled. This will download all dependencies required for running the unit tests. ``` bash pip install -r requirements-test.txt pip install -e "." ``` ### Running the test suite 1. [Set up your environment](#setting-up-your-environment). 2. Run the unit tests. ``` bash pytest tests ``` 3. Tests configuration Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test iterations to detect memory leaks. ### Reporting an issue Please attach the output of following information: - version of `xmlsec` - version of `libxmlsec1` - version of `libxml2` - output from the command ``` bash pkg-config --cflags xmlsec1 ``` ## License Unless otherwise noted, all files contained within this project are licensed under the MIT open source license. See the included `LICENSE` file or visit [opensource.org](http://opensource.org/licenses/MIT) for more information. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1756729748.0 xmlsec-1.3.17/README.md0000644000076500000240000001176515055310624013237 0ustar00aminstaff# python-xmlsec [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg)](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml) [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec) [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest) Python bindings for the [XML Security Library](https://www.aleksey.com/xmlsec/). ## Documentation Documentation for `xmlsec` can be found at [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/). ## Usage Check the [examples](https://xmlsec.readthedocs.io/en/latest/examples.html) section in the documentation to see various examples of signing and verifying using the library. ## Requirements - `libxml2 >= 2.9.1` - `libxmlsec1 >= 1.2.33` ## Install `xmlsec` is available on PyPI: ``` bash pip install xmlsec ``` Depending on your OS, you may need to install the required native libraries first: ### Linux (Debian) ``` bash apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl ``` Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually. ``` bash wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz tar -xvf libxml2-2.9.1.tar.gz cd libxml2-2.9.1 ./configure && make && make install ``` ### Linux (CentOS) ``` bash yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Linux (Fedora) ``` bash dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Mac ``` bash brew install libxml2 libxmlsec1 pkg-config ``` or ``` bash port install libxml2 xmlsec pkgconfig ``` ### Alpine ``` bash apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec ``` ## Troubleshooting ### Mac If you get any fatal errors about missing `.h` files, update your `C_INCLUDE_PATH` environment variable to include the appropriate files from the `libxml2` and `libxmlsec1` libraries. ### Windows Starting with 1.3.7, prebuilt wheels are available for Windows, so running `pip install xmlsec` should suffice. If you want to build from source: 1. Configure build environment, see [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for more details. 2. Install from source dist: ``` bash pip install xmlsec --no-binary=xmlsec ``` ## Building from source 1. Clone the `xmlsec` source code repository to your local computer. ``` bash git clone https://github.com/xmlsec/python-xmlsec.git ``` 2. Change into the `python-xmlsec` root directory. ``` bash cd /path/to/xmlsec ``` 3. Install the project and all its dependencies using `pip`. ``` bash pip install . ``` ## Contributing ### Setting up your environment 1. Follow steps 1 and 2 of the [manual installation instructions](#building-from-source). 2. Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identical versions of packages. ``` bash mkvirtualenv xmlsec ``` The `mkvirtualenv` command is available from `virtualenvwrapper` package which can be installed by following [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation). 3. Activate the created virtual environment: ``` bash workon xmlsec ``` 4. Install `xmlsec` in development mode with testing enabled. This will download all dependencies required for running the unit tests. ``` bash pip install -r requirements-test.txt pip install -e "." ``` ### Running the test suite 1. [Set up your environment](#setting-up-your-environment). 2. Run the unit tests. ``` bash pytest tests ``` 3. Tests configuration Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test iterations to detect memory leaks. ### Reporting an issue Please attach the output of following information: - version of `xmlsec` - version of `libxmlsec1` - version of `libxml2` - output from the command ``` bash pkg-config --cflags xmlsec1 ``` ## License Unless otherwise noted, all files contained within this project are licensed under the MIT open source license. See the included `LICENSE` file or visit [opensource.org](http://opensource.org/licenses/MIT) for more information. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3165205 xmlsec-1.3.17/build_support/0000755000076500000240000000000015104652320014636 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1760686353.0 xmlsec-1.3.17/build_support/__init__.py0000644000076500000240000000000015074370421016742 0ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1760686353.0 xmlsec-1.3.17/build_support/build_ext.py0000644000076500000240000000600715074370421017177 0ustar00aminstaffimport os import sys from distutils import log from distutils.errors import DistutilsError from setuptools.command.build_ext import build_ext as build_ext_orig from .static_build import CrossCompileInfo, StaticBuildHelper class build_ext(build_ext_orig): def info(self, message): self.announce(message, level=log.INFO) def run(self): ext = self.ext_map['xmlsec'] self.debug = os.environ.get('PYXMLSEC_ENABLE_DEBUG', False) self.static = os.environ.get('PYXMLSEC_STATIC_DEPS', False) self.size_opt = os.environ.get('PYXMLSEC_OPTIMIZE_SIZE', True) if self.static or sys.platform == 'win32': helper = StaticBuildHelper(self) helper.prepare(sys.platform) else: import pkgconfig try: config = pkgconfig.parse('xmlsec1') except OSError as error: raise DistutilsError('Unable to invoke pkg-config.') from error except pkgconfig.PackageNotFoundError as error: raise DistutilsError('xmlsec1 is not installed or not in path.') from error if config is None or not config.get('libraries'): raise DistutilsError('Bad or incomplete result returned from pkg-config.') ext.define_macros.extend(config['define_macros']) ext.include_dirs.extend(config['include_dirs']) ext.library_dirs.extend(config['library_dirs']) ext.libraries.extend(config['libraries']) import lxml ext.include_dirs.extend(lxml.get_include()) ext.define_macros.extend( [('MODULE_NAME', self.distribution.metadata.name), ('MODULE_VERSION', self.distribution.metadata.version)] ) for key, value in ext.define_macros: if key == 'XMLSEC_CRYPTO' and not (value.startswith('"') and value.endswith('"')): ext.define_macros.remove((key, value)) ext.define_macros.append((key, f'"{value}"')) break if sys.platform == 'win32': ext.extra_compile_args.append('/Zi') else: ext.extra_compile_args.extend( [ '-g', '-std=c99', '-fPIC', '-fno-strict-aliasing', '-Wno-error=declaration-after-statement', '-Werror=implicit-function-declaration', ] ) if self.debug: ext.define_macros.append(('PYXMLSEC_ENABLE_DEBUG', '1')) if sys.platform == 'win32': ext.extra_compile_args.append('/Od') else: ext.extra_compile_args.append('-Wall') ext.extra_compile_args.append('-O0') else: if self.size_opt: if sys.platform == 'win32': ext.extra_compile_args.append('/Os') else: ext.extra_compile_args.append('-Os') super().run() __all__ = ('CrossCompileInfo', 'build_ext') ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1760686353.0 xmlsec-1.3.17/build_support/network.py0000644000076500000240000000175415074370421016715 0ustar00aminstaffimport contextlib import json from urllib.request import Request, urlopen DEFAULT_USER_AGENT = 'https://github.com/xmlsec/python-xmlsec' DOWNLOAD_USER_AGENT = 'python-xmlsec build' def make_request(url, github_token=None, json_response=False): headers = {'User-Agent': DEFAULT_USER_AGENT} if github_token: headers['authorization'] = 'Bearer ' + github_token request = Request(url, headers=headers) with contextlib.closing(urlopen(request)) as response: charset = response.headers.get_content_charset() or 'utf-8' content = response.read().decode(charset) if json_response: return json.loads(content) return content def download_lib(url, filename): request = Request(url, headers={'User-Agent': DOWNLOAD_USER_AGENT}) with urlopen(request) as response, open(filename, 'wb') as target: while True: chunk = response.read(8192) if not chunk: break target.write(chunk) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1760686353.0 xmlsec-1.3.17/build_support/releases.py0000644000076500000240000000454115074370421017024 0ustar00aminstaffimport html.parser import os import re from distutils import log from distutils.version import StrictVersion as Version from .network import make_request class HrefCollector(html.parser.HTMLParser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.hrefs = [] def handle_starttag(self, tag, attrs): if tag == 'a': for name, value in attrs: if name == 'href': self.hrefs.append(value) def latest_release_from_html(url, matcher): content = make_request(url) collector = HrefCollector() collector.feed(content) hrefs = collector.hrefs def comp(text): try: return Version(matcher.match(text).groupdict()['version']) except (AttributeError, ValueError): return Version('0.0') latest = max(hrefs, key=comp) return f'{url}/{latest}' def latest_release_from_gnome_org_cache(url, lib_name): cache_url = f'{url}/cache.json' cache = make_request(cache_url, json_response=True) latest_version = cache[2][lib_name][-1] latest_source = cache[1][lib_name][latest_version]['tar.xz'] return f'{url}/{latest_source}' def latest_release_json_from_github_api(repo): api_url = f'https://api.github.com/repos/{repo}/releases/latest' token = os.environ.get('GH_TOKEN') if token: log.info('Using GitHub token to avoid rate limiting') return make_request(api_url, token, json_response=True) def latest_openssl_release(): return latest_release_json_from_github_api('openssl/openssl')['tarball_url'] def latest_zlib_release(): return latest_release_from_html('https://zlib.net/fossils', re.compile('zlib-(?P.*).tar.gz')) def latest_libiconv_release(): return latest_release_from_html('https://ftpmirror.gnu.org/libiconv', re.compile('libiconv-(?P.*).tar.gz')) def latest_libxml2_release(): return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxml2', 'libxml2') def latest_libxslt_release(): return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxslt', 'libxslt') def latest_xmlsec_release(): assets = latest_release_json_from_github_api('lsh123/xmlsec')['assets'] (tar_gz,) = [asset for asset in assets if asset['name'].endswith('.tar.gz')] return tar_gz['browser_download_url'] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762775466.0 xmlsec-1.3.17/build_support/static_build.py0000644000076500000240000004432515104350652017671 0ustar00aminstaffimport multiprocessing import os import platform import subprocess import sys import tarfile import zipfile from distutils.errors import DistutilsError from pathlib import Path from urllib.parse import urljoin from urllib.request import urlcleanup from .network import download_lib from .releases import ( latest_libiconv_release, latest_libxml2_release, latest_libxslt_release, latest_openssl_release, latest_xmlsec_release, latest_zlib_release, ) class CrossCompileInfo: def __init__(self, host, arch, compiler): self.host = host self.arch = arch self.compiler = compiler @property def triplet(self): return f'{self.host}-{self.arch}-{self.compiler}' class StaticBuildHelper: def __init__(self, builder): self.builder = builder self.ext = builder.ext_map['xmlsec'] self.info = builder.info self._prepare_directories() def prepare(self, platform_name): self.info(f'starting static build on {sys.platform}') if platform_name == 'win32': self._prepare_windows_build() elif 'linux' in platform_name or 'darwin' in platform_name: self._prepare_unix_build(platform_name) else: raise DistutilsError(f'Unsupported static build platform: {platform_name}') def _prepare_directories(self): buildroot = Path('build', 'tmp') prefix_dir = buildroot / 'prefix' prefix_dir.mkdir(parents=True, exist_ok=True) self.prefix_dir = prefix_dir.absolute() build_libs_dir = buildroot / 'libs' build_libs_dir.mkdir(exist_ok=True) self.build_libs_dir = build_libs_dir libs_dir = Path(os.environ.get('PYXMLSEC_LIBS_DIR', 'libs')) libs_dir.mkdir(exist_ok=True) self.libs_dir = libs_dir self.info('{:20} {}'.format('Lib sources in:', self.libs_dir.absolute())) self.builder.prefix_dir = self.prefix_dir self.builder.build_libs_dir = self.build_libs_dir self.builder.libs_dir = self.libs_dir def _prepare_windows_build(self): release_url = 'https://github.com/mxamin/python-xmlsec-win-binaries/releases/download/2025.07.10/' if platform.machine() == 'ARM64': suffix = 'win-arm64' elif sys.maxsize > 2**32: suffix = 'win64' else: suffix = 'win32' libs = [ f'libxml2-2.11.9-3.{suffix}.zip', f'libxslt-1.1.39.{suffix}.zip', f'zlib-1.3.1.{suffix}.zip', f'iconv-1.18-1.{suffix}.zip', f'openssl-3.0.16.pl1.{suffix}.zip', f'xmlsec-1.3.7.{suffix}.zip', ] for libfile in libs: url = urljoin(release_url, libfile) destfile = self.libs_dir / libfile if destfile.is_file(): self.info(f'Using local copy of "{url}"') else: self.info(f'Retrieving "{url}" to "{destfile}"') urlcleanup() download_lib(url, str(destfile)) for package in self.libs_dir.glob('*.zip'): with zipfile.ZipFile(str(package)) as archive: destdir = self.build_libs_dir archive.extractall(path=str(destdir)) self.ext.define_macros = [ ('XMLSEC_CRYPTO', '\\"openssl\\"'), ('__XMLSEC_FUNCTION__', '__FUNCTION__'), ('XMLSEC_NO_GOST', '1'), ('XMLSEC_NO_XKMS', '1'), ('XMLSEC_NO_CRYPTO_DYNAMIC_LOADING', '1'), ('XMLSEC_CRYPTO_OPENSSL', '1'), ('UNICODE', '1'), ('_UNICODE', '1'), ('LIBXML_ICONV_ENABLED', 1), ('LIBXML_STATIC', '1'), ('LIBXSLT_STATIC', 1), ('XMLSEC_STATIC', 1), ('inline', '__inline'), ] self.ext.libraries = [ 'libxmlsec_a', 'libxmlsec-openssl_a', 'libcrypto', 'iconv_a', 'libxslt_a', 'libexslt_a', 'libxml2_a', 'zlib', 'WS2_32', 'Advapi32', 'User32', 'Gdi32', 'Crypt32', ] self.ext.library_dirs = [str(path.absolute()) for path in self.build_libs_dir.rglob('lib')] includes = [path for path in self.build_libs_dir.rglob('include') if path.is_dir()] includes.append(next(path / 'xmlsec' for path in includes if (path / 'xmlsec').is_dir())) self.ext.include_dirs = [str(path.absolute()) for path in includes] def _prepare_unix_build(self, build_platform): self._capture_version_overrides() archives = self._ensure_source_archives() self._extract_archives(archives) env, prefix_arg, ldflags, cross_compile = self._prepare_build_environment(build_platform) self._build_dependencies(env, prefix_arg, ldflags, cross_compile) self._configure_extension_for_static(build_platform) def _capture_version_overrides(self): builder = self.builder builder.openssl_version = os.environ.get('PYXMLSEC_OPENSSL_VERSION', '3.6.0') builder.libiconv_version = os.environ.get('PYXMLSEC_LIBICONV_VERSION', '1.18') builder.libxml2_version = os.environ.get('PYXMLSEC_LIBXML2_VERSION', '2.14.6') builder.libxslt_version = os.environ.get('PYXMLSEC_LIBXSLT_VERSION', '1.1.43') builder.zlib_version = os.environ.get('PYXMLSEC_ZLIB_VERSION', '1.3.1') builder.xmlsec1_version = os.environ.get('PYXMLSEC_XMLSEC1_VERSION', '1.3.9') def _ensure_source_archives(self): return [ self._ensure_source( name='OpenSSL', glob='openssl*.tar.gz', filename='openssl.tar.gz', version=self.builder.openssl_version, env_label='PYXMLSEC_OPENSSL_VERSION', default_url=latest_openssl_release, version_url=lambda v: f'https://api.github.com/repos/openssl/openssl/tarball/openssl-{v}', ), self._ensure_source( name='zlib', glob='zlib*.tar.gz', filename='zlib.tar.gz', version=self.builder.zlib_version, env_label='PYXMLSEC_ZLIB_VERSION', default_url=latest_zlib_release, version_url=lambda v: f'https://zlib.net/fossils/zlib-{v}.tar.gz', ), self._ensure_source( name='libiconv', glob='libiconv*.tar.gz', filename='libiconv.tar.gz', version=self.builder.libiconv_version, env_label='PYXMLSEC_LIBICONV_VERSION', default_url=latest_libiconv_release, version_url=lambda v: f'https://ftpmirror.gnu.org/libiconv/libiconv-{v}.tar.gz', ), self._ensure_source( name='libxml2', glob='libxml2*.tar.xz', filename='libxml2.tar.xz', version=self.builder.libxml2_version, env_label='PYXMLSEC_LIBXML2_VERSION', default_url=latest_libxml2_release, version_url=lambda v: self._libxml_related_url('libxml2', v), ), self._ensure_source( name='libxslt', glob='libxslt*.tar.xz', filename='libxslt.tar.xz', version=self.builder.libxslt_version, env_label='PYXMLSEC_LIBXSLT_VERSION', default_url=latest_libxslt_release, version_url=lambda v: self._libxml_related_url('libxslt', v), ), self._ensure_source( name='xmlsec1', glob='xmlsec1*.tar.gz', filename='xmlsec1.tar.gz', version=self.builder.xmlsec1_version, env_label='PYXMLSEC_XMLSEC1_VERSION', default_url=latest_xmlsec_release, version_url=lambda v: f'https://github.com/lsh123/xmlsec/releases/download/{v}/xmlsec1-{v}.tar.gz', ), ] def _ensure_source(self, name, glob, filename, version, env_label, default_url, version_url): archive = next(self.libs_dir.glob(glob), None) if archive is not None: return archive self.info('{:10}: {}'.format(name, 'source tar not found, downloading ...')) archive = self.libs_dir / filename if version is None: url = default_url() self.info('{:10}: {}'.format(name, f'{env_label} unset, downloading latest from {url}')) else: url = version_url(version) self.info('{:10}: {}'.format(name, f'{env_label}={version}, downloading from {url}')) download_lib(url, str(archive)) return archive def _libxml_related_url(self, lib_name, version): version_prefix, _ = version.rsplit('.', 1) return f'https://download.gnome.org/sources/{lib_name}/{version_prefix}/{lib_name}-{version}.tar.xz' def _extract_archives(self, archives): for archive in archives: self.info(f'Unpacking {archive.name}') try: with tarfile.open(str(archive)) as tar: tar.extractall(path=str(self.build_libs_dir)) except EOFError as error: raise DistutilsError(f'Bad {archive.name} downloaded; remove it and try again.') from error def _prepare_build_environment(self, build_platform): prefix_arg = f'--prefix={self.prefix_dir}' env = os.environ.copy() cflags = [] if env.get('CFLAGS'): cflags.append(env['CFLAGS']) cflags.append('-fPIC') ldflags = [] if env.get('LDFLAGS'): ldflags.append(env['LDFLAGS']) cross_compile = None if build_platform == 'darwin': arch = self.builder.plat_name.rsplit('-', 1)[1] if arch != platform.machine() and arch in ('x86_64', 'arm64'): self.info(f'Cross-compiling for {arch}') cflags.append(f'-arch {arch}') ldflags.append(f'-arch {arch}') cross_compile = CrossCompileInfo('darwin64', arch, 'cc') major_version, _ = tuple(map(int, platform.mac_ver()[0].split('.')[:2])) if major_version >= 11 and 'MACOSX_DEPLOYMENT_TARGET' not in env: env['MACOSX_DEPLOYMENT_TARGET'] = '11.0' env['CFLAGS'] = ' '.join(cflags) env['LDFLAGS'] = ' '.join(ldflags) return env, prefix_arg, ldflags, cross_compile def _build_dependencies(self, env, prefix_arg, ldflags, cross_compile): self._build_openssl(env, prefix_arg, cross_compile) self._build_zlib(env, prefix_arg) host_arg = [f'--host={cross_compile.arch}'] if cross_compile else [] self._build_libiconv(env, prefix_arg, host_arg) self._build_libxml2(env, prefix_arg, host_arg) self._build_libxslt(env, prefix_arg, host_arg) ldflags.append('-lpthread') env['LDFLAGS'] = ' '.join(ldflags) self._build_xmlsec1(env, prefix_arg, host_arg) def _build_openssl(self, env, prefix_arg, cross_compile): self.info('Building OpenSSL') openssl_dir = next(self.build_libs_dir.glob('openssl-*')) openssl_config_cmd = [prefix_arg, 'no-shared', '-fPIC', '--libdir=lib'] if platform.machine() == 'riscv64': # openssl(riscv64): disable ASM to avoid R_RISCV_JAL relocation failure on 3.5.2 # OpenSSL 3.5.2 enables RISC-V64 AES assembly by default. When we statically # link libcrypto alongside xmlsec, the AES asm path triggers a link-time error: # relocation truncated to fit: R_RISCV_JAL against symbol `AES_set_encrypt_key' # in .../libcrypto.a(libcrypto-lib-aes-riscv64.o) # This appears to stem from a long-range jump emitted by the AES asm generator # (see aes-riscv64.pl around L1069), which can exceed the JAL reach when objects # end up far apart in the final static link. # As a pragmatic workaround, disable ASM on riscv64 (pass `no-asm`) so the # portable C implementation is used. This unblocks the build at the cost of # some crypto performance on riscv64 only. # Refs: # - https://github.com/openssl/openssl/blob/0893a62/crypto/aes/asm/aes-riscv64.pl#L1069 openssl_config_cmd.append('no-asm') if cross_compile: openssl_config_cmd.insert(0, './Configure') openssl_config_cmd.append(cross_compile.triplet) else: openssl_config_cmd.insert(0, './config') subprocess.check_call(openssl_config_cmd, cwd=str(openssl_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(openssl_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install_sw'], cwd=str(openssl_dir), env=env) def _build_zlib(self, env, prefix_arg): self.info('Building zlib') zlib_dir = next(self.build_libs_dir.glob('zlib-*')) subprocess.check_call(['./configure', prefix_arg], cwd=str(zlib_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(zlib_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(zlib_dir), env=env) def _build_libiconv(self, env, prefix_arg, host_arg): self.info('Building libiconv') libiconv_dir = next(self.build_libs_dir.glob('libiconv-*')) subprocess.check_call( [ './configure', prefix_arg, '--disable-dependency-tracking', '--disable-shared', *host_arg, ], cwd=str(libiconv_dir), env=env, ) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(libiconv_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(libiconv_dir), env=env) def _build_libxml2(self, env, prefix_arg, host_arg): self.info('Building LibXML2') libxml2_dir = next(self.build_libs_dir.glob('libxml2-*')) subprocess.check_call( [ './configure', prefix_arg, '--disable-dependency-tracking', '--disable-shared', '--without-lzma', '--without-python', f'--with-iconv={self.prefix_dir}', f'--with-zlib={self.prefix_dir}', *host_arg, ], cwd=str(libxml2_dir), env=env, ) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(libxml2_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(libxml2_dir), env=env) def _build_libxslt(self, env, prefix_arg, host_arg): self.info('Building libxslt') libxslt_dir = next(self.build_libs_dir.glob('libxslt-*')) subprocess.check_call( [ './configure', prefix_arg, '--disable-dependency-tracking', '--disable-shared', '--without-python', '--without-crypto', f'--with-libxml-prefix={self.prefix_dir}', *host_arg, ], cwd=str(libxslt_dir), env=env, ) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(libxslt_dir), env=env) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(libxslt_dir), env=env) def _build_xmlsec1(self, env, prefix_arg, host_arg): self.info('Building xmlsec1') xmlsec1_dir = next(self.build_libs_dir.glob('xmlsec1-*')) subprocess.check_call( [ './configure', prefix_arg, '--disable-shared', '--disable-gost', '--enable-md5', '--enable-ripemd160', '--disable-crypto-dl', '--enable-static=yes', '--enable-shared=no', '--enable-static-linking=yes', '--with-default-crypto=openssl', f'--with-openssl={self.prefix_dir}', f'--with-libxml={self.prefix_dir}', f'--with-libxslt={self.prefix_dir}', *host_arg, ], cwd=str(xmlsec1_dir), env=env, ) include_flags = [ f'-I{self.prefix_dir / "include"}', f'-I{self.prefix_dir / "include" / "libxml"}', ] subprocess.check_call( ['make', f'-j{multiprocessing.cpu_count() + 1}', *include_flags], cwd=str(xmlsec1_dir), env=env, ) subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(xmlsec1_dir), env=env) def _configure_extension_for_static(self, build_platform): self.ext.define_macros = [ ('__XMLSEC_FUNCTION__', '__func__'), ('XMLSEC_NO_SIZE_T', None), ('XMLSEC_NO_GOST', '1'), ('XMLSEC_NO_GOST2012', '1'), ('XMLSEC_NO_XKMS', '1'), ('XMLSEC_CRYPTO', '\\"openssl\\"'), ('XMLSEC_NO_CRYPTO_DYNAMIC_LOADING', '1'), ('XMLSEC_CRYPTO_OPENSSL', '1'), ('LIBXML_ICONV_ENABLED', 1), ('LIBXML_STATIC', 1), ('LIBXSLT_STATIC', 1), ('XMLSEC_STATIC', 1), ('inline', '__inline'), ('UNICODE', '1'), ('_UNICODE', '1'), ] self.ext.include_dirs.append(str(self.prefix_dir / 'include')) self.ext.include_dirs.extend([str(path.absolute()) for path in (self.prefix_dir / 'include').iterdir() if path.is_dir()]) self.ext.library_dirs = [] if build_platform == 'linux': self.ext.libraries = ['m', 'rt'] extra_objects = [ 'libxmlsec1.a', 'libxslt.a', 'libxml2.a', 'libz.a', 'libxmlsec1-openssl.a', 'libcrypto.a', 'libiconv.a', 'libxmlsec1.a', ] self.ext.extra_objects = [str(self.prefix_dir / 'lib' / obj) for obj in extra_objects] __all__ = ('CrossCompileInfo', 'StaticBuildHelper') ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762767374.0 xmlsec-1.3.17/pyproject.toml0000644000076500000240000000730015104331016014653 0ustar00aminstaff[build-system] requires = ["setuptools==80.9.0", "wheel", "setuptools_scm[toml]>=3.4", "pkgconfig>=1.5.1", "lxml==6.0.2"] [tool.mypy] files = ['src'] ignore_missing_imports = false warn_unused_configs = true disallow_subclassing_any = true disallow_any_generics = true disallow_untyped_calls = true disallow_untyped_defs = true disallow_incomplete_defs = true check_untyped_defs = true disallow_untyped_decorators = true disallow_any_unimported = true strict_optional = true no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true warn_return_any = true warn_no_return = true no_implicit_reexport = true show_error_codes = true [tool.ruff] # Maximum line length, same as your original Black + Flake8 config line-length = 130 # Target Python version (used for autofixes and style rules) target-version = "py39" # Directories and files to exclude from linting and formatting exclude = [ ".venv*", # virtual environments ".git", # git directory "build", # build output "dist", # distribution packages "libs", # vendor libraries ".eggs", # setuptools egg folders ".direnv*", # direnv environments "*_pb2.pyi" # protobuf-generated type stubs ] [tool.ruff.lint] # Enable rule categories: # E = pycodestyle (style issues, like indentation, whitespace, etc.) # F = pyflakes (unused imports, undefined names) # I = isort (import sorting) # B = flake8-bugbear (common bugs & anti-patterns) # UP = pyupgrade (auto-upgrade syntax for newer Python) # SIM = flake8-simplify (simplifiable code patterns) # RUF = Ruff-native rules (extra, performance-optimized checks) select = ["E", "F", "I", "B", "UP", "SIM", "RUF"] # TODO: Add more rule categories as needed, e.g.: # D = pydocstyle (docstring format/style issues) [tool.ruff.lint.per-file-ignores] "*.pyi" = [ # Ignore formatting and import errors in stub files "E301", # expected 1 blank line, found 0 "E302", # expected 2 blank lines, found 1 "E305", # expected 2 blank lines after class or function "E501", # line too long "E701", # multiple statements on one line "F401", # unused import "F811", # redefinition of unused name "F822" # undefined name in `__all__` ] "doc/source/conf.py" = [ "D1" # missing docstring in public module/class/function ] "doc/source/examples/*.py" = [ "D1", # allow missing docstrings in examples "E501" # allow long lines in code examples ] "tests/*.py" = [ "D1" # allow missing docstrings in test files ] [tool.ruff.format] # Always use single quotes (e.g., 'text' instead of "text") quote-style = "single" # Format code with or without trailing commas # true = prefer trailing commas where valid skip-magic-trailing-comma = false # Enforce Unix-style line endings (LF) line-ending = "lf" [tool.cibuildwheel] build = [ "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*" ] build-verbosity = 1 build-frontend = "build" skip = [ "pp*", # Skips PyPy builds (pp38-*, pp39-*, etc.) "*musllinux_riscv64" # maturin and ruff currently don’t support the musl + riscv64 target ] test-command = "pytest -v --color=yes {package}/tests" before-test = "pip install -r requirements-test.txt" test-skip = "*-macosx_arm64" [tool.cibuildwheel.environment] PYXMLSEC_STATIC_DEPS = "true" [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64", "riscv64"] environment-pass = [ "PYXMLSEC_LIBXML2_VERSION", "PYXMLSEC_LIBXSLT_VERSION", "PYXMLSEC_STATIC_DEPS", "GH_TOKEN" ] [tool.cibuildwheel.macos] archs = ["x86_64", "arm64"] before-all = "brew install perl" [tool.cibuildwheel.windows] archs = ["AMD64"] [[tool.cibuildwheel.overrides]] select = "*-manylinux*" before-all = "yum install -y perl-core" ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1762874576.341458 xmlsec-1.3.17/setup.cfg0000644000076500000240000000050315104652320013562 0ustar00aminstaff[metadata] description_file = README.md [bdist_rpm] release = 1 build_requires = pkg-config xmlsec1-devel libxml2-devel xmlsec1-openssl-devel group = Development/Libraries requires = xmlsec1 xmlsec1-openssl [build_sphinx] source-dir = doc/source build-dir = doc/build all_files = 1 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762503369.0 xmlsec-1.3.17/setup.py0000644000076500000240000000411415103325311013451 0ustar00aminstafffrom pathlib import Path from setuptools import Extension, setup from build_support.build_ext import build_ext src_root = Path(__file__).parent / 'src' sources = [str(path.absolute()) for path in src_root.rglob('*.c')] pyxmlsec = Extension('xmlsec', sources=sources) setup_reqs = ['setuptools_scm[toml]>=3.4', 'pkgconfig>=1.5.1', 'lxml>=3.8'] with open('README.md', encoding='utf-8') as readme: long_desc = readme.read() setup( name='xmlsec', use_scm_version=True, description='Python bindings for the XML Security Library', long_description=long_desc, long_description_content_type='text/markdown', ext_modules=[pyxmlsec], cmdclass={'build_ext': build_ext}, python_requires='>=3.9', setup_requires=setup_reqs, install_requires=['lxml>=3.8'], author='Bulat Gaifullin', author_email='support@mehcode.com', maintainer='Oleg Hoefling', maintainer_email='oleg.hoefling@gmail.com', url='https://github.com/mehcode/python-xmlsec', project_urls={ 'Documentation': 'https://xmlsec.readthedocs.io', 'Source': 'https://github.com/mehcode/python-xmlsec', 'Changelog': 'https://github.com/mehcode/python-xmlsec/releases', }, license='MIT', keywords=['xmlsec'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: C', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: 3.14', 'Topic :: Text Processing :: Markup :: XML', 'Typing :: Typed', ], zip_safe=False, packages=['xmlsec'], package_dir={'': 'src'}, package_data={'xmlsec': ['py.typed', '*.pyi']}, ) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1762874576.322724 xmlsec-1.3.17/src/0000755000076500000240000000000015104652320012532 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1709064728.0 xmlsec-1.3.17/src/common.h0000644000076500000240000000151514567441030014203 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_COMMON_H__ #define __PYXMLSEC_COMMON_H__ #include "debug.h" #ifndef MODULE_NAME #define MODULE_NAME xmlsec #endif #define JOIN(X,Y) DO_JOIN1(X,Y) #define DO_JOIN1(X,Y) DO_JOIN2(X,Y) #define DO_JOIN2(X,Y) X##Y #define DO_STRINGIFY(x) #x #define STRINGIFY(x) DO_STRINGIFY(x) #endif //__PYXMLSEC_COMMON_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712131861.0 xmlsec-1.3.17/src/constants.c0000644000076500000240000005772514603207425014737 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "constants.h" #define PYXMLSEC_CONSTANTS_DOC "Various constants used by the library.\n" // destructor static void PyXmlSec_Transform__del__(PyObject* self) { PYXMLSEC_DEBUGF("%p", self); Py_TYPE(self)->tp_free(self); } // __str__ method static PyObject* PyXmlSec_Transform__str__(PyObject* self) { char buf[300]; PyXmlSec_Transform* transform = (PyXmlSec_Transform*)(self); if (transform->id->href != NULL) snprintf(buf, sizeof(buf), "%s, %s", transform->id->name, transform->id->href); else snprintf(buf, sizeof(buf), "%s, None", transform->id->name); return PyUnicode_FromString(buf); } // __repr__ method static PyObject* PyXmlSec_Transform__repr__(PyObject* self) { char buf[300]; PyXmlSec_Transform* transform = (PyXmlSec_Transform*)(self); if (transform->id->href != NULL) snprintf(buf, sizeof(buf), "__Transform('%s', '%s', %d)", transform->id->name, transform->id->href, transform->id->usage); else snprintf(buf, sizeof(buf), "__Transform('%s', None, %d)", transform->id->name, transform->id->usage); return PyUnicode_FromString(buf); } static const char PyXmlSec_TransformNameGet__doc__[] = "The transform's name."; static PyObject* PyXmlSec_TransformNameGet(PyXmlSec_Transform* self, void* closure) { return PyUnicode_FromString((const char*)self->id->name); } static const char PyXmlSec_TransformHrefGet__doc__[] = "The transform's identification string (href)."; static PyObject* PyXmlSec_TransformHrefGet(PyXmlSec_Transform* self, void* closure) { if (self->id->href != NULL) return PyUnicode_FromString((const char*)self->id->href); Py_RETURN_NONE; } static const char PyXmlSec_TransformUsageGet__doc__[] = "The allowed transforms usages."; static PyObject* PyXmlSec_TransformUsageGet(PyXmlSec_Transform* self, void* closure) { return PyLong_FromUnsignedLong(self->id->usage); } static PyGetSetDef PyXmlSec_TransformGetSet[] = { { "name", (getter)PyXmlSec_TransformNameGet, NULL, (char*)PyXmlSec_TransformNameGet__doc__, NULL }, { "href", (getter)PyXmlSec_TransformHrefGet, NULL, (char*)PyXmlSec_TransformHrefGet__doc__, NULL }, { "usage", (getter)PyXmlSec_TransformUsageGet, NULL, (char*)PyXmlSec_TransformUsageGet__doc__, NULL }, {NULL} /* Sentinel */ }; static PyTypeObject _PyXmlSec_TransformType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".constants.__Transform", /* tp_name */ sizeof(PyXmlSec_Transform), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_Transform__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ PyXmlSec_Transform__repr__, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ PyXmlSec_Transform__str__, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "The xmlSecTransformId reflection", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ PyXmlSec_TransformGetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ }; PyTypeObject* PyXmlSec_TransformType = &_PyXmlSec_TransformType; static PyObject* PyXmlSec_TransformNew(xmlSecTransformId id) { PyXmlSec_Transform* transform = PyObject_New(PyXmlSec_Transform, PyXmlSec_TransformType); if (transform != NULL) { transform->id = id; } return (PyObject*)transform; } // destructor static void PyXmlSec_KeyData__del__(PyObject* self) { PYXMLSEC_DEBUGF("%p", self); Py_TYPE(self)->tp_free(self); } // __str__ method static PyObject* PyXmlSec_KeyData__str__(PyObject* self) { char buf[300]; PyXmlSec_KeyData* keydata = (PyXmlSec_KeyData*)(self); if (keydata->id->href != NULL) snprintf(buf, sizeof(buf), "%s, %s", keydata->id->name, keydata->id->href); else snprintf(buf, sizeof(buf), "%s, None", keydata->id->name); return PyUnicode_FromString(buf); } // __repr__ method static PyObject* PyXmlSec_KeyData__repr__(PyObject* self) { char buf[300]; PyXmlSec_KeyData* keydata = (PyXmlSec_KeyData*)(self); if (keydata->id->href != NULL) snprintf(buf, sizeof(buf), "__KeyData('%s', '%s')", keydata->id->name, keydata->id->href); else snprintf(buf, sizeof(buf), "__KeyData('%s', None)", keydata->id->name); return PyUnicode_FromString(buf); } static const char PyXmlSec_KeyDataNameGet__doc__[] = "The key data's name."; static PyObject* PyXmlSec_KeyDataNameGet(PyXmlSec_KeyData* self, void* closure) { return PyUnicode_FromString((const char*)self->id->name); } static const char PyXmlSec_KeyDataHrefGet__doc__[] = "The key data's identification string (href)."; static PyObject* PyXmlSec_KeyDataHrefGet(PyXmlSec_KeyData* self, void* closure) { if (self->id->href != NULL) return PyUnicode_FromString((const char*)self->id->href); Py_RETURN_NONE; } static PyGetSetDef PyXmlSec_KeyDataGetSet[] = { { "name", (getter)PyXmlSec_KeyDataNameGet, NULL, (char*)PyXmlSec_KeyDataNameGet__doc__, NULL }, { "href", (getter)PyXmlSec_KeyDataHrefGet, NULL, (char*)PyXmlSec_KeyDataHrefGet__doc__, NULL }, {NULL} /* Sentinel */ }; static PyTypeObject _PyXmlSec_KeyDataType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".constants.__KeyData", /* tp_name */ sizeof(PyXmlSec_KeyData), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_KeyData__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ PyXmlSec_KeyData__repr__, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ PyXmlSec_KeyData__str__, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "The xmlSecKeyDataId reflection", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ PyXmlSec_KeyDataGetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ }; PyTypeObject* PyXmlSec_KeyDataType = &_PyXmlSec_KeyDataType; static PyObject* PyXmlSec_KeyDataNew(xmlSecKeyDataId id) { PyXmlSec_KeyData* keydata = PyObject_New(PyXmlSec_KeyData, PyXmlSec_KeyDataType); if (keydata != NULL) { keydata->id = id; } return (PyObject*)keydata; } static PyModuleDef PyXmlSec_ConstantsModule = { PyModuleDef_HEAD_INIT, STRINGIFY(MODULE_NAME) ".constants", PYXMLSEC_CONSTANTS_DOC, -1, NULL, NULL, NULL, NULL, NULL }; // initialize constants module and registers it base package int PyXmlSec_ConstantsModule_Init(PyObject* package) { PyObject* constants = NULL; PyObject* nsCls = NULL; PyObject* nodeCls = NULL; PyObject* transformCls = NULL; PyObject* encryptionTypeCls = NULL; PyObject* keyFormatCls = NULL; PyObject* keyDataCls = NULL; PyObject* keyDataTypeCls = NULL; PyObject* tmp = NULL; constants = PyModule_Create(&PyXmlSec_ConstantsModule); if (!constants) return -1; if (PyType_Ready(PyXmlSec_TransformType) < 0) goto ON_FAIL; if (PyType_Ready(PyXmlSec_KeyDataType) < 0) goto ON_FAIL; #define PYXMLSEC_ADD_INT_CONSTANT(name) PyModule_AddIntConstant(constants, STRINGIFY(name), JOIN(xmlSec, name)) if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageUnknown) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageDSigTransform) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageC14NMethod) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageDigestMethod) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageSignatureMethod) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageEncryptionMethod) < 0) goto ON_FAIL; if (PYXMLSEC_ADD_INT_CONSTANT(TransformUsageAny) < 0) goto ON_FAIL; #undef PYXMLSEC_ADD_INT_CONSTANT #define PYXMLSEC_DECLARE_NAMESPACE(var, name) \ if (!(var = PyModule_New(name))) goto ON_FAIL; \ if (PyModule_AddObject(package, name, var) < 0) goto ON_FAIL; \ Py_INCREF(var); // add object steels reference #define PYXMLSEC_CLOSE_NAMESPACE(var) \ Py_DECREF(var); var = NULL // compensate add ref from declare namespace #define PYXMLSEC_ADD_CONSTANT(ns, name, lname) \ if (tmp == NULL) goto ON_FAIL; \ if (PyModule_AddObject(constants, STRINGIFY(name), tmp) < 0) goto ON_FAIL; \ Py_INCREF(tmp); \ if (PyModule_AddObject(ns, lname, tmp) < 0) goto ON_FAIL; \ tmp = NULL; #define PYXMLSEC_ADD_NS_CONSTANT(name, lname) \ tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \ PYXMLSEC_ADD_CONSTANT(nsCls, name, lname); // namespaces PYXMLSEC_DECLARE_NAMESPACE(nsCls, "Namespace"); PYXMLSEC_ADD_NS_CONSTANT(Ns, "BASE"); PYXMLSEC_ADD_NS_CONSTANT(DSigNs, "DS"); PYXMLSEC_ADD_NS_CONSTANT(EncNs, "ENC"); #ifndef XMLSEC_NO_XKMS PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS"); #endif PYXMLSEC_ADD_NS_CONSTANT(XPathNs, "XPATH"); PYXMLSEC_ADD_NS_CONSTANT(XPath2Ns, "XPATH2"); PYXMLSEC_ADD_NS_CONSTANT(XPointerNs, "XPOINTER"); PYXMLSEC_ADD_NS_CONSTANT(NsExcC14N, "EXC_C14N"); PYXMLSEC_ADD_NS_CONSTANT(NsExcC14NWithComments, "EXC_C14N_WITH_COMMENT"); PYXMLSEC_CLOSE_NAMESPACE(nsCls); #undef PYXMLSEC_ADD_NS_CONSTANT #define PYXMLSEC_ADD_ENC_CONSTANT(name, lname) \ tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \ PYXMLSEC_ADD_CONSTANT(encryptionTypeCls, name, lname); // encryption type PYXMLSEC_DECLARE_NAMESPACE(encryptionTypeCls, "EncryptionType"); PYXMLSEC_ADD_ENC_CONSTANT(TypeEncContent, "CONTENT"); PYXMLSEC_ADD_ENC_CONSTANT(TypeEncElement, "ELEMENT"); PYXMLSEC_CLOSE_NAMESPACE(encryptionTypeCls); #undef PYXMLSEC_ADD_ENC_CONSTANT #define PYXMLSEC_ADD_NODE_CONSTANT(name, lname) \ tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \ PYXMLSEC_ADD_CONSTANT(nodeCls, name, lname); // node PYXMLSEC_DECLARE_NAMESPACE(nodeCls, "Node"); PYXMLSEC_ADD_NODE_CONSTANT(NodeSignature, "SIGNATURE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeSignedInfo, "SIGNED_INFO"); PYXMLSEC_ADD_NODE_CONSTANT(NodeCanonicalizationMethod, "CANONICALIZATION_METHOD"); PYXMLSEC_ADD_NODE_CONSTANT(NodeSignatureMethod, "SIGNATURE_METHOD"); PYXMLSEC_ADD_NODE_CONSTANT(NodeSignatureValue, "SIGNATURE_VALUE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeSignatureProperties, "SIGNATURE_PROPERTIES"); PYXMLSEC_ADD_NODE_CONSTANT(NodeDigestMethod, "DIGEST_METHOD"); PYXMLSEC_ADD_NODE_CONSTANT(NodeDigestValue, "DIGEST_VALUE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeObject, "OBJECT"); PYXMLSEC_ADD_NODE_CONSTANT(NodeManifest, "MANIFEST"); PYXMLSEC_ADD_NODE_CONSTANT(NodeEncryptedData, "ENCRYPTED_DATA"); PYXMLSEC_ADD_NODE_CONSTANT(NodeEncryptedKey, "ENCRYPTED_KEY"); PYXMLSEC_ADD_NODE_CONSTANT(NodeEncryptionMethod, "ENCRYPTION_METHOD"); PYXMLSEC_ADD_NODE_CONSTANT(NodeEncryptionProperty, "ENCRYPTION_PROPERTY"); PYXMLSEC_ADD_NODE_CONSTANT(NodeEncryptionProperties, "ENCRYPTION_PROPERTIES"); PYXMLSEC_ADD_NODE_CONSTANT(NodeCipherData, "CIPHER_DATA"); PYXMLSEC_ADD_NODE_CONSTANT(NodeCipherValue, "CIPHER_VALUE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeCipherReference, "CIPHER_REFERENCE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeDataReference, "DATA_REFERENCE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeKeyReference, "KEY_REFERENCE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeReference, "REFERENCE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeReferenceList, "REFERENCE_LIST"); PYXMLSEC_ADD_NODE_CONSTANT(NodeKeyInfo, "KEY_INFO"); PYXMLSEC_ADD_NODE_CONSTANT(NodeKeyName, "KEY_NAME"); PYXMLSEC_ADD_NODE_CONSTANT(NodeKeyValue, "KEY_VALUE"); PYXMLSEC_ADD_NODE_CONSTANT(NodeX509Data, "X509_DATA"); PYXMLSEC_CLOSE_NAMESPACE(nodeCls); #undef PYXMLSEC_ADD_NODE_CONSTANT #define PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(name, lname) \ tmp = PyLong_FromUnsignedLong((unsigned long)(JOIN(xmlSec, name))); \ PYXMLSEC_ADD_CONSTANT(keyFormatCls, name, lname); // key format PYXMLSEC_DECLARE_NAMESPACE(keyFormatCls, "KeyFormat"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatUnknown, "UNKNOWN"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatBinary, "BINARY"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatPem, "PEM"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatDer, "DER"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatPkcs8Pem, "PKCS8_PEM"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatPkcs8Der, "PKCS8_DER");; PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatPkcs12, "PKCS12_PEM"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatCertPem, "CERT_PEM"); PYXMLSEC_ADD_KEY_FORMAT_CONSTANT(KeyDataFormatCertDer, "CERT_DER"); PYXMLSEC_CLOSE_NAMESPACE(keyFormatCls); #undef PYXMLSEC_ADD_KEY_FORMAT_CONSTANT #define PYXMLSEC_ADD_KEY_TYPE_CONSTANT(name, lname) \ tmp = PyLong_FromUnsignedLong((unsigned long)(JOIN(xmlSec, name))); \ PYXMLSEC_ADD_CONSTANT(keyDataTypeCls, name, lname); // key data type PYXMLSEC_DECLARE_NAMESPACE(keyDataTypeCls, "KeyDataType"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeUnknown, "UNKNOWN"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeNone, "NONE"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypePublic, "PUBLIC"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypePrivate, "PRIVATE"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeSymmetric, "SYMMETRIC"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeSession, "SESSION"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypePermanent, "PERMANENT"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeTrusted, "TRUSTED"); PYXMLSEC_ADD_KEY_TYPE_CONSTANT(KeyDataTypeAny, "ANY"); PYXMLSEC_CLOSE_NAMESPACE(keyDataTypeCls); #undef PYXMLSEC_ADD_KEY_TYPE_CONSTANT #define PYXMLSEC_ADD_KEYDATA_CONSTANT(name, lname) \ tmp = PyXmlSec_KeyDataNew(xmlSec ## name ## Id); \ PYXMLSEC_ADD_CONSTANT(keyDataCls, name, lname); // keydata PYXMLSEC_DECLARE_NAMESPACE(keyDataCls, "KeyData"); PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataName, "NAME") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataValue, "VALUE") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataRetrievalMethod, "RETRIEVALMETHOD") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEncryptedKey, "ENCRYPTEDKEY") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataAes, "AES") #ifndef XMLSEC_NO_DES PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataDes, "DES") #endif #ifndef XMLSEC_NO_DSA PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataDsa, "DSA") #endif #if XMLSEC_VERSION_HEX > 0x10212 && XMLSEC_VERSION_HEX < 0x10303 // from version 1.2.19 to version 1.3.2 (inclusive) PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEcdsa, "ECDSA") #elif XMLSEC_VERSION_HEX >= 0x10303 // from version 1.3.3 (inclusive) PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEc, "ECDSA") #endif PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataHmac, "HMAC") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataRsa, "RSA") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataX509, "X509") PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataRawX509Cert, "RAWX509CERT") PYXMLSEC_CLOSE_NAMESPACE(keyDataCls); #undef PYXMLSEC_ADD_KEYDATA_CONSTANT #define PYXMLSEC_ADD_TRANSFORM_CONSTANT(name, lname) \ tmp = PyXmlSec_TransformNew(xmlSec ## name ## Id); \ PYXMLSEC_ADD_CONSTANT(transformCls, name, lname); // transforms PYXMLSEC_DECLARE_NAMESPACE(transformCls, "Transform"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformInclC14N, "C14N"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformInclC14NWithComments, "C14N_COMMENTS"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformInclC14N11, "C14N11"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformInclC14N11WithComments, "C14N11_COMMENTS"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformExclC14N, "EXCL_C14N"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformExclC14NWithComments, "EXCL_C14N_COMMENTS"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEnveloped, "ENVELOPED"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPath, "XPATH"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPath2, "XPATH2"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPointer, "XPOINTER"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRemoveXmlTagsC14N, "REMOVE_XML_TAGS_C14N"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformVisa3DHack, "VISA3D_HACK"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes128Cbc, "AES128"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes192Cbc, "AES192"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes256Cbc, "AES256"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformKWAes128, "KW_AES128"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformKWAes192, "KW_AES192"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformKWAes256, "KW_AES256"); #ifndef XMLSEC_NO_DES PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformDes3Cbc, "DES3"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformKWDes3, "KW_DES3"); #endif #ifndef XMLSEC_NO_DSA PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformDsaSha1, "DSA_SHA1"); #endif #ifndef XMLSEC_NO_XSLT PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXslt, "XSLT"); #endif #if XMLSEC_VERSION_HEX > 0x10212 // from version 1.2.19 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha1, "ECDSA_SHA1"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha224, "ECDSA_SHA224"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha256, "ECDSA_SHA256"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha384, "ECDSA_SHA384"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha512, "ECDSA_SHA512"); #endif #ifndef XMLSEC_NO_MD5 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacMd5, "HMAC_MD5"); #endif #ifndef XMLSEC_NO_RIPEMD160 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacRipemd160, "HMAC_RIPEMD160"); #endif PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha1, "HMAC_SHA1"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha224, "HMAC_SHA224"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha256, "HMAC_SHA256"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha384, "HMAC_SHA384"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha512, "HMAC_SHA512"); #ifndef XMLSEC_NO_MD5 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaMd5, "RSA_MD5"); #endif #ifndef XMLSEC_NO_RIPEMD160 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaRipemd160, "RSA_RIPEMD160"); #endif PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaSha1, "RSA_SHA1"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaSha224, "RSA_SHA224"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaSha256, "RSA_SHA256"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaSha384, "RSA_SHA384"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaSha512, "RSA_SHA512"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaPkcs1, "RSA_PKCS1"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaOaep, "RSA_OAEP"); #ifndef XMLSEC_NO_MD5 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformMd5, "MD5"); #endif #ifndef XMLSEC_NO_RIPEMD160 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRipemd160, "RIPEMD160"); #endif PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha1, "SHA1"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha224, "SHA224"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha256, "SHA256"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha384, "SHA384"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha512, "SHA512"); #if XMLSEC_VERSION_HEX > 0x1021B // from version 1.2.28 PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes128Gcm, "AES128_GCM"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes192Gcm, "AES192_GCM"); PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes256Gcm, "AES256_GCM"); #endif PYXMLSEC_CLOSE_NAMESPACE(transformCls); #undef PYXMLSEC_ADD_TRANSFORM_CONSTANT #undef PYXMLSEC_ADD_CONSTANT #undef PYXMLSEC_DECLARE_NAMESPACE if (PyModule_AddObject(package, "constants", constants) < 0) goto ON_FAIL; return 0; ON_FAIL: Py_XDECREF(tmp); Py_XDECREF(nsCls); Py_XDECREF(nodeCls); Py_XDECREF(transformCls); Py_XDECREF(encryptionTypeCls); Py_XDECREF(keyFormatCls); Py_XDECREF(keyDataCls); Py_XDECREF(keyDataTypeCls); Py_DECREF(constants); return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/constants.h0000644000076500000240000000166514441560770014741 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_CONSTANTS_H__ #define __PYXMLSEC_CONSTANTS_H__ #include "platform.h" #include #include typedef struct { PyObject_HEAD xmlSecTransformId id; } PyXmlSec_Transform; typedef struct { PyObject_HEAD xmlSecKeyDataId id; } PyXmlSec_KeyData; extern PyTypeObject* PyXmlSec_TransformType; extern PyTypeObject* PyXmlSec_KeyDataType; #endif //__PYXMLSEC_CONSTANTS_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/debug.h0000644000076500000240000000205114441560770014001 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_DEBUG_H__ #define __PYXMLSEC_DEBUG_H__ #ifdef PYXMLSEC_ENABLE_DEBUG #include #define PYXMLSEC_DEBUG(fmt) fprintf(stderr, "[%s:%d %s] " fmt "\n", __FILE__, __LINE__, __FUNCTION__) #define PYXMLSEC_DEBUGF(fmt, ...) fprintf(stderr, "[%s:%d %s] " fmt "\n", __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define PYXMLSEC_DUMP(method, obj) method(obj, stderr) #else #define PYXMLSEC_DEBUG(...) #define PYXMLSEC_DEBUGF(...) #define PYXMLSEC_DUMP(method, obj) #endif // PYXMLSEC_ENABLE_DEBUG #endif // __PYXMLSEC_DEBUG_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/ds.c0000644000076500000240000005602314441560770013324 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "platform.h" #include "exception.h" #include "constants.h" #include "keys.h" #include "lxml.h" #include typedef struct { PyObject_HEAD xmlSecDSigCtxPtr handle; PyXmlSec_KeysManager* manager; } PyXmlSec_SignatureContext; static PyObject* PyXmlSec_SignatureContext__new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)PyType_GenericNew(type, args, kwargs); PYXMLSEC_DEBUGF("%p: new sign context", ctx); if (ctx != NULL) { ctx->handle = NULL; ctx->manager = NULL; } return (PyObject*)(ctx); } static int PyXmlSec_SignatureContext__init__(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "manager", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_KeysManager* manager = NULL; PYXMLSEC_DEBUGF("%p: init sign context", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:__init__", kwlist, PyXmlSec_KeysManagerConvert, &manager)) { goto ON_FAIL; } ctx->handle = xmlSecDSigCtxCreate(manager != NULL ? manager->handle : NULL); if (ctx->handle == NULL) { PyXmlSec_SetLastError("failed to create the digital signature context"); goto ON_FAIL; } ctx->manager = manager; PYXMLSEC_DEBUGF("%p: signMethod: %p", self, ctx->handle->signMethod); PYXMLSEC_DEBUGF("%p: init sign context - ok, manager - %p", self, manager); return 0; ON_FAIL: PYXMLSEC_DEBUGF("%p: init sign context - failed", self); Py_XDECREF(manager); return -1; } static void PyXmlSec_SignatureContext__del__(PyObject* self) { PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PYXMLSEC_DEBUGF("%p: delete sign context", self); if (ctx->handle != NULL) { xmlSecDSigCtxDestroy(ctx->handle); } // release manager object Py_XDECREF(ctx->manager); Py_TYPE(self)->tp_free(self); } static const char PyXmlSec_SignatureContextKey__doc__[] = "Signature key.\n"; static PyObject* PyXmlSec_SignatureContextKeyGet(PyObject* self, void* closure) { PyXmlSec_SignatureContext* ctx = ((PyXmlSec_SignatureContext*)self); PyXmlSec_Key* key; if (ctx->handle->signKey == NULL) { Py_RETURN_NONE; } key = PyXmlSec_NewKey(); key->handle = ctx->handle->signKey; key->is_own = 0; return (PyObject*)key; } static int PyXmlSec_SignatureContextKeySet(PyObject* self, PyObject* value, void* closure) { PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_Key* key; PYXMLSEC_DEBUGF("%p, %p", self, value); if (value == NULL) { // key deletion if (ctx->handle->signKey != NULL) { xmlSecKeyDestroy(ctx->handle->signKey); ctx->handle->signKey = NULL; } return 0; } if (!PyObject_IsInstance(value, (PyObject*)PyXmlSec_KeyType)) { PyErr_SetString(PyExc_TypeError, "instance of *xmlsec.Key* expected."); return -1; } key = (PyXmlSec_Key*)value; if (key->handle == NULL) { PyErr_SetString(PyExc_TypeError, "empty key."); return -1; } if (ctx->handle->signKey != NULL) { xmlSecKeyDestroy(ctx->handle->signKey); } ctx->handle->signKey = xmlSecKeyDuplicate(key->handle); if (ctx->handle->signKey == NULL) { PyXmlSec_SetLastError("failed to duplicate key"); return -1; } return 0; } static const char PyXmlSec_SignatureContextRegisterId__doc__[] = \ "register_id(node, id_attr = 'ID', id_ns = None) -> None\n" "Registers new id.\n\n" ":param node: the pointer to XML node\n" ":type node: :class:`lxml.etree._Element`\n" ":param id_attr: the attribute\n" ":type id_attr: :class:`str`\n" ":param id_ns: the namespace (optional)\n" ":type id_ns: :class:`str` or :data:`None`"; static PyObject* PyXmlSec_SignatureContextRegisterId(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "node", "id_attr", "id_ns", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* id_attr = "ID"; const char* id_ns = NULL; xmlChar* name = NULL; xmlAttrPtr attr; xmlAttrPtr tmpAttr; PYXMLSEC_DEBUGF("%p: register id - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|sz:register_id", kwlist, PyXmlSec_LxmlElementConverter, &node, &id_attr, &id_ns)) { goto ON_FAIL; } if (id_ns != NULL) { attr = xmlHasNsProp(node->_c_node, XSTR(id_attr), XSTR(id_ns)); } else { attr = xmlHasProp(node->_c_node, XSTR(id_attr)); } if (attr == NULL || attr->children == NULL) { PyErr_SetString(PyXmlSec_Error, "missing attribute."); goto ON_FAIL; } name = xmlNodeListGetString(node->_c_node->doc, attr->children, 1); tmpAttr = xmlGetID(node->_c_node->doc, name); if (tmpAttr != attr) { if (tmpAttr != NULL) { PyErr_SetString(PyXmlSec_Error, "duplicated id."); goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; xmlAddID(NULL, node->_c_node->doc, name, attr); Py_END_ALLOW_THREADS; } xmlFree(name); PYXMLSEC_DEBUGF("%p: register id - ok", self); Py_RETURN_NONE; ON_FAIL: xmlFree(name); PYXMLSEC_DEBUGF("%p: register id - fail", self); return NULL; } static const char PyXmlSec_SignatureContextSign__doc__[] = \ "sign(node) -> None\n" "Signs according to the signature template.\n\n" ":param node: the pointer to :xml:`` node with signature template\n" ":type node: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_SignatureContextSign(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_LxmlElementPtr node = NULL; int rv; PYXMLSEC_DEBUGF("%p: sign - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:sign", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecDSigCtxSign(ctx->handle, node->_c_node); PYXMLSEC_DUMP(xmlSecDSigCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("failed to sign"); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: sign - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: sign - fail", self); return NULL; } static const char PyXmlSec_SignatureContextVerify__doc__[] = \ "verify(node) -> None\n" "Verifies according to the signature template.\n\n" ":param node: the pointer with :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: :data:`None` on success\n" ":raise VerificationError: on failure\n"; static PyObject* PyXmlSec_SignatureContextVerify(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_LxmlElementPtr node = NULL; int rv; PYXMLSEC_DEBUGF("%p: verify - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:verify", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecDSigCtxVerify(ctx->handle, node->_c_node); PYXMLSEC_DUMP(xmlSecDSigCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("failed to verify"); goto ON_FAIL; } if (ctx->handle->status != xmlSecDSigStatusSucceeded) { PyErr_SetString(PyXmlSec_VerificationError, "Signature is invalid."); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: verify - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: verify - fail", self); return NULL; } // common helper for operations binary_verify and binary_sign static int PyXmlSec_ProcessSignBinary(PyXmlSec_SignatureContext* ctx, const xmlSecByte* data, xmlSecSize data_size, xmlSecTransformId method) { int rv; if (!(method->usage & xmlSecTransformUsageSignatureMethod)) { PyErr_SetString(PyXmlSec_Error, "incompatible signature method"); return -1; } if (ctx->handle->signKey == NULL) { PyErr_SetString(PyXmlSec_Error, "Sign key is not specified."); return -1; } if (ctx->handle->signMethod != NULL) { PYXMLSEC_DEBUGF("%p: signMethod: %p", ctx, ctx->handle->signMethod); PyErr_SetString(PyXmlSec_Error, "Signature context already used; it is designed for one use only."); return -1; } ctx->handle->signMethod = xmlSecTransformCtxCreateAndAppend(&(ctx->handle->transformCtx), method); if (ctx->handle->signMethod == NULL) { PyXmlSec_SetLastError("could not create signature transform."); return -1; } ctx->handle->signMethod->operation = ctx->handle->operation; xmlSecTransformSetKeyReq(ctx->handle->signMethod, &(ctx->handle->keyInfoReadCtx.keyReq)); rv = xmlSecKeyMatch(ctx->handle->signKey, NULL, &(ctx->handle->keyInfoReadCtx.keyReq)); if (rv != 1) { PyXmlSec_SetLastError("inappropriate key type."); return -1; } rv = xmlSecTransformSetKey(ctx->handle->signMethod, ctx->handle->signKey); if (rv < 0) { PyXmlSec_SetLastError("cannot set key."); return -1; } ctx->handle->transformCtx.result = NULL; ctx->handle->transformCtx.status = xmlSecTransformStatusNone; Py_BEGIN_ALLOW_THREADS; rv = xmlSecTransformCtxBinaryExecute(&(ctx->handle->transformCtx), data, data_size); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("failed to transform."); return -1; } ctx->handle->result = ctx->handle->transformCtx.result; return 0; } static const char PyXmlSec_SignatureContextSignBinary__doc__[] = \ "sign_binary(bytes, transform) -> bytes\n" "Signs binary data ``data`` with algorithm ``transform``.\n\n" ":param bytes: the binary data\n" ":type bytes: :class:`bytes`\n" ":param transform: the signature algorithm\n" ":type transform: :class:`__Transform`\n" ":return: the signature\n" ":rtype: :class:`bytes`"; static PyObject* PyXmlSec_SignatureContextSignBinary(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "bytes", "transform", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_Transform* transform = NULL; const char* data = NULL; Py_ssize_t data_size = 0; PYXMLSEC_DEBUGF("%p: sign_binary - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#O!:sign_binary", kwlist, &data, &data_size, PyXmlSec_TransformType, &transform)) { goto ON_FAIL; } ctx->handle->operation = xmlSecTransformOperationSign; if (PyXmlSec_ProcessSignBinary(ctx, (const xmlSecByte*)data, (xmlSecSize)data_size, transform->id) != 0) { goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: sign_binary - ok", self); return PyBytes_FromStringAndSize( (const char*)xmlSecBufferGetData(ctx->handle->result), (Py_ssize_t)xmlSecBufferGetSize(ctx->handle->result) ); ON_FAIL: PYXMLSEC_DEBUGF("%p: sign_binary - fail", self); return NULL; } static const char PyXmlSec_SignatureContextVerifyBinary__doc__[] = \ "verify_binary(bytes, transform, signature) -> None\n" "Verifies signature for binary data.\n\n" ":param bytes: the binary data\n" ":type bytes: :class:`bytes`\n" ":param transform: the signature algorithm\n" ":type transform: :class:`__Transform`\n" ":param signature: the signature\n" ":type signature: :class:`bytes`\n" ":return: :data:`None` on success\n" ":raise VerificationError: on failure"; static PyObject* PyXmlSec_SignatureContextVerifyBinary(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "bytes", "transform", "signature", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_Transform* transform = NULL; const char* data = NULL; Py_ssize_t data_size = 0; const char* sign = NULL; Py_ssize_t sign_size = 0; int rv; PYXMLSEC_DEBUGF("%p: verify binary - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#O!s#:verify_binary", kwlist, &data, &data_size, PyXmlSec_TransformType, &transform, &sign, &sign_size)) { goto ON_FAIL; } ctx->handle->operation = xmlSecTransformOperationVerify; if (PyXmlSec_ProcessSignBinary(ctx, (const xmlSecByte*)data, (xmlSecSize)data_size, transform->id) != 0) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecTransformVerify(ctx->handle->signMethod, (const xmlSecByte*)sign, (xmlSecSize)sign_size, &(ctx->handle->transformCtx)); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError2(PyXmlSec_VerificationError, "Cannot verify signature."); goto ON_FAIL; } if (ctx->handle->signMethod->status != xmlSecTransformStatusOk) { PyXmlSec_SetLastError2(PyXmlSec_VerificationError, "Signature is invalid."); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: verify binary - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: verify binary - fail", self); return NULL; } static const char PyXmlSec_SignatureContextEnableReferenceTransform__doc__[] = \ "enable_reference_transform(transform) -> None\n" "Enables use of ``transform`` as reference transform.\n\n" ".. note:: by default, all transforms are enabled. The first call of " ":meth:`~SignatureContext.enable_reference_transform` will switch to explicitly enabled transforms.\n\n" ":param transform: the transform klass.\n" ":type transform: :class:`__Transform`"; static PyObject* PyXmlSec_SignatureContextEnableReferenceTransform(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "transform", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_Transform* transform = NULL; int rv; PYXMLSEC_DEBUGF("%p: enable_reference_transform - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:enable_reference_transform", kwlist, PyXmlSec_TransformType, &transform)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecDSigCtxEnableReferenceTransform(ctx->handle, transform->id); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot enable reference transform."); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: enable_reference_transform - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: enable_reference_transform - fail", self); return NULL; } static const char PyXmlSec_SignatureContextEnableSignatureTransform__doc__[] = \ "enable_signature_transform(transform) -> None\n" "Enables use of ``transform`` as signature transform.\n\n" ".. note:: by default, all transforms are enabled. The first call of " ":meth:`~SignatureContext.enable_signature_transform` will switch to explicitly enabled transforms.\n\n" ":param transform: the transform klass.\n" ":type transform: :class:`__Transform`\n"; static PyObject* PyXmlSec_SignatureContextEnableSignatureTransform(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "transform", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyXmlSec_Transform* transform = NULL; int rv; PYXMLSEC_DEBUGF("%p: enable_signature_transform - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:enable_signature_transform", kwlist, PyXmlSec_TransformType, &transform)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecDSigCtxEnableSignatureTransform(ctx->handle, transform->id); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot enable signature transform."); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: enable_signature_transform - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: enable_signature_transform - fail", self); return NULL; } static const char PyXmlSec_SignatureContextSetEnabledKeyData__doc__[] = \ "set_enabled_key_data(keydata_list) -> None\n" "Adds selected :class:`__KeyData` to the list of enabled key data list.\n\n" ":param keydata_list: the list\n" ":type keydata_list: :class:`list` of :class:`__KeyData`"; static PyObject* PyXmlSec_SignatureContextSetEnabledKeyData(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "keydata_list", NULL}; PyXmlSec_SignatureContext* ctx = (PyXmlSec_SignatureContext*)self; PyObject* keydata_list = NULL; PyObject* iter = NULL; PyObject* item = NULL; xmlSecPtrListPtr enabled_list; PYXMLSEC_DEBUGF("%p: set_enabled_key_data - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:set_enabled_key_data", kwlist, &keydata_list)) { goto ON_FAIL; } if ((iter = PyObject_GetIter(keydata_list)) == NULL) goto ON_FAIL; enabled_list = &(ctx->handle->keyInfoReadCtx.enabledKeyData); xmlSecPtrListEmpty(enabled_list); while ((item = PyIter_Next(iter)) != NULL) { if (!PyObject_IsInstance(item, (PyObject*)PyXmlSec_KeyDataType)) { PyErr_SetString(PyExc_TypeError, "expected list of KeyData constants."); goto ON_FAIL; } if (xmlSecPtrListAdd(enabled_list, (xmlSecPtr)((PyXmlSec_KeyData*)item)->id) < 0) { PyXmlSec_SetLastError("cannot set enabled key."); goto ON_FAIL; } Py_DECREF(item); } Py_DECREF(iter); PYXMLSEC_DEBUGF("%p: set_enabled_key_data - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: set_enabled_key_data - fail", self); Py_XDECREF(item); Py_XDECREF(iter); return NULL; } static PyGetSetDef PyXmlSec_SignatureContextGetSet[] = { { "key", (getter)PyXmlSec_SignatureContextKeyGet, (setter)PyXmlSec_SignatureContextKeySet, (char*)PyXmlSec_SignatureContextKey__doc__, NULL }, {NULL} /* Sentinel */ }; static PyMethodDef PyXmlSec_SignatureContextMethods[] = { { "register_id", (PyCFunction)PyXmlSec_SignatureContextRegisterId, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextRegisterId__doc__, }, { "sign", (PyCFunction)PyXmlSec_SignatureContextSign, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextSign__doc__ }, { "verify", (PyCFunction)PyXmlSec_SignatureContextVerify, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextVerify__doc__ }, { "sign_binary", (PyCFunction)PyXmlSec_SignatureContextSignBinary, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextSignBinary__doc__ }, { "verify_binary", (PyCFunction)PyXmlSec_SignatureContextVerifyBinary, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextVerifyBinary__doc__ }, { "enable_reference_transform", (PyCFunction)PyXmlSec_SignatureContextEnableReferenceTransform, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextEnableReferenceTransform__doc__ }, { "enable_signature_transform", (PyCFunction)PyXmlSec_SignatureContextEnableSignatureTransform, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextEnableSignatureTransform__doc__, }, { "set_enabled_key_data", (PyCFunction)PyXmlSec_SignatureContextSetEnabledKeyData, METH_VARARGS|METH_KEYWORDS, PyXmlSec_SignatureContextSetEnabledKeyData__doc__, }, {NULL, NULL} /* sentinel */ }; static PyTypeObject _PyXmlSec_SignatureContextType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".SignatureContext", /* tp_name */ sizeof(PyXmlSec_SignatureContext), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_SignatureContext__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ "XML Digital Signature implementation", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ PyXmlSec_SignatureContextMethods, /* tp_methods */ 0, /* tp_members */ PyXmlSec_SignatureContextGetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ PyXmlSec_SignatureContext__init__, /* tp_init */ 0, /* tp_alloc */ PyXmlSec_SignatureContext__new__, /* tp_new */ 0, /* tp_free */ }; PyTypeObject* PyXmlSec_SignatureContextType = &_PyXmlSec_SignatureContextType; int PyXmlSec_DSModule_Init(PyObject* package) { if (PyType_Ready(PyXmlSec_SignatureContextType) < 0) goto ON_FAIL; // since objects is created as static objects, need to increase refcount to prevent deallocate Py_INCREF(PyXmlSec_SignatureContextType); if (PyModule_AddObject(package, "SignatureContext", (PyObject*)PyXmlSec_SignatureContextType) < 0) goto ON_FAIL; return 0; ON_FAIL: return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1741731771.0 xmlsec-1.3.17/src/enc.c0000644000076500000240000005130214764133673013464 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "platform.h" #include "exception.h" #include "constants.h" #include "keys.h" #include "lxml.h" #include #include // Backwards compatibility with xmlsec 1.2 #ifndef XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH #define XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH 0x00008000 #endif typedef struct { PyObject_HEAD xmlSecEncCtxPtr handle; PyXmlSec_KeysManager* manager; } PyXmlSec_EncryptionContext; static PyObject* PyXmlSec_EncryptionContext__new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)PyType_GenericNew(type, args, kwargs); PYXMLSEC_DEBUGF("%p: new enc context", ctx); if (ctx != NULL) { ctx->handle = NULL; ctx->manager = NULL; } return (PyObject*)(ctx); } static int PyXmlSec_EncryptionContext__init__(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "manager", NULL}; PyXmlSec_KeysManager* manager = NULL; PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PYXMLSEC_DEBUGF("%p: init enc context", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:__init__", kwlist, PyXmlSec_KeysManagerConvert, &manager)) { goto ON_FAIL; } ctx->handle = xmlSecEncCtxCreate(manager != NULL ? manager->handle : NULL); if (ctx->handle == NULL) { PyXmlSec_SetLastError("failed to create the encryption context"); goto ON_FAIL; } ctx->manager = manager; PYXMLSEC_DEBUGF("%p: init enc context - ok, manager - %p", self, manager); // xmlsec 1.3 changed the key search to strict mode, causing various examples // in the docs to fail. For backwards compatibility, this changes it back to // lax mode for now. ctx->handle->keyInfoReadCtx.flags = XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH; ctx->handle->keyInfoWriteCtx.flags = XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH; return 0; ON_FAIL: PYXMLSEC_DEBUGF("%p: init enc context - failed", self); Py_XDECREF(manager); return -1; } static void PyXmlSec_EncryptionContext__del__(PyObject* self) { PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PYXMLSEC_DEBUGF("%p: delete enc context", self); if (ctx->handle != NULL) { xmlSecEncCtxDestroy(ctx->handle); } // release manager object Py_XDECREF(ctx->manager); Py_TYPE(self)->tp_free(self); } static const char PyXmlSec_EncryptionContextKey__doc__[] = "Encryption key.\n"; static PyObject* PyXmlSec_EncryptionContextKeyGet(PyObject* self, void* closure) { PyXmlSec_EncryptionContext* ctx = ((PyXmlSec_EncryptionContext*)self); PyXmlSec_Key* key; if (ctx->handle->encKey == NULL) { Py_RETURN_NONE; } key = PyXmlSec_NewKey(); key->handle = ctx->handle->encKey; key->is_own = 0; return (PyObject*)key; } static int PyXmlSec_EncryptionContextKeySet(PyObject* self, PyObject* value, void* closure) { PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PyXmlSec_Key* key; PYXMLSEC_DEBUGF("%p, %p", self, value); if (value == NULL) { // key deletion if (ctx->handle->encKey != NULL) { xmlSecKeyDestroy(ctx->handle->encKey); ctx->handle->encKey = NULL; } return 0; } if (!PyObject_IsInstance(value, (PyObject*)PyXmlSec_KeyType)) { PyErr_SetString(PyExc_TypeError, "instance of *xmlsec.Key* expected."); return -1; } key = (PyXmlSec_Key*)value; if (key->handle == NULL) { PyErr_SetString(PyExc_TypeError, "empty key."); return -1; } if (ctx->handle->encKey != NULL) { xmlSecKeyDestroy(ctx->handle->encKey); } ctx->handle->encKey = xmlSecKeyDuplicate(key->handle); if (ctx->handle->encKey == NULL) { PyXmlSec_SetLastError("failed to duplicate key"); return -1; } return 0; } static const char PyXmlSec_EncryptionContextReset__doc__[] = \ "reset() -> None\n"\ "Reset this context, user settings are not touched.\n"; static PyObject* PyXmlSec_EncryptionContextReset(PyObject* self, PyObject* args, PyObject* kwargs) { PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PYXMLSEC_DEBUGF("%p: reset context - start", self); Py_BEGIN_ALLOW_THREADS; xmlSecEncCtxReset(ctx->handle); PYXMLSEC_DUMP(xmlSecEncCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; PYXMLSEC_DEBUGF("%p: reset context - ok", self); Py_RETURN_NONE; } static const char PyXmlSec_EncryptionContextEncryptBinary__doc__[] = \ "encrypt_binary(template, data) -> lxml.etree._Element\n" "Encrypts binary ``data`` according to ``EncryptedData`` template ``template``.\n\n" ".. note:: ``template`` is modified in place.\n\n" ":param template: the pointer to :xml:`` template node\n" ":type template: :class:`lxml.etree._Element`\n" ":param data: the data\n" ":type data: :class:`bytes`\n" ":return: the resulting :xml:`` subtree\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_EncryptionContextEncryptBinary(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "template", "data", NULL}; PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PyXmlSec_LxmlElementPtr template = NULL; const char* data = NULL; Py_ssize_t data_size = 0; int rv; PYXMLSEC_DEBUGF("%p: encrypt_binary - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&s#:encrypt_binary", kwlist, PyXmlSec_LxmlElementConverter, &template, &data, &data_size)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecEncCtxBinaryEncrypt(ctx->handle, template->_c_node, (const xmlSecByte*)data, (xmlSecSize)data_size); PYXMLSEC_DUMP(xmlSecEncCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("failed to encrypt binary"); goto ON_FAIL; } Py_INCREF(template); PYXMLSEC_DEBUGF("%p: encrypt_binary - ok", self); return (PyObject*)template; ON_FAIL: PYXMLSEC_DEBUGF("%p: encrypt_binary - fail", self); return NULL; } // release the replaced nodes in a way safe for `lxml` static void PyXmlSec_ClearReplacedNodes(xmlSecEncCtxPtr ctx, PyXmlSec_LxmlDocumentPtr doc) { PyXmlSec_LxmlElementPtr elem; // release the replaced nodes in a way safe for `lxml` xmlNodePtr n = ctx->replacedNodeList; xmlNodePtr nn; while (n != NULL) { PYXMLSEC_DEBUGF("clear replaced node %p", n); nn = n->next; // if n has references, it will not be deleted elem = (PyXmlSec_LxmlElementPtr)PyXmlSec_elementFactory(doc, n); if (NULL == elem) xmlFreeNode(n); else Py_DECREF(elem); n = nn; } ctx->replacedNodeList = NULL; } static const char PyXmlSec_EncryptionContextEncryptXml__doc__[] = \ "encrypt_xml(template, node) -> lxml.etree._Element\n" "Encrypts ``node`` using ``template``.\n\n" ".. note:: The ``\"Type\"`` attribute of ``template`` decides whether ``node`` itself " "(``http://www.w3.org/2001/04/xmlenc#Element``) or its content (``http://www.w3.org/2001/04/xmlenc#Content``) is encrypted.\n" " It must have one of these two values (or an exception is raised).\n" " The operation modifies the tree and removes replaced nodes.\n\n" ":param template: the pointer to :xml:`` template node\n\n" ":type template: :class:`lxml.etree._Element`\n" ":param node: the pointer to node for encryption\n\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_EncryptionContextEncryptXml(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "template", "node", NULL}; PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PyXmlSec_LxmlElementPtr template = NULL; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr xnew_node = NULL; xmlChar* tmpType = NULL; int rv = 0; PYXMLSEC_DEBUGF("%p: encrypt_xml - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:encrypt_xml", kwlist, PyXmlSec_LxmlElementConverter, &template, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } tmpType = xmlGetProp(template->_c_node, XSTR("Type")); if (tmpType == NULL || !(xmlStrEqual(tmpType, xmlSecTypeEncElement) || xmlStrEqual(tmpType, xmlSecTypeEncContent))) { PyErr_SetString(PyXmlSec_Error, "unsupported `Type`, it should be `element` or `content`"); goto ON_FAIL; } // `xmlSecEncCtxXmlEncrypt` will replace the subtree rooted // at `node._c_node` or its children by an extended subtree rooted at "c_node". // We set `XMLSEC_ENC_RETURN_REPLACED_NODE` to prevent deallocation // of the replaced node. This is important as `node` is still referencing it ctx->handle->flags = XMLSEC_ENC_RETURN_REPLACED_NODE; // try to do all actions whithin single python-free section // rv has the following codes, 1 - failed to copy node, -1 - op failed, 0 - success Py_BEGIN_ALLOW_THREADS; if (template->_doc->_c_doc != node->_doc->_c_doc) { // `xmlSecEncCtxEncrypt` expects *template* to belong to the document of *node* // if this is not the case, we copy the `libxml2` subtree there. xnew_node = xmlDocCopyNode(template->_c_node, node->_doc->_c_doc, 1); // recursive if (xnew_node == NULL) { rv = 1; } } if (rv == 0 && xmlSecEncCtxXmlEncrypt(ctx->handle, xnew_node != NULL ? xnew_node: template->_c_node, node->_c_node) < 0) { rv = -1; if (xnew_node != NULL) { xmlFreeNode(xnew_node); xnew_node = NULL; } } PYXMLSEC_DUMP(xmlSecEncCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; PyXmlSec_ClearReplacedNodes(ctx->handle, node->_doc); if (NULL != PyErr_Occurred()) { goto ON_FAIL; } if (rv != 0) { if (rv > 0) { PyErr_SetString(PyXmlSec_InternalError, "could not copy template tree"); } else { PyXmlSec_SetLastError("failed to encrypt xml"); } goto ON_FAIL; } xmlFree(tmpType); PYXMLSEC_DEBUGF("%p: encrypt_xml - ok", self); return (PyObject*)PyXmlSec_elementFactory(node->_doc, xnew_node != NULL ? xnew_node : template->_c_node); ON_FAIL: PYXMLSEC_DEBUGF("%p: encrypt_xml - fail", self); xmlFree(tmpType); return NULL; } static const char PyXmlSec_EncryptionContextEncryptUri__doc__[] = \ "encrypt_uri(template, uri) -> lxml.etree._Element\n" "Encrypts binary data obtained from ``uri`` according to ``template``.\n\n" ".. note:: ``template`` is modified in place.\n\n" ":param template: the pointer to :xml:`` template node\n" ":type template: :class:`lxml.etree._Element`\n" ":param uri: the URI\n" ":type uri: :class:`str`\n" ":return: the resulting :xml:`` subtree\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_EncryptionContextEncryptUri(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "template", "uri", NULL}; PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PyXmlSec_LxmlElementPtr template = NULL; const char* uri = NULL; int rv; PYXMLSEC_DEBUGF("%p: encrypt_uri - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&s:encrypt_uri", kwlist, PyXmlSec_LxmlElementConverter, &template, &uri)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecEncCtxUriEncrypt(ctx->handle, template->_c_node, (const xmlSecByte*)uri); PYXMLSEC_DUMP(xmlSecEncCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("failed to encrypt URI"); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: encrypt_uri - ok", self); Py_INCREF(template); return (PyObject*)template; ON_FAIL: PYXMLSEC_DEBUGF("%p: encrypt_uri - fail", self); return NULL; } static const char PyXmlSec_EncryptionContextDecrypt__doc__[] = \ "decrypt(node)\n" "Decrypts ``node`` (an ``EncryptedData`` or ``EncryptedKey`` element) and returns the result. " "The decryption may result in binary data or an XML subtree. " "In the former case, the binary data is returned. In the latter case, " "the input tree is modified and a reference to the decrypted XML subtree is returned.\n" "If the operation modifies the tree, it removes replaced nodes.\n\n" ":param node: the pointer to :xml:`` or :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: depends on input parameters\n" ":rtype: :class:`lxml.etree._Element` or :class:`bytes`"; static PyObject* PyXmlSec_EncryptionContextDecrypt(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_EncryptionContext* ctx = (PyXmlSec_EncryptionContext*)self; PyXmlSec_LxmlElementPtr node = NULL; PyObject* node_num = NULL; PyObject* parent = NULL; PyObject* tmp; xmlNodePtr root; xmlNodePtr xparent; int rv; xmlChar* ttype; int notContent; PYXMLSEC_DEBUGF("%p: decrypt - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:decrypt", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } xparent = node->_c_node->parent; if (xparent != NULL && !PyXmlSec_IsElement(xparent)) { xparent = NULL; } if (xparent != NULL) { parent = (PyObject*)PyXmlSec_elementFactory(node->_doc, xparent); if (parent == NULL) { PyErr_SetString(PyXmlSec_InternalError, "failed to construct parent"); goto ON_FAIL; } // get index of node node_num = PyObject_CallMethod(parent, "index", "O", node); PYXMLSEC_DEBUGF("parent: %p, %p", parent, node_num); } Py_BEGIN_ALLOW_THREADS; ctx->handle->flags = XMLSEC_ENC_RETURN_REPLACED_NODE; ctx->handle->mode = xmlSecCheckNodeName(node->_c_node, xmlSecNodeEncryptedKey, xmlSecEncNs) ? xmlEncCtxModeEncryptedKey : xmlEncCtxModeEncryptedData; PYXMLSEC_DEBUGF("mode: %d", ctx->handle->mode); rv = xmlSecEncCtxDecrypt(ctx->handle, node->_c_node); PYXMLSEC_DUMP(xmlSecEncCtxDebugDump, ctx->handle); Py_END_ALLOW_THREADS; PyXmlSec_ClearReplacedNodes(ctx->handle, node->_doc); if (rv < 0) { PyXmlSec_SetLastError("failed to decrypt"); goto ON_FAIL; } if (!ctx->handle->resultReplaced) { Py_XDECREF(node_num); Py_XDECREF(parent); PYXMLSEC_DEBUGF("%p: binary.decrypt - ok", self); return PyBytes_FromStringAndSize( (const char*)xmlSecBufferGetData(ctx->handle->result), (Py_ssize_t)xmlSecBufferGetSize(ctx->handle->result) ); } if (xparent != NULL) { ttype = xmlGetProp(node->_c_node, XSTR("Type")); notContent = (ttype == NULL || !xmlStrEqual(ttype, xmlSecTypeEncContent)); xmlFree(ttype); if (notContent) { tmp = PyObject_GetItem(parent, node_num); if (tmp == NULL) goto ON_FAIL; Py_DECREF(parent); parent = tmp; } Py_DECREF(node_num); PYXMLSEC_DEBUGF("%p: parent.decrypt - ok", self); return parent; } // root has been replaced root = xmlDocGetRootElement(node->_doc->_c_doc); if (root == NULL) { PyErr_SetString(PyXmlSec_Error, "decryption resulted in a non well formed document"); goto ON_FAIL; } Py_XDECREF(node_num); Py_XDECREF(parent); PYXMLSEC_DEBUGF("%p: decrypt - ok", self); return (PyObject*)PyXmlSec_elementFactory(node->_doc, root); ON_FAIL: PYXMLSEC_DEBUGF("%p: decrypt - fail", self); Py_XDECREF(node_num); Py_XDECREF(parent); return NULL; } static PyGetSetDef PyXmlSec_EncryptionContextGetSet[] = { { "key", (getter)PyXmlSec_EncryptionContextKeyGet, (setter)PyXmlSec_EncryptionContextKeySet, (char*)PyXmlSec_EncryptionContextKey__doc__, NULL }, {NULL} /* Sentinel */ }; static PyMethodDef PyXmlSec_EncryptionContextMethods[] = { { "reset", (PyCFunction)PyXmlSec_EncryptionContextReset, METH_NOARGS, PyXmlSec_EncryptionContextReset__doc__, }, { "encrypt_binary", (PyCFunction)PyXmlSec_EncryptionContextEncryptBinary, METH_VARARGS|METH_KEYWORDS, PyXmlSec_EncryptionContextEncryptBinary__doc__, }, { "encrypt_xml", (PyCFunction)PyXmlSec_EncryptionContextEncryptXml, METH_VARARGS|METH_KEYWORDS, PyXmlSec_EncryptionContextEncryptXml__doc__ }, { "encrypt_uri", (PyCFunction)PyXmlSec_EncryptionContextEncryptUri, METH_VARARGS|METH_KEYWORDS, PyXmlSec_EncryptionContextEncryptUri__doc__ }, { "decrypt", (PyCFunction)PyXmlSec_EncryptionContextDecrypt, METH_VARARGS|METH_KEYWORDS, PyXmlSec_EncryptionContextDecrypt__doc__ }, {NULL, NULL} /* sentinel */ }; static PyTypeObject _PyXmlSec_EncryptionContextType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".EncryptionContext", /* tp_name */ sizeof(PyXmlSec_EncryptionContext), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_EncryptionContext__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ "XML Encryption implementation", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ PyXmlSec_EncryptionContextMethods, /* tp_methods */ 0, /* tp_members */ PyXmlSec_EncryptionContextGetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ PyXmlSec_EncryptionContext__init__, /* tp_init */ 0, /* tp_alloc */ PyXmlSec_EncryptionContext__new__, /* tp_new */ 0 /* tp_free */ }; PyTypeObject* PyXmlSec_EncryptionContextType = &_PyXmlSec_EncryptionContextType; int PyXmlSec_EncModule_Init(PyObject* package) { if (PyType_Ready(PyXmlSec_EncryptionContextType) < 0) goto ON_FAIL; PYXMLSEC_DEBUGF("%p", PyXmlSec_EncryptionContextType); // since objects is created as static objects, need to increase refcount to prevent deallocate Py_INCREF(PyXmlSec_EncryptionContextType); if (PyModule_AddObject(package, "EncryptionContext", (PyObject*)PyXmlSec_EncryptionContextType) < 0) goto ON_FAIL; return 0; ON_FAIL: return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/exception.c0000644000076500000240000001715314441560770014715 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "exception.h" #include "utils.h" #include #include #include #include // default error class PyObject* PyXmlSec_Error; PyObject* PyXmlSec_InternalError; PyObject* PyXmlSec_VerificationError; #if PY_MINOR_VERSION >= 7 static Py_tss_t PyXmlSec_LastErrorKey; #else static int PyXmlSec_LastErrorKey = 0; #endif static int PyXmlSec_PrintErrorMessage = 0; typedef struct { const xmlChar* file; const xmlChar* func; const xmlChar* object; const xmlChar* subject; const xmlChar* msg; int line; int reason; } PyXmlSec_ErrorHolder; PyXmlSec_ErrorHolder* PyXmlSec_ErrorHolderCreate(const char* file, int line, const char* func, const char* object, const char* subject, int reason, const char* msg) { PyXmlSec_ErrorHolder* h = (PyXmlSec_ErrorHolder*)xmlMalloc(sizeof(PyXmlSec_ErrorHolder)); // file and func is __FILE__ and __FUNCTION__ macro, so it can be stored as is. h->file = XSTR(file); h->line = line; h->func = XSTR(func); h->reason = reason; // there is no guarantee that object and subject will not be deallocate after exit from function, // so make a copy // xmlCharStrdup returns NULL if arg is NULL h->object = xmlCharStrdup(object); h->subject = xmlCharStrdup(subject); h->msg = xmlCharStrdup(msg); PYXMLSEC_DEBUGF("new error %p", h); return h; } void PyXmlSec_ErrorHolderFree(PyXmlSec_ErrorHolder* h) { if (h != NULL) { PYXMLSEC_DEBUGF("free error %p", h); xmlFree((void*)(h->object)); xmlFree((void*)(h->subject)); xmlFree((void*)(h->msg)); xmlFree((void*)(h)); } } // saves new error in TLS and returns previous static PyXmlSec_ErrorHolder* PyXmlSec_ExchangeLastError(PyXmlSec_ErrorHolder* e) { PyXmlSec_ErrorHolder* v; int r; #if PY_MINOR_VERSION >= 7 if (PyThread_tss_is_created(&PyXmlSec_LastErrorKey) == 0) { #else if (PyXmlSec_LastErrorKey == 0) { #endif PYXMLSEC_DEBUG("WARNING: There is no error key."); PyXmlSec_ErrorHolderFree(e); return NULL; } // get_key_value and set_key_value are gil free #if PY_MINOR_VERSION >= 7 v = (PyXmlSec_ErrorHolder*)PyThread_tss_get(&PyXmlSec_LastErrorKey); //PyThread_tss_delete(&PyXmlSec_LastErrorKey); r = PyThread_tss_set(&PyXmlSec_LastErrorKey, (void*)e); #else v = (PyXmlSec_ErrorHolder*)PyThread_get_key_value(PyXmlSec_LastErrorKey); PyThread_delete_key_value(PyXmlSec_LastErrorKey); r = PyThread_set_key_value(PyXmlSec_LastErrorKey, (void*)e); #endif PYXMLSEC_DEBUGF("set_key_value returns %d", r); return v; } // xmlsec library error callback static void PyXmlSec_ErrorCallback(const char* file, int line, const char* func, const char* object, const char* subject, int reason, const char* msg) { // TODO do not allocate error object each time. PyXmlSec_ErrorHolderFree(PyXmlSec_ExchangeLastError(PyXmlSec_ErrorHolderCreate(file, line, func, object, subject, reason, msg))); if (PyXmlSec_PrintErrorMessage) { const char* error_msg = NULL; xmlSecSize i; for (i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) { if(xmlSecErrorsGetCode(i) == reason) { error_msg = xmlSecErrorsGetMsg(i); break; } } fprintf(stderr, "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n", (func != NULL) ? func : "unknown", (file != NULL) ? file : "unknown", line, (object != NULL) ? object : "unknown", (subject != NULL) ? subject : "unknown", reason, (error_msg != NULL) ? error_msg : "", (msg != NULL) ? msg : ""); } } // pops the last error which was occurred in current thread // the gil should be acquired static PyObject* PyXmlSec_GetLastError(PyObject* type, const char* msg) { PyXmlSec_ErrorHolder* h = PyXmlSec_ExchangeLastError(NULL); PyObject* exc; if (h == NULL) { return NULL; } exc = PyObject_CallFunction(type, "is", h->reason, msg); if (exc == NULL) goto ON_FAIL; PyXmlSec_SetLongAttr(exc, "code", h->reason); PyXmlSec_SetStringAttr(exc, "message", msg); PyXmlSec_SetStringAttr(exc, "details", (const char*)xmlSecErrorsSafeString(h->msg)); PyXmlSec_SetStringAttr(exc, "file", (const char*)xmlSecErrorsSafeString(h->file)); PyXmlSec_SetLongAttr(exc, "line", h->line); PyXmlSec_SetStringAttr(exc, "func", (const char*)xmlSecErrorsSafeString(h->func)); PyXmlSec_SetStringAttr(exc, "object", (const char*)xmlSecErrorsSafeString(h->object)); PyXmlSec_SetStringAttr(exc, "subject", (const char*)xmlSecErrorsSafeString(h->subject)); ON_FAIL: PyXmlSec_ErrorHolderFree(h); return exc; } void PyXmlSec_SetLastError2(PyObject* type, const char* msg) { PyObject* last = PyXmlSec_GetLastError(type, msg); if (last == NULL) { PYXMLSEC_DEBUG("WARNING: no xmlsec error"); last = PyObject_CallFunction(PyXmlSec_InternalError, "is", (int)-1, msg); if (last == NULL) { return; } } PyErr_SetObject(type, last); Py_DECREF(last); } void PyXmlSec_SetLastError(const char* msg) { PyXmlSec_SetLastError2(PyXmlSec_Error, msg); } void PyXmlSec_ClearError(void) { PyXmlSec_ErrorHolderFree(PyXmlSec_ExchangeLastError(NULL)); } void PyXmlSecEnableDebugTrace(int v) { PyXmlSec_PrintErrorMessage = v; } void PyXmlSec_InstallErrorCallback() { #if PY_MINOR_VERSION >= 7 if (PyThread_tss_is_created(&PyXmlSec_LastErrorKey) != 0) { #else if (PyXmlSec_LastErrorKey != 0) { #endif xmlSecErrorsSetCallback(PyXmlSec_ErrorCallback); } } // initializes errors module int PyXmlSec_ExceptionsModule_Init(PyObject* package) { PyXmlSec_Error = NULL; PyXmlSec_InternalError = NULL; PyXmlSec_VerificationError = NULL; if ((PyXmlSec_Error = PyErr_NewExceptionWithDoc( STRINGIFY(MODULE_NAME) ".Error", "The common exception class.", PyExc_Exception, 0)) == NULL) goto ON_FAIL; if ((PyXmlSec_InternalError = PyErr_NewExceptionWithDoc( STRINGIFY(MODULE_NAME) ".InternalError", "The internal exception class.", PyXmlSec_Error, 0)) == NULL) goto ON_FAIL; if ((PyXmlSec_VerificationError = PyErr_NewExceptionWithDoc( STRINGIFY(MODULE_NAME) ".VerificationError", "The verification exception class.", PyXmlSec_Error, 0)) == NULL) goto ON_FAIL; if (PyModule_AddObject(package, "Error", PyXmlSec_Error) < 0) goto ON_FAIL; if (PyModule_AddObject(package, "InternalError", PyXmlSec_InternalError) < 0) goto ON_FAIL; if (PyModule_AddObject(package, "VerificationError", PyXmlSec_VerificationError) < 0) goto ON_FAIL; #if PY_MINOR_VERSION >= 7 if (PyThread_tss_create(&PyXmlSec_LastErrorKey) == 0) { PyXmlSec_InstallErrorCallback(); } #else PyXmlSec_LastErrorKey = PyThread_create_key(); PyXmlSec_InstallErrorCallback(); #endif return 0; ON_FAIL: Py_XDECREF(PyXmlSec_Error); Py_XDECREF(PyXmlSec_InternalError); Py_XDECREF(PyXmlSec_VerificationError); return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/exception.h0000644000076500000240000000172614441560770014721 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_EXCEPTIONS_H__ #define __PYXMLSEC_EXCEPTIONS_H__ #include "platform.h" extern PyObject* PyXmlSec_Error; extern PyObject* PyXmlSec_InternalError; extern PyObject* PyXmlSec_VerificationError; void PyXmlSec_SetLastError(const char* msg); void PyXmlSec_SetLastError2(PyObject* type, const char* msg); void PyXmlSec_ClearError(void); void PyXmlSecEnableDebugTrace(int); void PyXmlSec_InstallErrorCallback(); #endif //__PYXMLSEC_EXCEPTIONS_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712131861.0 xmlsec-1.3.17/src/keys.c0000644000076500000240000007611214603207425013665 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "constants.h" #include "exception.h" #include "keys.h" #include "utils.h" #include static PyObject* PyXmlSec_Key__new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyXmlSec_Key* key = (PyXmlSec_Key*)PyType_GenericNew(type, args, kwargs); PYXMLSEC_DEBUGF("%p: new key", key); if (key != NULL) { key->handle = NULL; key->is_own = 0; } return (PyObject*)(key); } static void PyXmlSec_Key__del__(PyObject* self) { PyXmlSec_Key* key = (PyXmlSec_Key*)self; PYXMLSEC_DEBUGF("%p: delete key", self); if (key->is_own) { PYXMLSEC_DEBUGF("%p: delete handle - %p", self, key->handle); xmlSecKeyDestroy(key->handle); } Py_TYPE(self)->tp_free(self); } static PyXmlSec_Key* PyXmlSec_NewKey1(PyTypeObject* type) { return (PyXmlSec_Key*)PyObject_CallFunctionObjArgs((PyObject*)type, NULL); } static PyObject* PyXmlSec_Key__copy__(PyObject* self) { xmlSecKeyPtr handle = ((PyXmlSec_Key*)self)->handle; PyXmlSec_Key* key2; PYXMLSEC_DEBUGF("%p: copy key", self); key2 = PyXmlSec_NewKey1(Py_TYPE(self)); if (handle == NULL || key2 == NULL) { PYXMLSEC_DEBUGF("%p: null key", self); return (PyObject*)key2; } Py_BEGIN_ALLOW_THREADS; key2->handle = xmlSecKeyDuplicate(handle); Py_END_ALLOW_THREADS; if (key2->handle == NULL) { PYXMLSEC_DEBUGF("%p: failed to duplicate key", self); PyXmlSec_SetLastError("cannot duplicate key"); Py_DECREF(key2); return NULL; } key2->is_own = 1; return (PyObject*)key2; } static const char PyXmlSec_KeyFromMemory__doc__[] = \ "from_memory(data, format, password = None) -> xmlsec.Key\n" "Loads PKI key from memory.\n\n" ":param data: the binary key data\n" ":type data: :class:`str` or :class:`bytes`\n" ":param format: the key file format\n" ":type format: :class:`int`\n" ":param password: the key file password (optional)\n" ":type password: :class:`str` or :data:`None`\n" ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyFromMemory(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "data", "format", "password", NULL}; const char* data = NULL; Py_ssize_t data_size = 0; const char* password = NULL; unsigned int format = 0; PyXmlSec_Key* key = NULL; PYXMLSEC_DEBUG("load key from memory - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#I|z:from_memory", kwlist, &data, &data_size, &format, &password)) { goto ON_FAIL; } if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; key->handle = xmlSecCryptoAppKeyLoadMemory((const xmlSecByte*)data, (xmlSecSize)data_size, format, password, NULL, NULL); Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot load key"); goto ON_FAIL; } key->is_own = 1; PYXMLSEC_DEBUG("load key from memory - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("load key from memory - fail"); Py_XDECREF(key); return NULL; } static const char PyXmlSec_KeyFromFile__doc__[] = \ "from_file(file, format, password = None) -> xmlsec.Key\n" "Loads PKI key from a file.\n\n" ":param file: the file object or file path\n" ":type file: :class:`str`, :class:`bytes`, any :class:`~os.PathLike`, " ":class:`~typing.BinaryIO` or :class:`~typing.TextIO`\n" ":param format: the key file format\n" ":type format: :class:`int`\n" ":param password: the key file password (optional)\n" ":type password: :class:`str` or :data:`None`\n" ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyFromFile(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "file", "format", "password", NULL}; PyObject* file = NULL; const char* password = NULL; unsigned int format = 0; PyXmlSec_Key* key = NULL; PyObject* bytes = NULL; int is_content = 0; const char* data = NULL; Py_ssize_t data_size = 0; PYXMLSEC_DEBUG("load key from file - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OI|z:from_file", kwlist, &file, &format, &password)) { goto ON_FAIL; } bytes = PyXmlSec_GetFilePathOrContent(file, &is_content); if (bytes == NULL) goto ON_FAIL; if (is_content == 1) { data = PyBytes_AsStringAndSize2(bytes, &data_size); } else { data = PyBytes_AsString(bytes); } if (data == NULL) goto ON_FAIL; if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; if (is_content) { key->handle = xmlSecCryptoAppKeyLoadMemory((const xmlSecByte*)data, (xmlSecSize)data_size, format, password, NULL, NULL); } else { #if XMLSEC_VERSION_HEX >= 0x10303 // from version 1.3.3 (inclusive) key->handle = xmlSecCryptoAppKeyLoadEx(data, xmlSecKeyDataTypePrivate, format, password, NULL, NULL); #else key->handle = xmlSecCryptoAppKeyLoad(data, format, password, NULL, NULL); #endif } Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot read key"); goto ON_FAIL; } key->is_own = 1; Py_DECREF(bytes); PYXMLSEC_DEBUG("load key from file - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("load key from file - fail"); Py_XDECREF(key); Py_XDECREF(bytes); return NULL; } static const char PyXmlSec_KeyFromEngine__doc__[] = \ "from_engine(engine_and_key_id) -> xmlsec.Key\n" "Loads PKI key from an engine.\n\n" ":param engine_and_key_id: engine and key id, i.e. 'pkcs11;pkcs11:token=XmlsecToken;object=XmlsecKey;pin-value=password'\n" ":type engine_and_key_id: :class:`str`, " ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyFromEngine(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = {"engine_and_key_id", NULL}; const char* engine_and_key_id = NULL; PyXmlSec_Key* key = NULL; PYXMLSEC_DEBUG("load key from engine - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:from_engine", kwlist, &engine_and_key_id)) { goto ON_FAIL; } if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; #if XMLSEC_VERSION_HEX >= 0x10303 // from version 1.3.3 (inclusive) key->handle = xmlSecCryptoAppKeyLoadEx(engine_and_key_id, xmlSecKeyDataTypePrivate, xmlSecKeyDataFormatEngine, NULL, xmlSecCryptoAppGetDefaultPwdCallback(), (void*)engine_and_key_id); #else key->handle = xmlSecCryptoAppKeyLoad(engine_and_key_id, xmlSecKeyDataFormatEngine, NULL, xmlSecCryptoAppGetDefaultPwdCallback(), (void*)engine_and_key_id); #endif Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot read key"); goto ON_FAIL; } key->is_own = 1; PYXMLSEC_DEBUG("load key from engine - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("load key from engine - fail"); Py_XDECREF(key); return NULL; } static const char PyXmlSec_KeyGenerate__doc__[] = \ "generate(klass, size, type) -> xmlsec.Key\n" "Generates key of kind ``klass`` with ``size`` and ``type``.\n\n" ":param klass: the requested key klass (rsa, dsa, aes, ...)\n" ":type klass: :class:`__KeyData`\n" ":param size: the new key size (in bits!)\n" ":type size: :class:`int`\n" ":param type: the new key type (session, permanent, ...)\n" ":type type: :class:`int`\n" ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyGenerate(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "klass", "size", "type", NULL}; PyXmlSec_KeyData* keydata = NULL; short unsigned int keysize = 0; unsigned int keytype = 0; PyXmlSec_Key* key = NULL; PYXMLSEC_DEBUG("generate new key - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!HI:generate", kwlist, PyXmlSec_KeyDataType, &keydata, &keysize, &keytype)) { goto ON_FAIL; } if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; key->handle = xmlSecKeyGenerate(keydata->id, keysize, keytype); Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot generate key"); goto ON_FAIL; } key->is_own = 1; PYXMLSEC_DEBUG("generate new key - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("generate new key - fail"); Py_XDECREF(key); return NULL; } static const char PyXmlSec_KeyFromBinaryFile__doc__[] = \ "from_binary_file(klass, filename) -> xmlsec.Key\n" "Loads (symmetric) key of kind ``klass`` from ``filename``.\n\n" ":param klass: the key value data klass\n" ":type klass: :class:`__KeyData`\n" ":param filename: the key binary filename\n" ":type filename: :class:`str`, :class:`bytes` or any :class:`~os.PathLike`\n" ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyFromBinaryFile(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "klass", "filename", NULL}; PyXmlSec_KeyData* keydata = NULL; PyObject* filepath = NULL; PyXmlSec_Key* key = NULL; const char* filename; PYXMLSEC_DEBUG("load symmetric key - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O&:from_binary_file", kwlist, PyXmlSec_KeyDataType, &keydata, PyUnicode_FSConverter, &filepath)) { goto ON_FAIL; } filename = PyBytes_AsString(filepath); if (filename == NULL) goto ON_FAIL; if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; key->handle = xmlSecKeyReadBinaryFile(keydata->id, filename); Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot read key"); goto ON_FAIL; } key->is_own = 1; Py_DECREF(filepath); PYXMLSEC_DEBUG("load symmetric key - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("load symmetric key - fail"); Py_XDECREF(key); Py_XDECREF(filepath); return NULL; } static const char PyXmlSec_KeyFromBinaryData__doc__[] = \ "from_binary_data(klass, data) -> xmlsec.Key\n" "Loads (symmetric) key of kind ``klass`` from ``data``.\n\n" ":param klass: the key value data klass\n" ":type klass: :class:`__KeyData`\n" ":param data: the key binary data\n" ":type data: :class:`str` or :class:`bytes`\n" ":return: pointer to newly created key\n" ":rtype: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeyFromBinaryData(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "klass", "data", NULL}; PyXmlSec_KeyData* keydata = NULL; const char* data = NULL; Py_ssize_t data_size = 0; PyXmlSec_Key* key = NULL; PYXMLSEC_DEBUG("load symmetric key from memory - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!s#:from_binary_data", kwlist, PyXmlSec_KeyDataType, &keydata, &data, &data_size)) { goto ON_FAIL; } if ((key = PyXmlSec_NewKey1((PyTypeObject*)self)) == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; key->handle = xmlSecKeyReadMemory(keydata->id, (const xmlSecByte*)data, (xmlSecSize)data_size); Py_END_ALLOW_THREADS; if (key->handle == NULL) { PyXmlSec_SetLastError("cannot read key"); goto ON_FAIL; } key->is_own = 1; PYXMLSEC_DEBUG("load symmetric key from memory - ok"); return (PyObject*)key; ON_FAIL: PYXMLSEC_DEBUG("load symmetric key from memory - fail"); Py_XDECREF(key); return NULL; } static const char PyXmlSec_KeyCertFromMemory__doc__[] = \ "load_cert_from_memory(data, format) -> None\n" "Loads certificate from memory.\n\n" ":param data: the certificate binary data\n" ":type data: :class:`str` or :class:`bytes`\n" ":param format: the certificate file format\n" ":type format: :class:`int`"; static PyObject* PyXmlSec_KeyCertFromMemory(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "data", "format", NULL}; PyXmlSec_Key* key = (PyXmlSec_Key*)self; const char* data = NULL; Py_ssize_t data_size = 0; unsigned int format = 0; PyObject* tmp = NULL; int rv = 0; PYXMLSEC_DEBUGF("%p: load certificate from memory - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#I:load_cert_from_memory", kwlist, &data, &data_size, &format)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecCryptoAppKeyCertLoadMemory(key->handle, (const xmlSecByte*)data, (xmlSecSize)data_size, format); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot load cert"); goto ON_FAIL; } Py_XDECREF(tmp); PYXMLSEC_DEBUGF("%p: load certificate from memory - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: load certificate from memory - fail", self); Py_XDECREF(tmp); return NULL; } static const char PyXmlSec_KeyCertFromFile__doc__[] = \ "load_cert_from_file(file, format) -> None\n" "Loads certificate from file.\n\n" ":param file: the file object or file path\n" ":type file: :class:`str`, :class:`bytes`, any :class:`~os.PathLike`, " ":class:`~typing.BinaryIO` or :class:`~typing.TextIO`\n" ":param format: the certificate file format\n" ":type format: :class:`int`"; static PyObject* PyXmlSec_KeyCertFromFile(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "file", "format", NULL}; PyXmlSec_Key* key = (PyXmlSec_Key*)self; PyObject* file = NULL; unsigned int format = 0; PyObject* bytes = NULL; int is_content = 0; const char* data = NULL; Py_ssize_t data_size = 0; int rv = 0; PYXMLSEC_DEBUGF("%p: load certificate from memory - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OI:load_cert_from_file", kwlist, &file, &format)) { goto ON_FAIL; } bytes = PyXmlSec_GetFilePathOrContent(file, &is_content); if (bytes == NULL) goto ON_FAIL; if (is_content == 1) { data = PyBytes_AsStringAndSize2(bytes, &data_size); } else { data = PyBytes_AsString(bytes); } if (data == NULL) goto ON_FAIL; Py_BEGIN_ALLOW_THREADS; if (is_content) { rv = xmlSecCryptoAppKeyCertLoadMemory(key->handle, (const xmlSecByte*)data, (xmlSecSize)data_size, format); } else { rv = xmlSecCryptoAppKeyCertLoad(key->handle, data, format); } Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot load cert"); goto ON_FAIL; } Py_DECREF(bytes); PYXMLSEC_DEBUGF("%p: load certificate from file - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: load certificate from file - fail", self); Py_XDECREF(bytes); return NULL; } static const char PyXmlSec_KeyName__doc__[] = "the name of this key.\n"; static PyObject* PyXmlSec_KeyNameGet(PyObject* self, void* closure) { PyXmlSec_Key* key = (PyXmlSec_Key*)self; const char* cname; PYXMLSEC_DEBUGF("%p: get name of key", self); if (key->handle == NULL) { PyErr_SetString(PyExc_ValueError, "key is not ready"); return NULL; } cname = (const char*)xmlSecKeyGetName(key->handle); if (cname != NULL) { return PyUnicode_FromString(cname); } Py_RETURN_NONE; } static int PyXmlSec_KeyNameSet(PyObject* self, PyObject* value, void* closure) { PyXmlSec_Key* key = (PyXmlSec_Key*)self; const char* name; PYXMLSEC_DEBUGF("%p: set name of key %p", self, value); if (key->handle == NULL) { PyErr_SetString(PyExc_ValueError, "key is not ready"); return -1; } if (value == NULL) { if (xmlSecKeySetName(key->handle, NULL) < 0) { PyXmlSec_SetLastError("cannot delete name"); return -1; } return 0; } name = PyUnicode_AsUTF8(value); if (name == NULL) return -1; if (xmlSecKeySetName(key->handle, XSTR(name)) < 0) { PyXmlSec_SetLastError("cannot set name"); return -1; } return 0; } static PyGetSetDef PyXmlSec_KeyGetSet[] = { { "name", (getter)PyXmlSec_KeyNameGet, (setter)PyXmlSec_KeyNameSet, (char*)PyXmlSec_KeyName__doc__, NULL }, {NULL} /* Sentinel */ }; static PyMethodDef PyXmlSec_KeyMethods[] = { { "from_memory", (PyCFunction)PyXmlSec_KeyFromMemory, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyFromMemory__doc__, }, { "from_file", (PyCFunction)PyXmlSec_KeyFromFile, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyFromFile__doc__ }, { "from_engine", (PyCFunction)PyXmlSec_KeyFromEngine, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyFromEngine__doc__ }, { "generate", (PyCFunction)PyXmlSec_KeyGenerate, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyGenerate__doc__ }, { "from_binary_file", (PyCFunction)PyXmlSec_KeyFromBinaryFile, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyFromBinaryFile__doc__ }, { "from_binary_data", (PyCFunction)PyXmlSec_KeyFromBinaryData, METH_CLASS|METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyFromBinaryData__doc__ }, { "load_cert_from_memory", (PyCFunction)PyXmlSec_KeyCertFromMemory, METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyCertFromMemory__doc__ }, { "load_cert_from_file", (PyCFunction)PyXmlSec_KeyCertFromFile, METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeyCertFromFile__doc__ }, { "__copy__", (PyCFunction)PyXmlSec_Key__copy__, METH_NOARGS, "", }, { "__deepcopy__", (PyCFunction)PyXmlSec_Key__copy__, METH_NOARGS, "", }, {NULL, NULL} /* sentinel */ }; static PyTypeObject _PyXmlSec_KeyType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".Key", /* tp_name */ sizeof(PyXmlSec_Key), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_Key__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ "Key", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ PyXmlSec_KeyMethods, /* tp_methods */ 0, /* tp_members */ PyXmlSec_KeyGetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ PyXmlSec_Key__new__, /* tp_new */ 0, /* tp_free */ }; PyTypeObject* PyXmlSec_KeyType = &_PyXmlSec_KeyType; // creates a new key object PyXmlSec_Key* PyXmlSec_NewKey(void) { return PyXmlSec_NewKey1(PyXmlSec_KeyType); } /// key manager class static PyObject* PyXmlSec_KeysManager__new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyXmlSec_KeysManager* mgr = (PyXmlSec_KeysManager*)PyType_GenericNew(type, args, kwargs); PYXMLSEC_DEBUGF("%p: new manager", mgr); if (mgr != NULL) { mgr->handle = NULL; } return (PyObject*)(mgr); } static int PyXmlSec_KeysManager__init__(PyObject* self, PyObject* args, PyObject* kwargs) { xmlSecKeysMngrPtr handle = xmlSecKeysMngrCreate(); PYXMLSEC_DEBUGF("%p: init key manager", self); if (handle == NULL) { PyXmlSec_SetLastError("failed to create xmlsecKeyManager"); return -1; } if (xmlSecCryptoAppDefaultKeysMngrInit(handle) < 0) { xmlSecKeysMngrDestroy(handle); PyXmlSec_SetLastError("failed to initialize xmlsecKeyManager"); return -1; } PYXMLSEC_DEBUGF("%p: init key manager - done: %p", self, handle); ((PyXmlSec_KeysManager*)self)->handle = handle; return 0; } static void PyXmlSec_KeysManager__del__(PyObject* self) { PyXmlSec_KeysManager* mgr = (PyXmlSec_KeysManager*)self; PYXMLSEC_DEBUGF("%p: delete KeysManager", self); if (mgr->handle != NULL) { PYXMLSEC_DEBUGF("%p: delete KeysManager handle - %p", self, mgr->handle); xmlSecKeysMngrDestroy(mgr->handle); } Py_TYPE(self)->tp_free(self); } static const char PyXmlSec_KeysManagerAddKey__doc__[] = \ "add_key(key: xmlsec.Key) -> None\n" "Adds a copy of ``key`` to keys manager\n\n" ":param key: the pointer to key\n" ":type key: :class:`~xmlsec.Key`"; static PyObject* PyXmlSec_KeysManagerAddKey(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "key", NULL}; PyXmlSec_KeysManager* mgr = (PyXmlSec_KeysManager*)self; PyXmlSec_Key* key = NULL; xmlSecKeyPtr key2; int rv; PYXMLSEC_DEBUGF("%p(%p): add key - start", self, ((PyXmlSec_KeysManager*)self)->handle); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:add_key", kwlist, PyXmlSec_KeyType, &key)) { goto ON_FAIL; } if (key->handle == NULL) { PyErr_SetString(PyExc_ValueError, "the provided key is invalid"); goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS key2 = xmlSecKeyDuplicate(key->handle); Py_END_ALLOW_THREADS; if (key2 == NULL) { PyXmlSec_SetLastError("cannot make copy of key"); goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mgr->handle, key2); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot add key"); xmlSecKeyDestroy(key2); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: add key - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: add key - fail", self); return NULL; } static const char PyXmlSec_KeysManagerLoadCert__doc__[] = \ "load_cert(filename, format, type) -> None\n" "Loads certificate from ``filename``.\n\n" ":param filename: the certificate file\n" ":type filename: :class:`str`, :class:`bytes` or any :class:`~os.PathLike`\n" ":param format: the certificate file format\n" ":type format: :class:`int`\n" ":param type: the flag that indicates is the certificate in filename trusted or not\n" ":type type: :class:`int`"; static PyObject* PyXmlSec_KeysManagerLoadCert(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "filename", "format", "type", NULL}; PyXmlSec_KeysManager* mgr = (PyXmlSec_KeysManager*)self; PyObject* filepath = NULL; unsigned int format = 0; unsigned int type = 0; const char* filename; int rv; PYXMLSEC_DEBUGF("%p: load cert - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&II:load_cert", kwlist, PyUnicode_FSConverter, &filepath, &format, &type)) { goto ON_FAIL; } filename = PyBytes_AsString(filepath); Py_BEGIN_ALLOW_THREADS; rv = xmlSecCryptoAppKeysMngrCertLoad(mgr->handle, filename, format, type); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot load cert"); goto ON_FAIL; } Py_DECREF(filepath); PYXMLSEC_DEBUGF("%p: load cert - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: load cert - fail", self); Py_XDECREF(filepath); return NULL; } static const char PyXmlSec_KeysManagerLoadCertFromMemory__doc__[] = \ "load_cert_from_memory(data, format, type) -> None\n" "Loads certificate from ``data``\n\n" ":param data: the certificate binary data\n" ":type data: :class:`str` or :class:`bytes`\n" ":param format: the certificate file format\n" ":type format: :class:`int`\n" ":param type: the flag that indicates is the certificate in filename trusted or not\n" ":type type: :class:`int`"; static PyObject* PyXmlSec_KeysManagerLoadCertFromMemory(PyObject* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "data", "format", "type", NULL}; PyXmlSec_KeysManager* mgr = (PyXmlSec_KeysManager*)self; const char* data = NULL; unsigned int type = 0; unsigned int format = 0; Py_ssize_t data_size = 0; int rv; PYXMLSEC_DEBUGF("%p: load cert from memory - start", self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#II:load_cert", kwlist, &data, &data_size, &format, &type)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; rv = xmlSecCryptoAppKeysMngrCertLoadMemory(mgr->handle, (const xmlSecByte*)data, (xmlSecSize)data_size, format, type); Py_END_ALLOW_THREADS; if (rv < 0) { PyXmlSec_SetLastError("cannot load cert from memory"); goto ON_FAIL; } PYXMLSEC_DEBUGF("%p: load cert from memory - ok", self); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUGF("%p: load cert from memory - fail", self); return NULL; } static PyMethodDef PyXmlSec_KeysManagerMethods[] = { { "add_key", (PyCFunction)PyXmlSec_KeysManagerAddKey, METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeysManagerAddKey__doc__ }, { "load_cert", (PyCFunction)PyXmlSec_KeysManagerLoadCert, METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeysManagerLoadCert__doc__ }, { "load_cert_from_memory", (PyCFunction)PyXmlSec_KeysManagerLoadCertFromMemory, METH_VARARGS|METH_KEYWORDS, PyXmlSec_KeysManagerLoadCertFromMemory__doc__ }, {NULL, NULL} /* sentinel */ }; static PyTypeObject _PyXmlSec_KeysManagerType = { PyVarObject_HEAD_INIT(NULL, 0) STRINGIFY(MODULE_NAME) ".KeysManager", /* tp_name */ sizeof(PyXmlSec_KeysManager), /* tp_basicsize */ 0, /* tp_itemsize */ PyXmlSec_KeysManager__del__, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ "Keys Manager", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ PyXmlSec_KeysManagerMethods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ PyXmlSec_KeysManager__init__, /* tp_init */ 0, /* tp_alloc */ PyXmlSec_KeysManager__new__, /* tp_new */ 0, /* tp_free */ }; PyTypeObject* PyXmlSec_KeysManagerType = &_PyXmlSec_KeysManagerType; int PyXmlSec_KeysManagerConvert(PyObject* o, PyXmlSec_KeysManager** p) { if (o == Py_None) { *p = NULL; return 1; } if (!PyObject_IsInstance(o, (PyObject*)PyXmlSec_KeysManagerType)) { PyErr_SetString(PyExc_TypeError, "KeysManager required"); return 0; } *p = (PyXmlSec_KeysManager*)(o); Py_INCREF(o); return 1; } int PyXmlSec_KeyModule_Init(PyObject* package) { if (PyType_Ready(PyXmlSec_KeyType) < 0) goto ON_FAIL; if (PyType_Ready(PyXmlSec_KeysManagerType) < 0) goto ON_FAIL; // since objects is created as static objects, need to increase refcount to prevent deallocate Py_INCREF(PyXmlSec_KeyType); Py_INCREF(PyXmlSec_KeysManagerType); if (PyModule_AddObject(package, "Key", (PyObject*)PyXmlSec_KeyType) < 0) goto ON_FAIL; if (PyModule_AddObject(package, "KeysManager", (PyObject*)PyXmlSec_KeysManagerType) < 0) goto ON_FAIL; return 0; ON_FAIL: return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/keys.h0000644000076500000240000000215614441560770013674 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_KEY_H__ #define __PYXMLSEC_KEY_H__ #include "platform.h" #include typedef struct { PyObject_HEAD xmlSecKeyPtr handle; int is_own; } PyXmlSec_Key; extern PyTypeObject* PyXmlSec_KeyType; PyXmlSec_Key* PyXmlSec_NewKey(void); typedef struct { PyObject_HEAD xmlSecKeysMngrPtr handle; } PyXmlSec_KeysManager; extern PyTypeObject* PyXmlSec_KeysManagerType; // converts object `o` to PyXmlSec_KeysManager, None will be converted to NULL, increments ref_count int PyXmlSec_KeysManagerConvert(PyObject* o, PyXmlSec_KeysManager** p); #endif //__PYXMLSEC_KEY_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1713302194.0 xmlsec-1.3.17/src/lxml.c0000644000076500000240000000752314607565262013700 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "lxml.h" #include "exception.h" #include #include #include #include #include #define XMLSEC_EXTRACT_VERSION(x, y) ((x / (y)) % 100) #define XMLSEC_EXTRACT_MAJOR(x) XMLSEC_EXTRACT_VERSION(x, 100 * 100) #define XMLSEC_EXTRACT_MINOR(x) XMLSEC_EXTRACT_VERSION(x, 100) #define XMLSEC_EXTRACT_PATCH(x) XMLSEC_EXTRACT_VERSION(x, 1) static long PyXmlSec_GetLibXmlVersionLong() { return PyOS_strtol(xmlParserVersion, NULL, 10); } long PyXmlSec_GetLibXmlVersionMajor() { return XMLSEC_EXTRACT_MAJOR(PyXmlSec_GetLibXmlVersionLong()); } long PyXmlSec_GetLibXmlVersionMinor() { return XMLSEC_EXTRACT_MINOR(PyXmlSec_GetLibXmlVersionLong()); } long PyXmlSec_GetLibXmlVersionPatch() { return XMLSEC_EXTRACT_PATCH(PyXmlSec_GetLibXmlVersionLong()); } long PyXmlSec_GetLibXmlCompiledVersionMajor() { return XMLSEC_EXTRACT_MAJOR(LIBXML_VERSION); } long PyXmlSec_GetLibXmlCompiledVersionMinor() { return XMLSEC_EXTRACT_MINOR(LIBXML_VERSION); } long PyXmlSec_GetLibXmlCompiledVersionPatch() { return XMLSEC_EXTRACT_PATCH(LIBXML_VERSION); } static int PyXmlSec_CheckLxmlLibraryVersion(void) { // Make sure that the version of libxml2 lxml is using is the same as the one we are using. Because // we pass trees between the two libraries, we need to make sure that they are using the same version // of libxml2, or we could run into difficult to debug segfaults. // See: https://github.com/xmlsec/python-xmlsec/issues/283 PyObject* lxml = NULL; PyObject* version = NULL; // Default to failure int result = -1; lxml = PyImport_ImportModule("lxml.etree"); if (lxml == NULL) { goto FINALIZE; } version = PyObject_GetAttrString(lxml, "LIBXML_VERSION"); if (version == NULL) { goto FINALIZE; } if (!PyTuple_Check(version) || PyTuple_Size(version) < 2) { goto FINALIZE; } PyObject* major = PyTuple_GetItem(version, 0); if (major == NULL) { goto FINALIZE; } PyObject* minor = PyTuple_GetItem(version, 1); if (minor == NULL) { goto FINALIZE; } if (!PyLong_Check(major) || !PyLong_Check(minor)) { goto FINALIZE; } if (PyLong_AsLong(major) != PyXmlSec_GetLibXmlVersionMajor() || PyLong_AsLong(minor) != PyXmlSec_GetLibXmlVersionMinor()) { goto FINALIZE; } result = 0; FINALIZE: // Clear any errors that may have occurred PyErr_Clear(); // Cleanup our references, and return the result Py_XDECREF(lxml); Py_XDECREF(version); return result; } int PyXmlSec_InitLxmlModule(void) { if (PyXmlSec_CheckLxmlLibraryVersion() < 0) { PyXmlSec_SetLastError("lxml & xmlsec libxml2 library version mismatch"); return -1; } return import_lxml__etree(); } int PyXmlSec_IsElement(xmlNodePtr xnode) { return _isElement(xnode); } PyXmlSec_LxmlElementPtr PyXmlSec_elementFactory(PyXmlSec_LxmlDocumentPtr doc, xmlNodePtr xnode) { return elementFactory(doc, xnode); } int PyXmlSec_LxmlElementConverter(PyObject* o, PyXmlSec_LxmlElementPtr* p) { PyXmlSec_LxmlElementPtr node = rootNodeOrRaise(o); if (node == NULL) { return 0; } *p = node; // rootNodeOrRaise - increments ref-count, so need to compensate this. Py_DECREF(node); return 1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752065308.0 xmlsec-1.3.17/src/lxml.h0000644000076500000240000000275015033462434013671 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_LXML_H__ #define __PYXMLSEC_LXML_H__ #include "platform.h" #include #include #include #include typedef struct LxmlElement* PyXmlSec_LxmlElementPtr; typedef struct LxmlDocument* PyXmlSec_LxmlDocumentPtr; // checks that xnode is Element int PyXmlSec_IsElement(xmlNodePtr xnode); // creates a new element PyXmlSec_LxmlElementPtr PyXmlSec_elementFactory(PyXmlSec_LxmlDocumentPtr doc, xmlNodePtr node); // converts o to PyObject, None object is not allowed, does not increment ref_counts int PyXmlSec_LxmlElementConverter(PyObject* o, PyXmlSec_LxmlElementPtr* p); // get version numbers for libxml2 both compiled and loaded long PyXmlSec_GetLibXmlVersionMajor(); long PyXmlSec_GetLibXmlVersionMinor(); long PyXmlSec_GetLibXmlVersionPatch(); long PyXmlSec_GetLibXmlCompiledVersionMajor(); long PyXmlSec_GetLibXmlCompiledVersionMinor(); long PyXmlSec_GetLibXmlCompiledVersionPatch(); #endif // __PYXMLSEC_LXML_H__ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712332756.0 xmlsec-1.3.17/src/main.c0000644000076500000240000004513114604017724013635 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "platform.h" #include "exception.h" #include "lxml.h" #include #include #include #include #include #define _PYXMLSEC_FREE_NONE 0 #define _PYXMLSEC_FREE_XMLSEC 1 #define _PYXMLSEC_FREE_CRYPTOLIB 2 #define _PYXMLSEC_FREE_ALL 3 static int free_mode = _PYXMLSEC_FREE_NONE; #define MODULE_DOC "The tiny python wrapper around xmlsec1 (" XMLSEC_VERSION ") library" #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING static const xmlChar* PyXmlSec_GetCryptoLibName() { #if XMLSEC_VERSION_HEX > 0x10214 // xmlSecGetDefaultCrypto was introduced in version 1.2.21 const xmlChar* cryptoLib = xmlSecGetDefaultCrypto(); #else const xmlChar* cryptoLib = (const xmlChar*) XMLSEC_CRYPTO; #endif PYXMLSEC_DEBUGF("dynamic crypto library: %s", cryptoLib); return cryptoLib; } #endif // !XMLSEC_NO_CRYPTO_DYNAMIC_LOADING static void PyXmlSec_Free(int what) { PYXMLSEC_DEBUGF("free resources %d", what); switch (what) { case _PYXMLSEC_FREE_ALL: xmlSecCryptoAppShutdown(); case _PYXMLSEC_FREE_CRYPTOLIB: #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING xmlSecCryptoDLUnloadLibrary(PyXmlSec_GetCryptoLibName()); #endif case _PYXMLSEC_FREE_XMLSEC: xmlSecShutdown(); } free_mode = _PYXMLSEC_FREE_NONE; } static int PyXmlSec_Init(void) { if (xmlSecInit() < 0) { PyXmlSec_SetLastError("cannot initialize xmlsec library."); PyXmlSec_Free(_PYXMLSEC_FREE_NONE); return -1; } if (xmlSecCheckVersion() != 1) { PyXmlSec_SetLastError("xmlsec library version mismatch."); PyXmlSec_Free(_PYXMLSEC_FREE_XMLSEC); return -1; } #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING if (xmlSecCryptoDLLoadLibrary(PyXmlSec_GetCryptoLibName()) < 0) { PyXmlSec_SetLastError("cannot load crypto library for xmlsec."); PyXmlSec_Free(_PYXMLSEC_FREE_XMLSEC); return -1; } #endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ /* Init crypto library */ if (xmlSecCryptoAppInit(NULL) < 0) { PyXmlSec_SetLastError("cannot initialize crypto library application."); PyXmlSec_Free(_PYXMLSEC_FREE_CRYPTOLIB); return -1; } /* Init xmlsec-crypto library */ if (xmlSecCryptoInit() < 0) { PyXmlSec_SetLastError("cannot initialize crypto library."); PyXmlSec_Free(_PYXMLSEC_FREE_ALL); return -1; } // xmlsec will install default callback in xmlSecCryptoInit, // overwriting any custom callbacks. // We thus reinstall our callback now. PyXmlSec_InstallErrorCallback(); free_mode = _PYXMLSEC_FREE_ALL; return 0; } static char PyXmlSec_PyInit__doc__[] = \ "init() -> None\n" "Initializes the library for general operation.\n\n" "This is called upon library import and does not need to be called\n" "again :func:`~.shutdown` is called explicitly).\n"; static PyObject* PyXmlSec_PyInit(PyObject *self) { if (PyXmlSec_Init() < 0) { return NULL; } Py_RETURN_NONE; } static char PyXmlSec_PyShutdown__doc__[] = \ "shutdown() -> None\n" "Shutdowns the library and cleanup any leftover resources.\n\n" "This is called automatically upon interpreter termination and\n" "should not need to be called explicitly."; static PyObject* PyXmlSec_PyShutdown(PyObject* self) { PyXmlSec_Free(free_mode); Py_RETURN_NONE; } static char PyXmlSec_GetLibXmlSecVersion__doc__[] = \ "get_libxmlsec_version() -> tuple\n" "Returns Version tuple of wrapped libxmlsec library."; static PyObject* PyXmlSec_GetLibXmlSecVersion() { return Py_BuildValue("(iii)", XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR); } static char PyXmlSec_GetLibXmlVersion__doc__[] = \ "get_libxml_version() -> tuple[int, int, int]\n" "Returns version tuple of libxml2 library xmlsec is using."; static PyObject* PyXmlSec_GetLibXmlVersion() { return Py_BuildValue( "(iii)", PyXmlSec_GetLibXmlVersionMajor(), PyXmlSec_GetLibXmlVersionMinor(), PyXmlSec_GetLibXmlVersionPatch() ); } static char PyXmlSec_GetLibXmlCompiledVersion__doc__[] = \ "get_libxml_compiled_version() -> tuple[int, int, int]\n" "Returns version tuple of libxml2 library xmlsec was compiled with."; static PyObject* PyXmlSec_GetLibXmlCompiledVersion() { return Py_BuildValue( "(iii)", PyXmlSec_GetLibXmlCompiledVersionMajor(), PyXmlSec_GetLibXmlCompiledVersionMinor(), PyXmlSec_GetLibXmlCompiledVersionPatch() ); } static char PyXmlSec_PyEnableDebugOutput__doc__[] = \ "enable_debug_trace(enabled) -> None\n" "Enables or disables calling LibXML2 callback from the default errors callback.\n\n" ":param enabled: flag, debug trace is enabled or disabled\n" ":type enabled: :class:`bool`"; static PyObject* PyXmlSec_PyEnableDebugOutput(PyObject *self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = { "enabled", NULL}; PyObject* enabled = Py_True; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:enable_debug_trace", kwlist, &enabled)) { return NULL; } PyXmlSecEnableDebugTrace(PyObject_IsTrue(enabled)); Py_RETURN_NONE; } // NB: This whole thing assumes that the `xmlsec` callbacks are not re-entrant // (i.e. that xmlsec won't come across a link in the reference it's processing // and try to open that with these callbacks too). typedef struct CbList { PyObject* match_cb; PyObject* open_cb; PyObject* read_cb; PyObject* close_cb; struct CbList* next; } CbList; static CbList* registered_callbacks = NULL; static void RCBListCons(CbList* cb_list_item) { cb_list_item->next = registered_callbacks; registered_callbacks = cb_list_item; } static void RCBListClear() { CbList* cb_list_item = registered_callbacks; while (cb_list_item) { Py_DECREF(cb_list_item->match_cb); Py_DECREF(cb_list_item->open_cb); Py_DECREF(cb_list_item->read_cb); Py_DECREF(cb_list_item->close_cb); CbList* next = cb_list_item->next; free(cb_list_item); cb_list_item = next; } registered_callbacks = NULL; } // The currently executing set of Python callbacks: static CbList* cur_cb_list_item; static int PyXmlSec_MatchCB(const char* filename) { cur_cb_list_item = registered_callbacks; PyGILState_STATE state = PyGILState_Ensure(); PyObject* args = Py_BuildValue("(y)", filename); while (cur_cb_list_item) { PyObject* result = PyObject_CallObject(cur_cb_list_item->match_cb, args); if (result && PyObject_IsTrue(result)) { Py_DECREF(result); Py_DECREF(args); PyGILState_Release(state); return 1; } Py_XDECREF(result); cur_cb_list_item = cur_cb_list_item->next; } Py_DECREF(args); PyGILState_Release(state); return 0; } static void* PyXmlSec_OpenCB(const char* filename) { PyGILState_STATE state = PyGILState_Ensure(); // NB: Assumes the match callback left the current callback list item in the // right place: PyObject* args = Py_BuildValue("(y)", filename); PyObject* result = PyObject_CallObject(cur_cb_list_item->open_cb, args); Py_DECREF(args); PyGILState_Release(state); return result; } static int PyXmlSec_ReadCB(void* context, char* buffer, int len) { PyGILState_STATE state = PyGILState_Ensure(); // NB: Assumes the match callback left the current callback list item in the // right place: PyObject* py_buffer = PyMemoryView_FromMemory(buffer, (Py_ssize_t) len, PyBUF_WRITE); PyObject* args = Py_BuildValue("(OO)", context, py_buffer); PyObject* py_bytes_read = PyObject_CallObject(cur_cb_list_item->read_cb, args); Py_DECREF(args); Py_DECREF(py_buffer); int result; if (py_bytes_read && PyLong_Check(py_bytes_read)) { result = (int)PyLong_AsLong(py_bytes_read); } else { result = EOF; } Py_XDECREF(py_bytes_read); PyGILState_Release(state); return result; } static int PyXmlSec_CloseCB(void* context) { PyGILState_STATE state = PyGILState_Ensure(); PyObject* args = Py_BuildValue("(O)", context); PyObject* result = PyObject_CallObject(cur_cb_list_item->close_cb, args); Py_DECREF(args); Py_DECREF(context); Py_DECREF(result); PyGILState_Release(state); return 0; } static char PyXmlSec_PyIOCleanupCallbacks__doc__[] = \ "Unregister globally all sets of IO callbacks from xmlsec."; static PyObject* PyXmlSec_PyIOCleanupCallbacks(PyObject *self) { xmlSecIOCleanupCallbacks(); // We always have callbacks registered to delegate to any Python callbacks // we have registered within these bindings: if (xmlSecIORegisterCallbacks( PyXmlSec_MatchCB, PyXmlSec_OpenCB, PyXmlSec_ReadCB, PyXmlSec_CloseCB) < 0) { return NULL; } RCBListClear(); Py_RETURN_NONE; } static char PyXmlSec_PyIORegisterDefaultCallbacks__doc__[] = \ "Register globally xmlsec's own default set of IO callbacks."; static PyObject* PyXmlSec_PyIORegisterDefaultCallbacks(PyObject *self) { // NB: The default callbacks (specifically libxml2's `xmlFileMatch`) always // match, and callbacks are called in the reverse order to that which they // were added. So, there's no point in holding onto any previously registered // callbacks, because they will never be run: xmlSecIOCleanupCallbacks(); RCBListClear(); if (xmlSecIORegisterDefaultCallbacks() < 0) { return NULL; } // We need to make sure we can continue trying to match any newly added // Python callbacks: if (xmlSecIORegisterCallbacks( PyXmlSec_MatchCB, PyXmlSec_OpenCB, PyXmlSec_ReadCB, PyXmlSec_CloseCB) < 0) { return NULL; }; Py_RETURN_NONE; } static char PyXmlSec_PyIORegisterCallbacks__doc__[] = \ "register_callbacks(input_match_callback, input_open_callback, input_read_callback, input_close_callback) -> None\n" "Register globally a custom set of IO callbacks with xmlsec.\n\n" ":param input_match_callback: A callable that takes a filename `bytestring` and " "returns a boolean as to whether the other callbacks in this set can handle that name.\n" ":type input_match_callback: ~collections.abc.Callable[[bytes], bool]\n" ":param input_open_callback: A callable that takes a filename and returns some " "context object (e.g. a file object) that the remaining callables in this set will be passed " "during handling.\n" ":type input_open_callback: ~collections.abc.Callable[[bytes], Any]\n" // FIXME: How do we handle failures in ^^ (e.g. can't find the file)? ":param input_read_callback: A callable that that takes the context object from the " "open callback and a buffer, and should fill the buffer with data (e.g. BytesIO.readinto()). " "xmlsec will call this function several times until there is no more data returned.\n" ":type input_read_callback: ~collections.abc.Callable[[Any, memoryview], int]\n" ":param input_close_callback: A callable that takes the context object from the " "open callback and can do any resource cleanup necessary.\n" ":type input_close_callback: ~collections.abc.Callable[[Any], None]\n" ; static PyObject* PyXmlSec_PyIORegisterCallbacks(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "input_match_callback", "input_open_callback", "input_read_callback", "input_close_callback", NULL }; CbList* cb_list_item = malloc(sizeof(CbList)); if (cb_list_item == NULL) { return NULL; } if (!PyArg_ParseTupleAndKeywords( args, kwargs, "OOOO:register_callbacks", kwlist, &cb_list_item->match_cb, &cb_list_item->open_cb, &cb_list_item->read_cb, &cb_list_item->close_cb)) { free(cb_list_item); return NULL; } if (!PyCallable_Check(cb_list_item->match_cb)) { PyErr_SetString(PyExc_TypeError, "input_match_callback must be a callable"); free(cb_list_item); return NULL; } if (!PyCallable_Check(cb_list_item->open_cb)) { PyErr_SetString(PyExc_TypeError, "input_open_callback must be a callable"); free(cb_list_item); return NULL; } if (!PyCallable_Check(cb_list_item->read_cb)) { PyErr_SetString(PyExc_TypeError, "input_read_callback must be a callable"); free(cb_list_item); return NULL; } if (!PyCallable_Check(cb_list_item->close_cb)) { PyErr_SetString(PyExc_TypeError, "input_close_callback must be a callable"); free(cb_list_item); return NULL; } Py_INCREF(cb_list_item->match_cb); Py_INCREF(cb_list_item->open_cb); Py_INCREF(cb_list_item->read_cb); Py_INCREF(cb_list_item->close_cb); cb_list_item->next = NULL; RCBListCons(cb_list_item); // NB: We don't need to register the callbacks with `xmlsec` here, because // we've already registered our helper functions that will trawl through our // list of callbacks. Py_RETURN_NONE; } static char PyXmlSec_PyBase64DefaultLineSize__doc__[] = \ "base64_default_line_size(size = None)\n" "Configures the default maximum columns size for base64 encoding.\n\n" "If ``size`` is not given, this function returns the current default size, acting as a getter. " "If ``size`` is given, a new value is applied and this function returns nothing, acting as a setter.\n" ":param size: new default size value (optional)\n" ":type size: :class:`int` or :data:`None`"; static PyObject* PyXmlSec_PyBase64DefaultLineSize(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "size", NULL }; PyObject *pySize = NULL; int size; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:base64_default_line_size", kwlist, &pySize)) { return NULL; } if (pySize == NULL) { return PyLong_FromLong(xmlSecBase64GetDefaultLineSize()); } size = (int)PyLong_AsLong(pySize); if (PyErr_Occurred()) { return NULL; } if (size < 0) { PyErr_SetString(PyExc_ValueError, "size must be positive"); return NULL; } xmlSecBase64SetDefaultLineSize(size); Py_RETURN_NONE; } static PyMethodDef PyXmlSec_MainMethods[] = { { "init", (PyCFunction)PyXmlSec_PyInit, METH_NOARGS, PyXmlSec_PyInit__doc__ }, { "shutdown", (PyCFunction)PyXmlSec_PyShutdown, METH_NOARGS, PyXmlSec_PyShutdown__doc__ }, { "get_libxmlsec_version", (PyCFunction)PyXmlSec_GetLibXmlSecVersion, METH_NOARGS, PyXmlSec_GetLibXmlSecVersion__doc__ }, { "get_libxml_version", (PyCFunction)PyXmlSec_GetLibXmlVersion, METH_NOARGS, PyXmlSec_GetLibXmlVersion__doc__ }, { "get_libxml_compiled_version", (PyCFunction)PyXmlSec_GetLibXmlCompiledVersion, METH_NOARGS, PyXmlSec_GetLibXmlCompiledVersion__doc__ }, { "enable_debug_trace", (PyCFunction)PyXmlSec_PyEnableDebugOutput, METH_VARARGS|METH_KEYWORDS, PyXmlSec_PyEnableDebugOutput__doc__ }, { "cleanup_callbacks", (PyCFunction)PyXmlSec_PyIOCleanupCallbacks, METH_NOARGS, PyXmlSec_PyIOCleanupCallbacks__doc__ }, { "register_default_callbacks", (PyCFunction)PyXmlSec_PyIORegisterDefaultCallbacks, METH_NOARGS, PyXmlSec_PyIORegisterDefaultCallbacks__doc__ }, { "register_callbacks", (PyCFunction)PyXmlSec_PyIORegisterCallbacks, METH_VARARGS|METH_KEYWORDS, PyXmlSec_PyIORegisterCallbacks__doc__ }, { "base64_default_line_size", (PyCFunction)PyXmlSec_PyBase64DefaultLineSize, METH_VARARGS|METH_KEYWORDS, PyXmlSec_PyBase64DefaultLineSize__doc__ }, {NULL, NULL} /* sentinel */ }; // modules entry points // loads lxml module int PyXmlSec_InitLxmlModule(void); // constants int PyXmlSec_ConstantsModule_Init(PyObject* package); // exceptions int PyXmlSec_ExceptionsModule_Init(PyObject* package); // keys management int PyXmlSec_KeyModule_Init(PyObject* package); // init lxml.tree integration int PyXmlSec_TreeModule_Init(PyObject* package); // digital signature management int PyXmlSec_DSModule_Init(PyObject* package); // encryption management int PyXmlSec_EncModule_Init(PyObject* package); // templates management int PyXmlSec_TemplateModule_Init(PyObject* package); static int PyXmlSec_PyClear(PyObject *self) { PyXmlSec_Free(free_mode); return 0; } static PyModuleDef PyXmlSecModule = { PyModuleDef_HEAD_INIT, STRINGIFY(MODULE_NAME), /* name of module */ MODULE_DOC, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ PyXmlSec_MainMethods, /* m_methods */ NULL, /* m_slots */ NULL, /* m_traverse */ PyXmlSec_PyClear, /* m_clear */ NULL, /* m_free */ }; #define PYENTRY_FUNC_NAME JOIN(PyInit_, MODULE_NAME) #define PY_MOD_RETURN(m) return m PyMODINIT_FUNC PYENTRY_FUNC_NAME(void) { PyObject *module = NULL; module = PyModule_Create(&PyXmlSecModule); if (!module) { PY_MOD_RETURN(NULL); /* this really should never happen */ } PYXMLSEC_DEBUGF("%p", module); // init first, since PyXmlSec_Init may raise XmlSecError if (PyXmlSec_ExceptionsModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_Init() < 0) goto ON_FAIL; if (PyModule_AddStringConstant(module, "__version__", STRINGIFY(MODULE_VERSION)) < 0) goto ON_FAIL; if (PyXmlSec_InitLxmlModule() < 0) goto ON_FAIL; /* Populate final object settings */ if (PyXmlSec_ConstantsModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_KeyModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_TreeModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_DSModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_EncModule_Init(module) < 0) goto ON_FAIL; if (PyXmlSec_TemplateModule_Init(module) < 0) goto ON_FAIL; PY_MOD_RETURN(module); ON_FAIL: PY_MOD_RETURN(NULL); } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/platform.h0000644000076500000240000000264714441560770014552 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_PLATFORM_H__ #define __PYXMLSEC_PLATFORM_H__ #define PY_SSIZE_T_CLEAN 1 #include #include #ifdef MS_WIN32 #include #endif /* MS_WIN32 */ #define XMLSEC_VERSION_HEX ((XMLSEC_VERSION_MAJOR << 16) | (XMLSEC_VERSION_MINOR << 8) | (XMLSEC_VERSION_SUBMINOR)) // XKMS support was removed in version 1.2.21 // https://mail.gnome.org/archives/commits-list/2015-February/msg10555.html #if XMLSEC_VERSION_HEX > 0x10214 #define XMLSEC_NO_XKMS 1 #endif #define XSTR(c) (const xmlChar*)(c) #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif static inline char* PyBytes_AsStringAndSize2(PyObject *obj, Py_ssize_t* length) { char* buffer = NULL; return ((PyBytes_AsStringAndSize(obj, &buffer, length) < 0) ? (char*)(0) : buffer); } #endif //__PYXMLSEC_PLATFORM_H__ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3249698 xmlsec-1.3.17/src/python_xmlsec1.egg-info/0000755000076500000240000000000015104652320017201 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821059.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/PKG-INFO0000644000076500000240000001612414605711503020306 0ustar00aminstaffMetadata-Version: 2.1 Name: python-xmlsec1 Version: 1.3.14rc1 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin Author-email: support@mehcode.com Maintainer: Oleg Hoefling Maintainer-email: oleg.hoefling@gmail.com License: MIT Project-URL: Documentation, https://xmlsec.readthedocs.io Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: C Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Typing :: Typed Requires-Python: >=3.5 License-File: LICENSE python-xmlsec ============= .. image:: https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white :target: https://pypi.python.org/pypi/xmlsec .. image:: https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg :target: https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master :alt: pre-commit.ci status .. image:: https://img.shields.io/appveyor/ci/hoefling/xmlsec/master.svg?logo=appveyor&logoColor=white&label=AppVeyor :target: https://ci.appveyor.com/project/hoefling/xmlsec .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/manylinux.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/manylinux.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/macosx.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/macosx.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/linuxbrew.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/opensuse-tumbleweed.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/opensuse-tumbleweed.yml .. image:: https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg :target: https://codecov.io/gh/xmlsec/python-xmlsec .. image:: https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs :target: https://xmlsec.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status Python bindings for the `XML Security Library `_. Documentation ************* A documentation for ``xmlsec`` can be found at `xmlsec.readthedocs.io `_. Usage ***** Check the `examples `_ section in the documentation to see various examples of signing and verifying using the library. Requirements ************ - ``libxml2 >= 2.9.1`` - ``libxmlsec1 >= 1.2.33`` Install ******* ``xmlsec`` is available on PyPI: .. code-block:: bash pip install xmlsec Depending on your OS, you may need to install the required native libraries first: Linux (Debian) ^^^^^^^^^^^^^^ .. code-block:: bash apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually. .. code-block:: bash wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz tar -xvf libxml2-2.9.1.tar.gz cd libxml2-2.9.1 ./configure && make && make install Linux (CentOS) ^^^^^^^^^^^^^^ .. code-block:: bash yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel Linux (Fedora) ^^^^^^^^^^^^^^ .. code-block:: bash dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel Mac ^^^ .. code-block:: bash brew install libxml2 libxmlsec1 pkg-config Alpine ^^^^^^ .. code-block:: bash apk add build-base libressl libffi-dev libressl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec Troubleshooting *************** Mac ^^^ If you get any fatal errors about missing ``.h`` files, update your ``C_INCLUDE_PATH`` environment variable to include the appropriate files from the ``libxml2`` and ``libxmlsec1`` libraries. Windows ^^^^^^^ Starting with 1.3.7, prebuilt wheels are available for Windows, so running ``pip install xmlsec`` should suffice. If you want to build from source: #. Configure build environment, see `wiki.python.org `_ for more details. #. Install from source dist: .. code-block:: bash pip install xmlsec --no-binary=xmlsec Building from source ******************** #. Clone the ``xmlsec`` source code repository to your local computer. .. code-block:: bash git clone https://github.com/xmlsec/python-xmlsec.git #. Change into the ``python-xmlsec`` root directory. .. code-block:: bash cd /path/to/xmlsec #. Install the project and all its dependencies using ``pip``. .. code-block:: bash pip install . Contributing ************ Setting up your environment ^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Follow steps 1 and 2 of the `manual installation instructions <#building-from-source>`_. #. Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identicial versions of packages. .. code-block:: bash mkvirtualenv xmlsec The ``mkvirtualenv`` command is available from ``virtualenvwrapper`` package which can be installed by following `link `_. #. Activate the created virtual environment: .. code-block:: bash workon xmlsec #. Install ``xmlsec`` in development mode with testing enabled. This will download all dependencies required for running the unit tests. .. code-block:: bash pip install -r requirements-test.txt pip install -e "." Running the test suite ^^^^^^^^^^^^^^^^^^^^^^ #. `Set up your environment <#setting-up-your-environment>`_. #. Run the unit tests. .. code-block:: bash pytest tests #. Tests configuration Env variable ``PYXMLSEC_TEST_ITERATIONS`` specifies number of test iterations to detect memory leaks. Reporting an issue ^^^^^^^^^^^^^^^^^^ Please attach the output of following information: * version of ``xmlsec`` * version of ``libxmlsec1`` * version of ``libxml2`` * output from the command .. code-block:: bash pkg-config --cflags xmlsec1 License ******* Unless otherwise noted, all files contained within this project are licensed under the MIT opensource license. See the included ``LICENSE`` file or visit `opensource.org `_ for more information. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821059.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/SOURCES.txt0000644000076500000240000000523214605711503021073 0ustar00aminstaff.pre-commit-config.yaml .readthedocs.yaml LICENSE MANIFEST.in README.rst pyproject.toml setup.cfg setup.py /Users/amin/Workspace/personal/python-xmlsec/src/constants.c /Users/amin/Workspace/personal/python-xmlsec/src/ds.c /Users/amin/Workspace/personal/python-xmlsec/src/enc.c /Users/amin/Workspace/personal/python-xmlsec/src/exception.c /Users/amin/Workspace/personal/python-xmlsec/src/keys.c /Users/amin/Workspace/personal/python-xmlsec/src/lxml.c /Users/amin/Workspace/personal/python-xmlsec/src/main.c /Users/amin/Workspace/personal/python-xmlsec/src/template.c /Users/amin/Workspace/personal/python-xmlsec/src/tree.c /Users/amin/Workspace/personal/python-xmlsec/src/utils.c src/common.h src/constants.c src/constants.h src/debug.h src/ds.c src/enc.c src/exception.c src/exception.h src/keys.c src/keys.h src/lxml.c src/lxml.h src/main.c src/platform.h src/template.c src/tree.c src/utils.c src/utils.h src/xmlsec.cpython-39-darwin.so src/python_xmlsec1.egg-info/PKG-INFO src/python_xmlsec1.egg-info/SOURCES.txt src/python_xmlsec1.egg-info/dependency_links.txt src/python_xmlsec1.egg-info/not-zip-safe src/python_xmlsec1.egg-info/requires.txt src/python_xmlsec1.egg-info/top_level.txt src/pyxmlsec.egg-info/PKG-INFO src/pyxmlsec.egg-info/SOURCES.txt src/pyxmlsec.egg-info/dependency_links.txt src/pyxmlsec.egg-info/not-zip-safe src/pyxmlsec.egg-info/requires.txt src/pyxmlsec.egg-info/top_level.txt src/xmlsec/__init__.pyi src/xmlsec/constants.pyi src/xmlsec/py.typed src/xmlsec/template.pyi src/xmlsec/tree.pyi src/xmlsec.egg-info/PKG-INFO src/xmlsec.egg-info/SOURCES.txt src/xmlsec.egg-info/dependency_links.txt src/xmlsec.egg-info/not-zip-safe src/xmlsec.egg-info/requires.txt src/xmlsec.egg-info/top_level.txt tests/__init__.py tests/base.py tests/conftest.py tests/softhsm_setup.py tests/test_constants.py tests/test_doc_examples.py tests/test_ds.py tests/test_enc.py tests/test_keys.py tests/test_main.py tests/test_pkcs11.py tests/test_templates.py tests/test_tree.py tests/test_type_stubs.py tests/test_xmlsec.py tests/data/deskey.bin tests/data/doc.xml tests/data/dsacert.der tests/data/dsakey.der tests/data/enc1-in.xml tests/data/enc1-out.xml tests/data/enc2-in.xml tests/data/enc2-out.xml tests/data/enc3-in.xml tests/data/enc3-out.xml tests/data/enc_template.xml tests/data/rsacert.pem tests/data/rsakey.pem tests/data/rsapub.pem tests/data/sign1-in.xml tests/data/sign1-out.xml tests/data/sign2-in.xml tests/data/sign2-out.xml tests/data/sign3-in.xml tests/data/sign3-out.xml tests/data/sign4-in.xml tests/data/sign4-out.xml tests/data/sign5-in.xml tests/data/sign5-out-xmlsec_1_2_36_to_37.xml tests/data/sign5-out.xml tests/data/sign6-in.bin tests/data/sign6-out.bin tests/data/sign_template.xml././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821059.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/dependency_links.txt0000644000076500000240000000000114605711503023253 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821024.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/not-zip-safe0000644000076500000240000000000114605711440021433 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821059.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/requires.txt0000644000076500000240000000001214605711503021576 0ustar00aminstafflxml>=3.8 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712821059.0 xmlsec-1.3.17/src/python_xmlsec1.egg-info/top_level.txt0000644000076500000240000000000714605711503021734 0ustar00aminstaffxmlsec ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1762874576.326885 xmlsec-1.3.17/src/pyxmlsec.egg-info/0000755000076500000240000000000015104652320016070 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712820927.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/PKG-INFO0000644000076500000240000001611614605711277017206 0ustar00aminstaffMetadata-Version: 2.1 Name: pyxmlsec Version: 1.3.14rc1 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin Author-email: support@mehcode.com Maintainer: Oleg Hoefling Maintainer-email: oleg.hoefling@gmail.com License: MIT Project-URL: Documentation, https://xmlsec.readthedocs.io Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: C Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Typing :: Typed Requires-Python: >=3.5 License-File: LICENSE python-xmlsec ============= .. image:: https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white :target: https://pypi.python.org/pypi/xmlsec .. image:: https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg :target: https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master :alt: pre-commit.ci status .. image:: https://img.shields.io/appveyor/ci/hoefling/xmlsec/master.svg?logo=appveyor&logoColor=white&label=AppVeyor :target: https://ci.appveyor.com/project/hoefling/xmlsec .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/manylinux.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/manylinux.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/macosx.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/macosx.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/linuxbrew.yml .. image:: https://github.com/mehcode/python-xmlsec/actions/workflows/opensuse-tumbleweed.yml/badge.svg :target: https://github.com/mehcode/python-xmlsec/actions/workflows/opensuse-tumbleweed.yml .. image:: https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg :target: https://codecov.io/gh/xmlsec/python-xmlsec .. image:: https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs :target: https://xmlsec.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status Python bindings for the `XML Security Library `_. Documentation ************* A documentation for ``xmlsec`` can be found at `xmlsec.readthedocs.io `_. Usage ***** Check the `examples `_ section in the documentation to see various examples of signing and verifying using the library. Requirements ************ - ``libxml2 >= 2.9.1`` - ``libxmlsec1 >= 1.2.33`` Install ******* ``xmlsec`` is available on PyPI: .. code-block:: bash pip install xmlsec Depending on your OS, you may need to install the required native libraries first: Linux (Debian) ^^^^^^^^^^^^^^ .. code-block:: bash apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually. .. code-block:: bash wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz tar -xvf libxml2-2.9.1.tar.gz cd libxml2-2.9.1 ./configure && make && make install Linux (CentOS) ^^^^^^^^^^^^^^ .. code-block:: bash yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel Linux (Fedora) ^^^^^^^^^^^^^^ .. code-block:: bash dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel Mac ^^^ .. code-block:: bash brew install libxml2 libxmlsec1 pkg-config Alpine ^^^^^^ .. code-block:: bash apk add build-base libressl libffi-dev libressl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec Troubleshooting *************** Mac ^^^ If you get any fatal errors about missing ``.h`` files, update your ``C_INCLUDE_PATH`` environment variable to include the appropriate files from the ``libxml2`` and ``libxmlsec1`` libraries. Windows ^^^^^^^ Starting with 1.3.7, prebuilt wheels are available for Windows, so running ``pip install xmlsec`` should suffice. If you want to build from source: #. Configure build environment, see `wiki.python.org `_ for more details. #. Install from source dist: .. code-block:: bash pip install xmlsec --no-binary=xmlsec Building from source ******************** #. Clone the ``xmlsec`` source code repository to your local computer. .. code-block:: bash git clone https://github.com/xmlsec/python-xmlsec.git #. Change into the ``python-xmlsec`` root directory. .. code-block:: bash cd /path/to/xmlsec #. Install the project and all its dependencies using ``pip``. .. code-block:: bash pip install . Contributing ************ Setting up your environment ^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Follow steps 1 and 2 of the `manual installation instructions <#building-from-source>`_. #. Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identicial versions of packages. .. code-block:: bash mkvirtualenv xmlsec The ``mkvirtualenv`` command is available from ``virtualenvwrapper`` package which can be installed by following `link `_. #. Activate the created virtual environment: .. code-block:: bash workon xmlsec #. Install ``xmlsec`` in development mode with testing enabled. This will download all dependencies required for running the unit tests. .. code-block:: bash pip install -r requirements-test.txt pip install -e "." Running the test suite ^^^^^^^^^^^^^^^^^^^^^^ #. `Set up your environment <#setting-up-your-environment>`_. #. Run the unit tests. .. code-block:: bash pytest tests #. Tests configuration Env variable ``PYXMLSEC_TEST_ITERATIONS`` specifies number of test iterations to detect memory leaks. Reporting an issue ^^^^^^^^^^^^^^^^^^ Please attach the output of following information: * version of ``xmlsec`` * version of ``libxmlsec1`` * version of ``libxml2`` * output from the command .. code-block:: bash pkg-config --cflags xmlsec1 License ******* Unless otherwise noted, all files contained within this project are licensed under the MIT opensource license. See the included ``LICENSE`` file or visit `opensource.org `_ for more information. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712820927.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/SOURCES.txt0000644000076500000240000000464014605711277017774 0ustar00aminstaff.pre-commit-config.yaml .readthedocs.yaml LICENSE MANIFEST.in README.rst pyproject.toml setup.cfg setup.py /Users/amin/Workspace/personal/python-xmlsec/src/constants.c /Users/amin/Workspace/personal/python-xmlsec/src/ds.c /Users/amin/Workspace/personal/python-xmlsec/src/enc.c /Users/amin/Workspace/personal/python-xmlsec/src/exception.c /Users/amin/Workspace/personal/python-xmlsec/src/keys.c /Users/amin/Workspace/personal/python-xmlsec/src/lxml.c /Users/amin/Workspace/personal/python-xmlsec/src/main.c /Users/amin/Workspace/personal/python-xmlsec/src/template.c /Users/amin/Workspace/personal/python-xmlsec/src/tree.c /Users/amin/Workspace/personal/python-xmlsec/src/utils.c src/common.h src/constants.c src/constants.h src/debug.h src/ds.c src/enc.c src/exception.c src/exception.h src/keys.c src/keys.h src/lxml.c src/lxml.h src/main.c src/platform.h src/template.c src/tree.c src/utils.c src/utils.h src/xmlsec.cpython-39-darwin.so src/pyxmlsec.egg-info/PKG-INFO src/pyxmlsec.egg-info/SOURCES.txt src/pyxmlsec.egg-info/dependency_links.txt src/pyxmlsec.egg-info/not-zip-safe src/pyxmlsec.egg-info/requires.txt src/pyxmlsec.egg-info/top_level.txt src/xmlsec/__init__.pyi src/xmlsec/constants.pyi src/xmlsec/py.typed src/xmlsec/template.pyi src/xmlsec/tree.pyi src/xmlsec.egg-info/PKG-INFO src/xmlsec.egg-info/SOURCES.txt src/xmlsec.egg-info/dependency_links.txt src/xmlsec.egg-info/not-zip-safe src/xmlsec.egg-info/requires.txt src/xmlsec.egg-info/top_level.txt tests/__init__.py tests/base.py tests/conftest.py tests/softhsm_setup.py tests/test_constants.py tests/test_doc_examples.py tests/test_ds.py tests/test_enc.py tests/test_keys.py tests/test_main.py tests/test_pkcs11.py tests/test_templates.py tests/test_tree.py tests/test_type_stubs.py tests/test_xmlsec.py tests/data/deskey.bin tests/data/doc.xml tests/data/dsacert.der tests/data/dsakey.der tests/data/enc1-in.xml tests/data/enc1-out.xml tests/data/enc2-in.xml tests/data/enc2-out.xml tests/data/enc3-in.xml tests/data/enc3-out.xml tests/data/enc_template.xml tests/data/rsacert.pem tests/data/rsakey.pem tests/data/rsapub.pem tests/data/sign1-in.xml tests/data/sign1-out.xml tests/data/sign2-in.xml tests/data/sign2-out.xml tests/data/sign3-in.xml tests/data/sign3-out.xml tests/data/sign4-in.xml tests/data/sign4-out.xml tests/data/sign5-in.xml tests/data/sign5-out-xmlsec_1_2_36_to_37.xml tests/data/sign5-out.xml tests/data/sign6-in.bin tests/data/sign6-out.bin tests/data/sign_template.xml././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712820927.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/dependency_links.txt0000644000076500000240000000000114605711277022152 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712819954.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/not-zip-safe0000644000076500000240000000000114605707362020332 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712820927.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/requires.txt0000644000076500000240000000001214605711277020475 0ustar00aminstafflxml>=3.8 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712820927.0 xmlsec-1.3.17/src/pyxmlsec.egg-info/top_level.txt0000644000076500000240000000000714605711277020633 0ustar00aminstaffxmlsec ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1754905569.0 xmlsec-1.3.17/src/template.c0000644000076500000240000010735115046335741014532 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "platform.h" #include "exception.h" #include "constants.h" #include "lxml.h" #include #define PYXMLSEC_TEMPLATES_DOC "Xml Templates processing" static char PyXmlSec_TemplateCreate__doc__[] = \ "create(node, c14n_method, sign_method, id = None, ns = None) -> lxml.etree._Element\n" "Creates new :xml:`` node with the mandatory :xml:``, :xml:``, " ":xml:`` and :xml:`` children and sub-children.\n\n" ":param node: the signature node\n" ":type node: :class:`lxml.etree._Element`\n" ":param c14n_method: the signature canonicalization method\n" ":type c14n_method: :class:`__Transform`\n" ":param sign_method: the signature method\n" ":type sign_method: :class:`__Transform`\n" ":param id: the node id (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":param ns: the namespace prefix for the signature element (e.g. ``\"dsig\"``) (optional)\n" ":type ns: :class:`str` or :data:`None`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateCreate(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "c14n_method", "sign_method", "id", "ns", "name", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyXmlSec_Transform* c14n = NULL; PyXmlSec_Transform* sign = NULL; const char* id = NULL; const char* ns = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template create - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O!O!|zzz:create", kwlist, PyXmlSec_LxmlElementConverter, &node, PyXmlSec_TransformType, &c14n, PyXmlSec_TransformType, &sign, &id, &ns, &id)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplSignatureCreateNsPref(node->_doc->_c_doc, c14n->id, sign->id, XSTR(id), XSTR(ns)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot create template."); goto ON_FAIL; } PYXMLSEC_DEBUG("template create - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template create - fail"); return NULL; } static char PyXmlSec_TemplateAddReference__doc__[] = \ "add_reference(node, digest_method, id = None, uri = None, type = None) -> lxml.etree._Element\n" "Adds :xml:`` node with given ``\"URI\"`` (``uri``), ``\"Id\"`` (``id``) and ``\"Type\"`` (``type``) attributes and " "the required children :xml:`` and :xml:`` to the :xml:`` child of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param digest_method: the reference digest method\n" ":type digest_method: :class:`__Transform`\n" ":param id: the node id (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":param uri: the reference node URI (optional)\n" ":type uri: :class:`str` or :data:`None`\n" ":param type: the reference node type (optional)\n" ":type type: :class:`str` or :data:`None`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddReference(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "digest_method", "id", "uri", "type", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyXmlSec_Transform* digest = NULL; const char* id = NULL; const char* uri = NULL; const char* type = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_reference - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O!|zzz:add_reference", kwlist, PyXmlSec_LxmlElementConverter, &node, PyXmlSec_TransformType, &digest, &id, &uri, &type)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplSignatureAddReference(node->_c_node, digest->id, XSTR(id), XSTR(uri), XSTR(type)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add reference."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_reference - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_reference - fail"); return NULL; } static char PyXmlSec_TemplateAddTransform__doc__[] = \ "add_transform(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param transform: the transform method id\n" ":type transform: :class:`__Transform`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddTransform(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "transform", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyXmlSec_Transform* transform = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_transform - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O!:add_transform", kwlist, PyXmlSec_LxmlElementConverter, &node, PyXmlSec_TransformType, &transform)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplReferenceAddTransform(node->_c_node, transform->id); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add transform."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_transform - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_transform - fail"); return NULL; } static char PyXmlSec_TemplateEnsureKeyInfo__doc__[] = \ "ensure_key_info(node, id = None) -> lxml.etree._Element\n" "Adds (if necessary) :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param id: the node id (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateEnsureKeyInfo(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "id", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* id = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template ensure_key_info - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|z:ensure_key_info", kwlist, PyXmlSec_LxmlElementConverter, &node, &id)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplSignatureEnsureKeyInfo(node->_c_node, XSTR(id)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot ensure key info."); goto ON_FAIL; } PYXMLSEC_DEBUG("template ensure_key_info - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template ensure_key_info - fail"); return NULL; } static char PyXmlSec_TemplateAddKeyName__doc__[] = \ "add_key_name(node, name = None) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param name: the key name (optional)\n" ":type name: :class:`str` or :data:`None`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddKeyName(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "name", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* name = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_key_name - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|z:add_key_name", kwlist, PyXmlSec_LxmlElementConverter, &node, &name)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplKeyInfoAddKeyName(node->_c_node, XSTR(name)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add key name."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_key_name - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_key_name - fail"); return NULL; } static char PyXmlSec_TemplateAddKeyValue__doc__[] = \ "add_key_value(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddKeyValue(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_key_value - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:add_key_value", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplKeyInfoAddKeyValue(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add key value."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_key_name - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_key_name - fail"); return NULL; } static char PyXmlSec_TemplateAddX509Data__doc__[] = \ "add_x509_data(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`\n"; static PyObject* PyXmlSec_TemplateAddX509Data(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_x509_data - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:add_x509_data", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplKeyInfoAddX509Data(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 data."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_x509_data - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_x509_data - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataAddIssuerSerial__doc__[] = \ "x509_data_add_issuer_serial(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the given :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataAddIssuerSerial(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_data_add_issuer_serial - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:x509_data_add_issuer_serial", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509DataAddIssuerSerial(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 issuer serial."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_data_add_issuer_serial - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_data_add_issuer_serial - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName__doc__[] = \ "x509_issuer_serial_add_issuer_name(node, name = None) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param name: the issuer name (optional)\n" ":type name: :class:`str` or :data:`None`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "name", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* name = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_issuer_serial_add_issuer_name - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|z:x509_issuer_serial_add_issuer_name", kwlist, PyXmlSec_LxmlElementConverter, &node, &name)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509IssuerSerialAddIssuerName(node->_c_node, XSTR(name)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 issuer serial name."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_issuer_serial_add_issuer_name - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_issuer_serial_add_issuer_name - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber__doc__[] = \ "x509_issuer_serial_add_serial_number(node, serial = None) -> lxml.etree._Element\n" "Adds :xml:`` node to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param serial: the serial number (optional)\n" ":type serial: :class:`str` or :data:`None`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "serial", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* serial = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_issuer_serial_add_serial_number - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|z:x509_issuer_serial_add_serial_number", kwlist, PyXmlSec_LxmlElementConverter, &node, &serial)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509IssuerSerialAddSerialNumber(node->_c_node, XSTR(serial)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 issuer serial number."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_issuer_serial_add_serial_number - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_issuer_serial_add_serial_number - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataAddSubjectName__doc__[] = \ "x509_data_add_subject_name(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the given :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataAddSubjectName(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_data_add_subject_name - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:x509_data_add_subject_name", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509DataAddSubjectName(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 subject name."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_data_add_subject_name - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_data_add_subject_name - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataAddSKI__doc__[] = \ "x509_data_add_ski(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the given :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataAddSKI(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_data_add_ski - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:x509_data_add_ski", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509DataAddSKI(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 SKI."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_data_add_ski - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_data_add_ski - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataAddCertificate__doc__[] = \ "x509_data_add_certificate(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the given :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataAddCertificate(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_data_add_certificate - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:x509_data_add_certificate", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509DataAddCertificate(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 certificate."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_data_add_certificate - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_data_add_certificate - fail"); return NULL; } static char PyXmlSec_TemplateAddX509DataAddCRL__doc__[] = \ "x509_data_add_crl(node) -> lxml.etree._Element\n" "Adds :xml:`` node to the given :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddX509DataAddCRL(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template x509_data_add_crl - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:x509_data_add_crl", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplX509DataAddCRL(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add x509 CRL."); goto ON_FAIL; } PYXMLSEC_DEBUG("template x509_data_add_crl - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template x509_data_add_crl - fail"); return NULL; } static char PyXmlSec_TemplateAddEncryptedKey__doc__[] = \ "add_encrypted_key(node, method, id = None, type = None, recipient = None) -> lxml.etree._Element\n" "Adds :xml:`` node with given attributes to the :xml:`` node of *node*.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param method: the encryption method\n" ":type method: :class:`__Transform`\n" ":param id: the ``\"Id\"`` attribute (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":param type: the ``\"Type\"`` attribute (optional)\n" ":type type: :class:`str` or :data:`None`\n" ":param recipient: the ``\"Recipient\"`` attribute (optional)\n" ":type recipient: :class:`str` or :data:`None`\n" ":return: the pointer to the newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateAddEncryptedKey(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "method", "id", "type", "recipient", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyXmlSec_Transform* method = NULL; const char* id = NULL; const char* type = NULL; const char* recipient = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template add_encrypted_key - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O!|zzz:add_encrypted_key", kwlist, PyXmlSec_LxmlElementConverter, &node, PyXmlSec_TransformType, &method, &id, &type, &recipient)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplKeyInfoAddEncryptedKey(node->_c_node, method->id, XSTR(id), XSTR(type), XSTR(recipient)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot add encrypted key."); goto ON_FAIL; } PYXMLSEC_DEBUG("template add_encrypted_key - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template add_encrypted_key - fail"); return NULL; } static char PyXmlSec_TemplateCreateEncryptedData__doc__[] = \ "encrypted_data_create(node, method, id = None, type = None, mime_type = None, encoding = None, ns = None) -> lxml.etree._Element\n" "Creates new :xml:`<{ns}:EncryptedData />` node for encryption template.\n\n" ":param node: the pointer to signature node\n" ":type node: :class:`lxml.etree._Element`\n" ":param method: the encryption method\n" ":type method: :class:`__Transform`\n" ":param id: the ``\"Id\"`` attribute (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":param type: the ``\"Type\"`` attribute (optional)\n" ":type type: :class:`str` or :data:`None`\n" ":param mime_type: the ``\"Recipient\"`` attribute (optional)\n" ":type mime_type: :class:`str` or :data:`None`\n" ":param encoding: the ``\"MimeType\"`` attribute (optional)\n" ":type encoding: :class:`str` or :data:`None`\n" ":param ns: the namespace prefix (optional)\n" ":type ns: :class:`str` or :data:`None`\n" ":return: the pointer newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateCreateEncryptedData(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "method", "id", "type", "mime_type", "encoding", "ns", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyXmlSec_Transform* method = NULL; const char* id = NULL; const char* type = NULL; const char* mime_type = NULL; const char* encoding = NULL; const char* ns = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template encrypted_data_create - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O!|zzzzz:encrypted_data_create", kwlist, PyXmlSec_LxmlElementConverter, &node, PyXmlSec_TransformType, &method, &id, &type, &mime_type, &encoding, &ns)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplEncDataCreate(node->_doc->_c_doc, method->id, XSTR(id), XSTR(type), XSTR(mime_type), XSTR(encoding)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot create encrypted data."); goto ON_FAIL; } if (ns != NULL) { res->ns->prefix = xmlStrdup(XSTR(ns)); } PYXMLSEC_DEBUG("template encrypted_data_create - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template encrypted_data_create - fail"); return NULL; } static char PyXmlSec_TemplateEncryptedDataEnsureKeyInfo__doc__[] = \ "encrypted_data_ensure_key_info(node, id = None, ns = None) -> lxml.etree._Element\n" "Adds :xml:`<{ns}:KeyInfo/>` to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":param id: the ``\"Id\"`` attribute (optional)\n" ":type id: :class:`str` or :data:`None`\n" ":param ns: the namespace prefix (optional)\n" ":type ns: :class:`str` or :data:`None`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateEncryptedDataEnsureKeyInfo(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "id", "ns", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* id = NULL; const char* ns = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template encrypted_data_ensure_key_info - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|zz:encrypted_data_ensure_key_info", kwlist, PyXmlSec_LxmlElementConverter, &node, &id, &ns)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplEncDataEnsureKeyInfo(node->_c_node, XSTR(id)); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot ensure key info for encrypted data."); goto ON_FAIL; } if (ns != NULL) { res->ns->prefix = xmlStrdup(XSTR(ns)); } PYXMLSEC_DEBUG("template encrypted_data_ensure_key_info - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template encrypted_data_ensure_key_info - fail"); return NULL; } static char PyXmlSec_TemplateEncryptedDataEnsureCipherValue__doc__[] = \ "encrypted_data_ensure_cipher_value(node) -> lxml.etree._Element\n" "Adds :xml:`` to the :xml:`` node of ``node``.\n\n" ":param node: the pointer to :xml:`` node\n" ":type node: :class:`lxml.etree._Element`\n" ":return: the pointer to newly created :xml:`` node\n" ":rtype: :class:`lxml.etree._Element`"; static PyObject* PyXmlSec_TemplateEncryptedDataEnsureCipherValue(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", NULL}; PyXmlSec_LxmlElementPtr node = NULL; xmlNodePtr res; PYXMLSEC_DEBUG("template encrypted_data_ensure_cipher_value - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:encrypted_data_ensure_cipher_value", kwlist, PyXmlSec_LxmlElementConverter, &node)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplEncDataEnsureCipherValue(node->_c_node); Py_END_ALLOW_THREADS; if (res == NULL) { PyXmlSec_SetLastError("cannot ensure cipher value for encrypted data."); goto ON_FAIL; } PYXMLSEC_DEBUG("template encrypted_data_ensure_cipher_value - ok"); return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("template encrypted_data_ensure_cipher_value - fail"); return NULL; } static char PyXmlSec_TemplateTransformAddC14NInclNamespaces__doc__[] = \ "transform_add_c14n_inclusive_namespaces(node, prefixes = None) -> None\n" "Adds 'inclusive' namespaces to the ExcC14N transform node ``node``.\n\n" ":param node: the pointer to :xml:`` node.\n" ":type node: :class:`lxml.etree._Element`\n" ":param prefixes: the list of namespace prefixes, where ``'default'`` indicates the default namespace (optional).\n" ":type prefixes: :class:`str` or :class:`list` of strings"; static PyObject* PyXmlSec_TemplateTransformAddC14NInclNamespaces(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "prefixes", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyObject* prefixes = NULL; PyObject* sep; int res; const char* c_prefixes; // transform_add_c14n_inclusive_namespaces PYXMLSEC_DEBUG("template encrypted_data_ensure_cipher_value - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O:transform_add_c14n_inclusive_namespaces", kwlist, PyXmlSec_LxmlElementConverter, &node, &prefixes)) { prefixes = NULL; goto ON_FAIL; } if (PyList_Check(prefixes) || PyTuple_Check(prefixes)) { sep = PyUnicode_FromString(" "); prefixes = PyObject_CallMethod(sep, "join", "O", prefixes); Py_DECREF(sep); } else if (PyUnicode_Check(prefixes)) { Py_INCREF(prefixes); } else { PyErr_SetString(PyExc_TypeError, "expected instance of str or list of str"); prefixes = NULL; } if (prefixes == NULL) { goto ON_FAIL; } c_prefixes = PyUnicode_AsUTF8(prefixes); Py_BEGIN_ALLOW_THREADS; res = xmlSecTmplTransformAddC14NInclNamespaces(node->_c_node, XSTR(c_prefixes)); Py_END_ALLOW_THREADS; if (res != 0) { PyXmlSec_SetLastError("cannot add 'inclusive' namespaces to the ExcC14N transform node"); goto ON_FAIL; } Py_DECREF(prefixes); PYXMLSEC_DEBUG("transform_add_c14n_inclusive_namespaces - ok"); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUG("transform_add_c14n_inclusive_namespaces - fail"); Py_XDECREF(prefixes); return NULL; } static PyMethodDef PyXmlSec_TemplateMethods[] = { { "create", (PyCFunction)PyXmlSec_TemplateCreate, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateCreate__doc__ }, { "add_reference", (PyCFunction)PyXmlSec_TemplateAddReference, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddReference__doc__ }, { "add_transform", (PyCFunction)PyXmlSec_TemplateAddTransform, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddTransform__doc__ }, { "ensure_key_info", (PyCFunction)PyXmlSec_TemplateEnsureKeyInfo, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateEnsureKeyInfo__doc__ }, { "add_key_name", (PyCFunction)PyXmlSec_TemplateAddKeyName, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddKeyName__doc__ }, { "add_key_value", (PyCFunction)PyXmlSec_TemplateAddKeyValue, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddKeyValue__doc__ }, { "add_x509_data", (PyCFunction)PyXmlSec_TemplateAddX509Data, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509Data__doc__ }, { "x509_data_add_issuer_serial", (PyCFunction)PyXmlSec_TemplateAddX509DataAddIssuerSerial, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataAddIssuerSerial__doc__ }, { "x509_issuer_serial_add_issuer_name", (PyCFunction)PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName__doc__ }, { "x509_issuer_serial_add_serial_number", (PyCFunction)PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber__doc__ }, { "x509_data_add_subject_name", (PyCFunction)PyXmlSec_TemplateAddX509DataAddSubjectName, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataAddSubjectName__doc__ }, { "x509_data_add_ski", (PyCFunction)PyXmlSec_TemplateAddX509DataAddSKI, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataAddSKI__doc__ }, { "x509_data_add_certificate", (PyCFunction)PyXmlSec_TemplateAddX509DataAddCertificate, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataAddCertificate__doc__ }, { "x509_data_add_crl", (PyCFunction)PyXmlSec_TemplateAddX509DataAddCRL, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddX509DataAddCRL__doc__ }, { "add_encrypted_key", (PyCFunction)PyXmlSec_TemplateAddEncryptedKey, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateAddEncryptedKey__doc__ }, { "encrypted_data_create", (PyCFunction)PyXmlSec_TemplateCreateEncryptedData, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateCreateEncryptedData__doc__ }, { "encrypted_data_ensure_key_info", (PyCFunction)PyXmlSec_TemplateEncryptedDataEnsureKeyInfo, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateEncryptedDataEnsureKeyInfo__doc__ }, { "encrypted_data_ensure_cipher_value", (PyCFunction)PyXmlSec_TemplateEncryptedDataEnsureCipherValue, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateEncryptedDataEnsureCipherValue__doc__ }, { "transform_add_c14n_inclusive_namespaces", (PyCFunction)PyXmlSec_TemplateTransformAddC14NInclNamespaces, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TemplateTransformAddC14NInclNamespaces__doc__, }, {NULL, NULL} /* sentinel */ }; static PyModuleDef PyXmlSec_TemplateModule = { PyModuleDef_HEAD_INIT, STRINGIFY(MODULE_NAME) ".template", PYXMLSEC_TEMPLATES_DOC, -1, PyXmlSec_TemplateMethods, /* m_methods */ NULL, /* m_slots */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL, /* m_free */ }; int PyXmlSec_TemplateModule_Init(PyObject* package) { PyObject* template = PyModule_Create(&PyXmlSec_TemplateModule); if (!template) goto ON_FAIL; PYXMLSEC_DEBUGF("%p", template); if (PyModule_AddObject(package, "template", template) < 0) goto ON_FAIL; return 0; ON_FAIL: Py_XDECREF(template); return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/tree.c0000644000076500000240000002047414441560770013656 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "common.h" #include "utils.h" #include "lxml.h" #include #define PYXMLSEC_TREE_DOC "Common XML utility functions" static char PyXmlSec_TreeFindChild__doc__[] = \ "find_child(parent, name, namespace)\n" "Searches a direct child of the ``parent`` node having given ``name`` and ``namespace`` href.\n\n" ":param parent: the pointer to XML node\n" ":type parent: :class:`lxml.etree._Element`\n" ":param name: the name\n" ":type name: :class:`str`\n" ":param namespace: the namespace href (optional)\n" ":type namespace: :class:`str`\n" ":return: the pointer to the found node or :data:`None` if node is not found\n" ":rtype: :class:`lxml.etree._Element` or :data:`None`"; static PyObject* PyXmlSec_TreeFindChild(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "parent", "name", "namespace", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* name = NULL; const char* ns = (const char*)xmlSecDSigNs; xmlNodePtr res; PYXMLSEC_DEBUG("tree find_child - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&s|s:find_child", kwlist, PyXmlSec_LxmlElementConverter, &node, &name, &ns)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecFindChild(node->_c_node, XSTR(name), XSTR(ns)); Py_END_ALLOW_THREADS; PYXMLSEC_DEBUG("tree find_child - ok"); if (res == NULL) { Py_RETURN_NONE; } return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("tree find_child - fail"); return NULL; } static char PyXmlSec_TreeFindParent__doc__[] = \ "find_parent(node, name, namespace)\n" "Searches the ancestors axis of the ``node`` having given ``name`` and ``namespace`` href.\n\n" ":param node: the pointer to XML node\n" ":type node: :class:`lxml.etree._Element`\n" ":param name: the name\n" ":type name: :class:`str`\n" ":param namespace: the namespace href (optional)\n" ":type namespace: :class:`str`\n" ":return: the pointer to the found node or :data:`None` if node is not found\n" ":rtype: :class:`lxml.etree._Element` or :data:`None`"; static PyObject* PyXmlSec_TreeFindParent(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "name", "namespace", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* name = NULL; const char* ns = (const char*)xmlSecDSigNs; xmlNodePtr res; PYXMLSEC_DEBUG("tree find_parent - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&s|s:find_parent", kwlist, PyXmlSec_LxmlElementConverter, &node, &name, &ns)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecFindParent(node->_c_node, XSTR(name), XSTR(ns)); Py_END_ALLOW_THREADS; PYXMLSEC_DEBUG("tree find_parent - ok"); if (res == NULL) { Py_RETURN_NONE; } return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("tree find_parent - fail"); return NULL; } static char PyXmlSec_TreeFindNode__doc__[] = \ "find_node(node, name, namespace)\n" "Searches all children of the given ``node`` having given ``name`` and ``namespace`` href.\n\n" ":param node: the pointer to XML node\n" ":type node: :class:`lxml.etree._Element`\n" ":param name: the name\n" ":type name: :class:`str`\n" ":param namespace: the namespace href (optional)\n" ":type namespace: :class:`str`\n" ":return: the pointer to the found node or :data:`None` if node is not found\n" ":rtype: :class:`lxml.etree._Element` or :data:`None`"; static PyObject* PyXmlSec_TreeFindNode(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "name", "namespace", NULL}; PyXmlSec_LxmlElementPtr node = NULL; const char* name = NULL; const char* ns = (const char*)xmlSecDSigNs; xmlNodePtr res; PYXMLSEC_DEBUG("tree find_node - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&s|s:find_node", kwlist, PyXmlSec_LxmlElementConverter, &node, &name, &ns)) { goto ON_FAIL; } Py_BEGIN_ALLOW_THREADS; res = xmlSecFindNode(node->_c_node, XSTR(name), XSTR(ns)); Py_END_ALLOW_THREADS; PYXMLSEC_DEBUG("tree find_node - ok"); if (res == NULL) { Py_RETURN_NONE; } return (PyObject*)PyXmlSec_elementFactory(node->_doc, res); ON_FAIL: PYXMLSEC_DEBUG("tree find_node - fail"); return NULL; } static char PyXmlSec_TreeAddIds__doc__[] = \ "add_ids(node, ids) -> None\n" "Registers ``ids`` as ids used below ``node``. ``ids`` is a sequence of attribute names "\ "used as XML ids in the subtree rooted at ``node``.\n"\ "A call to :func:`~.add_ids` may be necessary to make known which attributes contain XML ids.\n"\ "This is the case, if a transform references an id via ``XPointer`` or a self document uri and " "the id inkey_data_formation is not available by other means (e.g. an associated DTD or XML schema).\n\n" ":param node: the pointer to XML node\n" ":type node: :class:`lxml.etree._Element`\n" ":param ids: the list of ID attributes.\n" ":type ids: :class:`list` of strings"; static PyObject* PyXmlSec_TreeAddIds(PyObject* self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "node", "ids", NULL}; PyXmlSec_LxmlElementPtr node = NULL; PyObject* ids = NULL; const xmlChar** list = NULL; Py_ssize_t n; PyObject* tmp; PyObject* key; Py_ssize_t i; PYXMLSEC_DEBUG("tree add_ids - start"); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O:add_ids", kwlist, PyXmlSec_LxmlElementConverter, &node, &ids)) { goto ON_FAIL; } n = PyObject_Length(ids); if (n < 0) goto ON_FAIL; list = (const xmlChar**)xmlMalloc(sizeof(xmlChar*) * (n + 1)); if (list == NULL) { PyErr_SetString(PyExc_MemoryError, "no memory"); goto ON_FAIL; } for (i = 0; i < n; ++i) { key = PyLong_FromSsize_t(i); if (key == NULL) goto ON_FAIL; tmp = PyObject_GetItem(ids, key); Py_DECREF(key); if (tmp == NULL) goto ON_FAIL; list[i] = XSTR(PyUnicode_AsUTF8(tmp)); Py_DECREF(tmp); if (list[i] == NULL) goto ON_FAIL; } list[n] = NULL; Py_BEGIN_ALLOW_THREADS; xmlSecAddIDs(node->_doc->_c_doc, node->_c_node, list); Py_END_ALLOW_THREADS; PyMem_Free(list); PYXMLSEC_DEBUG("tree add_ids - ok"); Py_RETURN_NONE; ON_FAIL: PYXMLSEC_DEBUG("tree add_ids - fail"); xmlFree(list); return NULL; } static PyMethodDef PyXmlSec_TreeMethods[] = { { "find_child", (PyCFunction)PyXmlSec_TreeFindChild, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TreeFindChild__doc__, }, { "find_parent", (PyCFunction)PyXmlSec_TreeFindParent, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TreeFindParent__doc__, }, { "find_node", (PyCFunction)PyXmlSec_TreeFindNode, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TreeFindNode__doc__, }, { "add_ids", (PyCFunction)PyXmlSec_TreeAddIds, METH_VARARGS|METH_KEYWORDS, PyXmlSec_TreeAddIds__doc__, }, {NULL, NULL} /* sentinel */ }; static PyModuleDef PyXmlSec_TreeModule = { PyModuleDef_HEAD_INIT, STRINGIFY(MODULE_NAME) ".tree", PYXMLSEC_TREE_DOC, -1, PyXmlSec_TreeMethods, /* m_methods */ NULL, /* m_slots */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL, /* m_free */ }; int PyXmlSec_TreeModule_Init(PyObject* package) { PyObject* tree = PyModule_Create(&PyXmlSec_TreeModule); if (!tree) goto ON_FAIL; if (PyModule_AddObject(package, "tree", tree) < 0) goto ON_FAIL; return 0; ON_FAIL: Py_XDECREF(tree); return -1; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/utils.c0000644000076500000240000000316114441560770014051 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include "utils.h" PyObject* PyXmlSec_GetFilePathOrContent(PyObject* file, int* is_content) { PyObject* data; PyObject* utf8; PyObject* tmp = NULL; if (PyObject_HasAttrString(file, "read")) { data = PyObject_CallMethod(file, "read", NULL); if (data != NULL && PyUnicode_Check(data)) { utf8 = PyUnicode_AsUTF8String(data); Py_DECREF(data); data = utf8; } *is_content = 1; return data; } *is_content = 0; if (!PyUnicode_FSConverter(file, &tmp)) { return NULL; } return tmp; } int PyXmlSec_SetStringAttr(PyObject* obj, const char* name, const char* value) { PyObject* tmp = PyUnicode_FromString(value); int r; if (tmp == NULL) { return -1; } r = PyObject_SetAttrString(obj, name, tmp); Py_DECREF(tmp); return r; } int PyXmlSec_SetLongAttr(PyObject* obj, const char* name, long value) { PyObject* tmp = PyLong_FromLong(value); int r; if (tmp == NULL) { return -1; } r = PyObject_SetAttrString(obj, name, tmp); Py_DECREF(tmp); return r; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/utils.h0000644000076500000240000000163114441560770014056 0ustar00aminstaff// Copyright (c) 2017 Ryan Leckey // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef __PYXMLSEC_UTILS_H__ #define __PYXMLSEC_UTILS_H__ #include "platform.h" int PyXmlSec_SetStringAttr(PyObject* obj, const char* name, const char* value); int PyXmlSec_SetLongAttr(PyObject* obj, const char* name, long value); // return content if file is fileobject, or fs encoded filepath PyObject* PyXmlSec_GetFilePathOrContent(PyObject* file, int* is_content); #endif //__PYXMLSEC_UTILS_H__ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3285327 xmlsec-1.3.17/src/xmlsec/0000755000076500000240000000000015104652320014025 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712332756.0 xmlsec-1.3.17/src/xmlsec/__init__.pyi0000644000076500000240000000662014604017724016322 0ustar00aminstafffrom collections.abc import Callable, Iterable from typing import IO, Any, AnyStr, TypeVar, overload from _typeshed import GenericPath, Self, StrOrBytesPath from lxml.etree import _Element from xmlsec import constants as constants from xmlsec import template as template from xmlsec import tree as tree from xmlsec.constants import __KeyData as KeyData from xmlsec.constants import __Transform as Transform _E = TypeVar('_E', bound=_Element) def enable_debug_trace(enabled: bool = ...) -> None: ... def get_libxml_version() -> tuple[int, int, int]: ... def get_libxml_compiled_version() -> tuple[int, int, int]: ... def init() -> None: ... def shutdown() -> None: ... def cleanup_callbacks() -> None: ... def register_default_callbacks() -> None: ... def register_callbacks( input_match_callback: Callable[[bytes], bool], input_open_callback: Callable[[bytes], Any], input_read_callback: Callable[[Any, memoryview], int], input_close_callback: Callable[[Any], None], ) -> None: ... @overload def base64_default_line_size() -> int: ... @overload def base64_default_line_size(size: int) -> None: ... class EncryptionContext: key: Key | None def __init__(self, manager: KeysManager | None = ...) -> None: ... def decrypt(self, node: _Element) -> _Element: ... def encrypt_binary(self, template: _E, data: bytes) -> _E: ... def encrypt_uri(self, template: _E, uri: str) -> _E: ... def encrypt_xml(self, template: _E, node: _Element) -> _E: ... def reset(self) -> None: ... class Error(Exception): ... class InternalError(Error): ... class Key: name: str @classmethod def from_binary_data(cls: type[Self], klass: KeyData, data: AnyStr) -> Self: ... @classmethod def from_binary_file(cls: type[Self], klass: KeyData, filename: StrOrBytesPath) -> Self: ... @classmethod def from_file(cls: type[Self], file: GenericPath[AnyStr] | IO[AnyStr], format: int, password: str | None = ...) -> Self: ... @classmethod def from_engine(cls: type[Self], engine_and_key_id: AnyStr) -> Self: ... @classmethod def from_memory(cls: type[Self], data: AnyStr, format: int, password: str | None = ...) -> Self: ... @classmethod def generate(cls: type[Self], klass: KeyData, size: int, type: int) -> Self: ... def load_cert_from_file(self, file: GenericPath[AnyStr] | IO[AnyStr], format: int) -> None: ... def load_cert_from_memory(self, data: AnyStr, format: int) -> None: ... def __copy__(self: Self) -> Self: ... def __deepcopy__(self: Self) -> Self: ... class KeysManager: def add_key(self, key: Key) -> None: ... def load_cert(self, filename: StrOrBytesPath, format: int, type: int) -> None: ... def load_cert_from_memory(self, data: AnyStr, format: int, type: int) -> None: ... class SignatureContext: key: Key | None def enable_reference_transform(self, transform: Transform) -> None: ... def enable_signature_transform(self, transform: Transform) -> None: ... def register_id(self, node: _Element, id_attr: str = ..., id_ns: str | None = ...) -> None: ... def set_enabled_key_data(self, keydata_list: Iterable[KeyData]) -> None: ... def sign(self, node: _Element) -> None: ... def sign_binary(self, bytes: bytes, transform: Transform) -> bytes: ... def verify(self, node: _Element) -> None: ... def verify_binary(self, bytes: bytes, transform: Transform, signature: bytes) -> None: ... class VerificationError(Error): ... ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/src/xmlsec/constants.pyi0000644000076500000240000001117615035212077016576 0ustar00aminstaffimport sys from typing import Final, NamedTuple class __KeyData(NamedTuple): # __KeyData type href: str name: str class __KeyDataNoHref(NamedTuple): # __KeyData type href: None name: str class __Transform(NamedTuple): # __Transform type href: str name: str usage: int class __TransformNoHref(NamedTuple): # __Transform type href: None name: str usage: int DSigNs: Final[str] EncNs: Final[str] KeyDataAes: Final[__KeyData] KeyDataDes: Final[__KeyData] KeyDataDsa: Final[__KeyData] KeyDataEc: Final[__KeyData] KeyDataEcdsa: Final[__KeyData] KeyDataEncryptedKey: Final[__KeyData] KeyDataFormatBinary: Final[int] KeyDataFormatCertDer: Final[int] KeyDataFormatCertPem: Final[int] KeyDataFormatDer: Final[int] KeyDataFormatPem: Final[int] KeyDataFormatPkcs12: Final[int] KeyDataFormatPkcs8Der: Final[int] KeyDataFormatPkcs8Pem: Final[int] KeyDataFormatUnknown: Final[int] KeyDataHmac: Final[__KeyData] KeyDataName: Final[__KeyDataNoHref] KeyDataRawX509Cert: Final[__KeyData] KeyDataRetrievalMethod: Final[__KeyDataNoHref] KeyDataRsa: Final[__KeyData] KeyDataTypeAny: Final[int] KeyDataTypeNone: Final[int] KeyDataTypePermanent: Final[int] KeyDataTypePrivate: Final[int] KeyDataTypePublic: Final[int] KeyDataTypeSession: Final[int] KeyDataTypeSymmetric: Final[int] KeyDataTypeTrusted: Final[int] KeyDataTypeUnknown: Final[int] KeyDataValue: Final[__KeyDataNoHref] KeyDataX509: Final[__KeyData] NodeCanonicalizationMethod: Final[str] NodeCipherData: Final[str] NodeCipherReference: Final[str] NodeCipherValue: Final[str] NodeDataReference: Final[str] NodeDigestMethod: Final[str] NodeDigestValue: Final[str] NodeEncryptedData: Final[str] NodeEncryptedKey: Final[str] NodeEncryptionMethod: Final[str] NodeEncryptionProperties: Final[str] NodeEncryptionProperty: Final[str] NodeKeyInfo: Final[str] NodeKeyName: Final[str] NodeKeyReference: Final[str] NodeKeyValue: Final[str] NodeManifest: Final[str] NodeObject: Final[str] NodeReference: Final[str] NodeReferenceList: Final[str] NodeSignature: Final[str] NodeSignatureMethod: Final[str] NodeSignatureProperties: Final[str] NodeSignatureValue: Final[str] NodeSignedInfo: Final[str] NodeX509Data: Final[str] Ns: Final[str] NsExcC14N: Final[str] NsExcC14NWithComments: Final[str] TransformAes128Cbc: Final[__Transform] TransformAes128Gcm: Final[__Transform] TransformAes192Cbc: Final[__Transform] TransformAes192Gcm: Final[__Transform] TransformAes256Cbc: Final[__Transform] TransformAes256Gcm: Final[__Transform] TransformDes3Cbc: Final[__Transform] TransformDsaSha1: Final[__Transform] TransformEcdsaSha1: Final[__Transform] TransformEcdsaSha224: Final[__Transform] TransformEcdsaSha256: Final[__Transform] TransformEcdsaSha384: Final[__Transform] TransformEcdsaSha512: Final[__Transform] TransformEnveloped: Final[__Transform] TransformExclC14N: Final[__Transform] TransformExclC14NWithComments: Final[__Transform] TransformHmacMd5: Final[__Transform] TransformHmacRipemd160: Final[__Transform] TransformHmacSha1: Final[__Transform] TransformHmacSha224: Final[__Transform] TransformHmacSha256: Final[__Transform] TransformHmacSha384: Final[__Transform] TransformHmacSha512: Final[__Transform] TransformInclC14N: Final[__Transform] TransformInclC14N11: Final[__Transform] TransformInclC14N11WithComments: Final[__Transform] TransformInclC14NWithComments: Final[__Transform] TransformKWAes128: Final[__Transform] TransformKWAes192: Final[__Transform] TransformKWAes256: Final[__Transform] TransformKWDes3: Final[__Transform] TransformMd5: Final[__Transform] TransformRemoveXmlTagsC14N: Final[__TransformNoHref] TransformRipemd160: Final[__Transform] TransformRsaMd5: Final[__Transform] TransformRsaOaep: Final[__Transform] TransformRsaPkcs1: Final[__Transform] TransformRsaRipemd160: Final[__Transform] TransformRsaSha1: Final[__Transform] TransformRsaSha224: Final[__Transform] TransformRsaSha256: Final[__Transform] TransformRsaSha384: Final[__Transform] TransformRsaSha512: Final[__Transform] TransformSha1: Final[__Transform] TransformSha224: Final[__Transform] TransformSha256: Final[__Transform] TransformSha384: Final[__Transform] TransformSha512: Final[__Transform] TransformUsageAny: Final[int] TransformUsageC14NMethod: Final[int] TransformUsageDSigTransform: Final[int] TransformUsageDigestMethod: Final[int] TransformUsageEncryptionMethod: Final[int] TransformUsageSignatureMethod: Final[int] TransformUsageUnknown: Final[int] TransformVisa3DHack: Final[__TransformNoHref] TransformXPath: Final[__Transform] TransformXPath2: Final[__Transform] TransformXPointer: Final[__Transform] TransformXslt: Final[__Transform] TypeEncContent: Final[str] TypeEncElement: Final[str] XPath2Ns: Final[str] XPathNs: Final[str] XPointerNs: Final[str] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/xmlsec/py.typed0000644000076500000240000000007714441560770015542 0ustar00aminstaff# Marker file for PEP 561. The xmlsec package uses stub files. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1758100200.0 xmlsec-1.3.17/src/xmlsec/template.pyi0000644000076500000240000000361315062475350016377 0ustar00aminstafffrom collections.abc import Sequence from typing import Any from lxml.etree import _Element from xmlsec.constants import __Transform as Transform def add_encrypted_key( node: _Element, method: Transform, id: str | None = ..., type: str | None = ..., recipient: str | None = ... ) -> _Element: ... def add_key_name(node: _Element, name: str | None = ...) -> _Element: ... def add_key_value(node: _Element) -> _Element: ... def add_reference( node: _Element, digest_method: Transform, id: str | None = ..., uri: str | None = ..., type: str | None = ... ) -> _Element: ... def add_transform(node: _Element, transform: Transform) -> Any: ... def add_x509_data(node: _Element) -> _Element: ... def create(node: _Element, c14n_method: Transform, sign_method: Transform, id: str | None = ..., ns: str | None = ...) -> _Element: ... def encrypted_data_create( node: _Element, method: Transform, id: str | None = ..., type: str | None = ..., mime_type: str | None = ..., encoding: str | None = ..., ns: str | None = ..., ) -> _Element: ... def encrypted_data_ensure_cipher_value(node: _Element) -> _Element: ... def encrypted_data_ensure_key_info(node: _Element, id: str | None = ..., ns: str | None = ...) -> _Element: ... def ensure_key_info(node: _Element, id: str | None = ...) -> _Element: ... def transform_add_c14n_inclusive_namespaces(node: _Element, prefixes: str | Sequence[str]) -> None: ... def x509_data_add_certificate(node: _Element) -> _Element: ... def x509_data_add_crl(node: _Element) -> _Element: ... def x509_data_add_issuer_serial(node: _Element) -> _Element: ... def x509_data_add_ski(node: _Element) -> _Element: ... def x509_data_add_subject_name(node: _Element) -> _Element: ... def x509_issuer_serial_add_issuer_name(node: _Element, name: str | None = ...) -> _Element: ... def x509_issuer_serial_add_serial_number(node: _Element, serial: str | None = ...) -> _Element: ... ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/src/xmlsec/tree.pyi0000644000076500000240000000125614441560770015525 0ustar00aminstafffrom collections.abc import Sequence from typing import overload from lxml.etree import _Element def add_ids(node: _Element, ids: Sequence[str]) -> None: ... @overload def find_child(parent: _Element, name: str) -> _Element | None: ... @overload def find_child(parent: _Element, name: str, namespace: str = ...) -> _Element | None: ... @overload def find_node(node: _Element, name: str) -> _Element | None: ... @overload def find_node(node: _Element, name: str, namespace: str = ...) -> _Element | None: ... @overload def find_parent(node: _Element, name: str) -> _Element | None: ... @overload def find_parent(node: _Element, name: str, namespace: str = ...) -> _Element | None: ... ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686595287.0 xmlsec-1.3.17/src/xmlsec.cpython-39-darwin.so0000755000076500000240000053535014441663327017620 0ustar00aminstaffÏúíþ …(__TEXT__text__TEXT¸€€__stubs__TEXTÀ, À€ __stub_helper__TEXTì§D ì§€__cstring__TEXT0²Þ,0²__const__TEXTßœß__unwind_info__TEXT¬þT¬þ˜__DATA_CONST@@__got__DATA_CONST˜Ùˆ__DATA@€@€__la_symbol_ptr__DATA@È@ __data__DATAÈF OÈF__bss__DATAh–˜__common__DATA˜H__LINKEDITÀÀèú"€0À``Á¨Æ ãç?Èu PÜÜ!ý €7åF‹œ ¹Å80½Ã‹RS!±2   Y* `%/opt/homebrew/opt/libxmlsec1@1.2.37/lib/libxmlsec1-openssl.1.dylib X%/opt/homebrew/opt/libxmlsec1@1.2.37/lib/libxmlsec1.1.dylib P/opt/homebrew/opt/openssl@1.1/lib/libcrypto.1.1.dylib 8/usr/lib/libxslt.1.dylib 8 /usr/lib/libxml2.2.dylib 8d'/usr/lib/libSystem.B.dylib€8 /Users/amin/.pyenv/versions/3.9.11/lib€ /opt/homebrew/lib€8 /Users/amin/.pyenv/versions/3.9.11/lib€ /opt/homebrew/lib&8æÈ)çà´ÿÃÑüo©úg©ø_©öW©ôO©ý{©ýƒ‘öª g  Õ¡~€Rv ”€[´óª™ð 7Dù§ ” Zù7”ð€Eù£ ” Yù7a¦ Õ઀Ò^ ”àXù7A¦P Õàª"€RX ” Xù7a¦P ÕàªB€RR ”`Wù7a¦p Õં€RL ” Vù7¦P Õ઀RF ”àUù7Á¦ Õ઀R@ ” Uù7á¦p ÕàªâÿŸR: ”`Tù7À¦0 ÕE ”àS´øª!¦0 Õàªâª2 ”@Jù7@ù‘ù ÕÀXs ”õª`I´¡¤p Õàªâª$ ”`Iù7¨@ù‘¨ù¡£P Õàªâª ”@Hù7 Õ@X_ ”õªàF´a¢p Õàªâª ”àFù7¨@ù‘¨ù¡P Õàªâª ”ÀEù7 Õ XK ”õª`D´A 0 Õàªâªü”õù`Dù7¨@ù‘¨ù!Ÿp Õàªâªò”@Cù7 Õ X6 ”àù A´áp Õàªâ@ùç”àAù7â@ùH@ù‘Hùáœp ÕàªÞ”À@ù7 Õ`X" ”àù ?´á›0 Õàªâ@ùÓ”`?ù7â@ùH@ù‘HùášP ÕàªÊ”@>ù7 Õ` X ”àù <´á™0 Õàªâ@ù¿”à<ù7â@ùH@ù‘Hù™ Õશ”À;ù7 Õ` Xú”àù :´˜0 Õàªâ@ù«”`:ù7â@ùH@ù‘Hù—P Õઢ”@9ù7 Õ Xæ”àù 7´–0 Õàªâ@ù—”à7ù7â@ùH@ù‘Hù•P Õ઎”À6ù7 ÕàXÒ”àù 5´”0 Õàªâ@ùƒ”`5ù7â@ùH@ù‘Hù“p Õàªz”@4ù7 Õ X¾”àù 2´!’ Õàªâ@ùo”à2ù7â@ùH@ù‘Hù‘P Õàªf”À1ù7@ùñùaTહ”à Õh”@8´ûªA ÕàªâªU”@9ù7h@ù‘hù Õ`ýX–”àù@8´áŽp Õàªâ@ùG”8ù7â@ùH@ù‘Hù!ŽP Õàª>”à6ù7 Õ ûX‚”àùÀ5´!P Õàªâ@ù3”€5ù7â@ùH@ù‘HùaŒ0 Õàª*”`4ù7h@ùñhùaTàª}”@‹0 Õ,”À0´õª¡Š0 Õàªâª”À2ù7¨@ù‘¨ù Õ óXZ”àùÀ1´‰P Õàªâ@ù ”À1ù7â@ùH@ù‘HùAˆ Õઔ 0ù7 Õ ñXF”àù@/´A‡P Õàªâ@ù÷”@/ù7â@ùH@ù‘Hù†0 Õàªî” .ù7 Õ éX2”àùÀ,´¡…0 Õàªâ@ùã”À,ù7â@ùH@ù‘HùA… ÕàªÚ” +ù7 ÕàëX”àù@*´Á„ Õàªâ@ùÏ”@*ù7â@ùH@ù‘Hù!„ ÕàªÆ” )ù7 ÕàéX ”àùÀ'´aƒ0 Õàªâ@ù»”À'ù7â@ùH@ù‘HùÁ‚ Õલ” &ù7 Õ çXö”àù@%´‚ Õàªâ@ù§”@%ù7â@ùH@ù‘Hù Õઞ” $ù7 Õ`àXâ”àùÀ"´á€0 Õàªâ@ù“”À"ù7â@ùH@ù‘Hù!€P Õઊ” !ù7 Õ ÞXΔàù@ ´a Õàªâ@ù”@ ù7â@ùH@ù‘Hù¡~ Õàªv” ù7 Õ`ÞXº”àùÀ´Á}0 Õàªâ@ùk”Àù7â@ùH@ù‘Hùá| Õàªb” ù7 Õ ÛX¦”àù@´Á{p Õàªâ@ùW”@ù7â@ùH@ù‘Hù{ ÕàªN” ù7 ÕàÖX’”àùÀ´z0 Õàªâ@ùC”Àù7â@ùH@ù‘HùAyp Õàª:” ù7 Õ ÔX~”àù@´xP Õàªâ@ù/”@ù7â@ùH@ù‘HùÁwp Õàª&” ù7 Õ`ÒXj”àùÀ´w0 Õàªâ@ù”Àù7â@ùH@ù‘HùavP Õઔ ù7 Õ`ÐXV”àù@´Áu Õàªâ@ù”@ù7â@ùH@ù‘Hù!up Õàªþ” ù7 Õ ÍXB”àùÀ´tp Õàªâ@ùó”Àù7â@ùH@ù‘Hù!t Õàªê”  ù7 ÕàÈX.”àù@ ´sP Õàªâ@ùß”@ ù7â@ùH@ù‘HùÁr0 ÕàªÖ” ù7 ÕàÆX”àùÀ ´áq0 Õàªâ@ùË”À ù7â@ùH@ù‘Hù!q0 ÕàªÂ” ù7 Õ ÄX”àù@´ApP Õàªâ@ù·”@ù7â@ùH@ù‘Hù¡oP Õમ” ù7 Õ ÂXò”àùÀ´ánp Õàªâ@ù£”Àù7â@ùH@ù‘HùAn0 Õચ” ù7 Õ ÂXÞ”àù@´m Õàªâ@ù”@ù7â@ùH@ù‘HùÁl0 Õઆ” ù7 Õ ÀXÊ”àùÀÿ´ákp Õàªâ@ù{”Àÿø7â@ùH@ù‘Hù!k0 Õàªr” þø7 Õ`¾X¶”àù@ý´!jp Õàªâ@ùg”@ýø7â@ùH@ù‘Hùi0 Õàª^” üø7 Õ ºX¢”àùÀú´Áh Õàªâ@ùS”Àúø7â@ùH@ù‘Hùág ÕàªJ” ùø7 Õà·XŽ”àù@ø´áf0 Õàªâ@ù?”@øø7â@ùH@ù‘Hùf0 Õàª6” ÷ø7 ÕàµXz”àùÀõ´eP Õàªâ@ù+”Àõø7â@ùH@ù‘Hù!dp Õàª"” ôø7 ÕàµXf”àù@ó´Ac0 Õàªâ@ù”@óø7â@ùH@ù‘HùabP Õઔ òø7¨@ùñ¨ùaTàªa”`a Õ”@í´úªÁ` Õàªâªý” ðø7H@ù‘Hù€Òë”àùÀï´a_P Õàªâ@ùð”`ïø7â@ùH@ù‘HùÁ^p Õàªç”@îø7 €RØ”àù`í´á]p Õàªâ@ùÝ”íø7â@ùH@ù‘HùA]p ÕàªÔ”àëø7@€RÅ”àùë´a\P Õàªâ@ùÊ” êø7â@ùH@ù‘Hù¡[p ÕàªÁ”€éø7`€R²”àù è´¡Zp Õàªâ@ù·”@èø7â@ùH@ù‘HùZ Õમ” çø7€€RŸ”àù@æ´Y Õàªâ@ù¤”àåø7â@ùH@ù‘HùaXP Õછ”Àäø7 €RŒ”àùàã´¡W Õàªâ@ù‘”€ãø7â@ùH@ù‘HùWP Õઈ”`âø7À€Ry”àù€á´AV Õàªâ@ù~” áø7â@ùH@ù‘Hù¡U Õàªu”àø7à€Rf”àù ß´ÁTp Õàªâ@ùk”ÀÞø7â@ùH@ù‘HùAT Õàªb” Ýø7€RS”àùÀÜ´aS0 Õàªâ@ùX”`Üø7â@ùH@ù‘HùÁRP ÕàªO”@Ûø7H@ùñHùaTઢ” Qp ÕQ”`Õ´üªQp Õàªâª>”ÀÓø7ˆ@ù‘ˆù€Ò,”àùàÒ´ÁOp Õàªâ@ù1” Øø7â@ùH@ù‘HùáFp Õàª(”×ø7€Ò”àù€Ð´NP Õàªâ@ù”ÀÕø7â@ùH@ù‘HùAMP Õઔ Ôø7 €R”àù δALp Õàªâ@ù ”`Óø7â@ùH@ù‘Hù¡K0 Õઔ@Òø7@€Ró”àùÀË´ÁJ Õàªâ@ùø”Ñø7â@ùH@ù‘HùJp Õàªï”àÏø7€€Rà”àù`É´!Ip Õàªâ@ùå” Îø7â@ùH@ù‘Hù¡H ÕàªÜ”€Íø7€RÍ”àùÇ´ÁGP Õàªâ@ùÒ”@Ìø7â@ùH@ù‘Hù!G0 ÕàªÉ” Ëø7€Rº”àù Ä´AF0 Õàªâ@ù¿”àÉø7â@ùH@ù‘Hù¡EP Õશ”ÀÈø7 €R§”àù@´áD Õàªâ@ù¬”€Çø7â@ùH@ù‘Hù!Dp Õણ”`Æø7àÿŸR””àùà¿´ACp Õàªâ@ù™” Åø7â@ùH@ù‘HùBP Õàª”Äø7ˆ@ùñˆùaTàªã”@AP Õ’”€½´÷ª¡@P Õàªâª”ÀÂø7è@ù‘èùa”õª€EùË”àù Á´â@ùUùÁ>P Õàªo”Áø7â@ùH@ù‘Hù>P Õàªf”à¿ø7Q”õª€Eùµ”àùྴâ@ùUù<p ÕàªY”@¾ø7â@ùH@ù‘Hùá; ÕàªP” ½ø78”õª€EùŸ”àù ¼´â@ùUùa:P ÕàªC”€»ø7â@ùH@ù‘Hù:0 Õàª:”`ºø7”õª€Eù‰”àù`¹´â@ùUùá80 Õàª-”À¸ø7â@ùH@ù‘Hùa80 Õàª$” ·ø7Q”õª€Eùs”àù ¶´â@ùUù!7P Õઔ¶ø7â@ùH@ù‘Hùa60 Õàª”à´ø7>”õª€Eù]”àùà³´â@ùUùá40 Õઔ@³ø7â@ùH@ù‘Hù!4 Õàªø” ²ø7+”õª€EùG”àù ±´â@ùUù¡2 Õàªë”€°ø7â@ùH@ù‘HùÁ1p Õàªâ”`¯ø7”õª€Eù1”àù`®´â@ùUùA0p ÕàªÕ”À­ø7â@ùH@ù‘Hù¡/ ÕàªÌ” ¬ø7”õª€Eù”àù «´â@ùUù!.P Õિ”«ø7â@ùH@ù‘Hùa-P Õશ”à©ø7õ”õª€Eù”àù਴â@ùUùá+p Õ઩”@¨ø7â@ùH@ù‘Hù!+P Õઠ” §ø7â”õª€Eùï”àù ¦´â@ùUù¡)P Õઓ”€¥ø7â@ùH@ù‘Hùá(P Õઊ”`¤ø7Æ”õª€EùÙ”àù`£´â@ùUùa'p Õàª}”À¢ø7â@ùH@ù‘Hùá&P Õàªt” ¡ø7è@ùñèùaTàªÇ”à%P Õv”àùà™´A%P Õàªâ@ùc”@ ø7é@ù(@ù‘(ùs”÷ª 7Dù®”àùŸ´â@ùWùa# ÕàªR”àšø7à @©H@ù‘HùÁ"P ÕJ”à™ø7a”÷ª 7Dù™”àù`œ´â@ùWùa!p Õàª=”@˜ø7à @©H@ù‘HùA!0 Õ5”@—ø7C”÷ª 7Dù„”àùÀ™´â@ùWù! p Õàª(” •ø7à @©H@ù‘Hù¡p Õ ” ”ø71”÷ª 7Dùo”àù —´â@ùWùaP Õઔ“ø7à @©H@ù‘HùAP Õ ”’ø7”÷ª 7DùZ”àù€”´â@ùWùAP Õàªþ”`ø7à @©H@ù‘HùÁ Õö”`ø7”÷ª 7DùE”àùà‘´â@ùWùP Õàªé”Àø7à @©H@ù‘Hùa Õá”ÀŒø7æ”÷ª 7Dù0”àù@´â@ùWùap ÕàªÔ” ‹ø7à @©H@ù‘HùáP ÕÌ” Šø7ø”÷ª 7Dù”àù Œ´â@ùWùÁ Õિ”€ˆø7à @©H@ù‘Hùá×p Õ·”€‡ø7à”÷ª 7Dù”àùŠ´â@ùWùp Õપ”à…ø7à @©H@ù‘HùÁÕP Õ¢”à„ø7Ñ”÷ª 7Dùñ”àù`‡´â@ùWùap Õક”@ƒø7à @©H@ù‘HùÁÓ Õ”@‚ø7§”÷ª 7DùÜ”àùÀ„´â@ùWùa0 Õ઀” €ø7à @©H@ù‘Hù! Õx” ø7ž”÷ª 7DùÇ”àù ‚´â@ùWùA0 Õàªk”~ø7à @©H@ù‘HùÁ0 Õc”}ø7¨”÷ª 7Dù²”àù€´â@ùWù¡0 ÕàªV”`{ø7à @©H@ù‘Hù! ÕN”`zø7™”÷ª 7Dù”àùà|´â@ùWùÁ p ÕàªA”Àxø7à @©H@ù‘HùA P Õ9”Àwø7Š”÷ª 7Dùˆ”àù@z´â@ùWù 0 Õàª,” vø7à @©H@ù‘Hù  Õ$” uø7¥”÷ª 7Dùs”àù w´â@ùWù! p Õઔ€sø7à @©H@ù‘Hù¡ 0 Õ”€rø7“”÷ª 7Dù^”àùu´â@ùWùap Õઔàpø7à @©H@ù‘Hùá0 Õú”àoø7”÷ª 7DùI”àù`r´â@ùWù¡p Õàªí”@nø7à @©H@ù‘Hù!0 Õå”@mø7<”÷ª 7Dù4”àùÀo´â@ùWùáp ÕàªØ” kø7à @©H@ù‘Hùa ÕД jø7Z”÷ª 7Dù”àù m´â@ùWù0 ÕàªÃ”iø7à @©H@ù‘Hùa0 Õ»”hø7”÷ª 7Dù ”àù€j´â@ùWù!0 Õમ”`fø7à @©H@ù‘HùP Õ¦”`eø7Ø”÷ª 7Dùõ”àùàg´â@ùWùAÿp Õઙ”Àcø7à @©H@ù‘Hù¡þ0 Õ‘”Àbø7î”÷ª 7Dùà”àù@e´â@ùWùAýP Õ઄” aø7à @©H@ù‘HùÁü0 Õ|” `ø7Ü”÷ª 7DùË”àù b´â@ùWù¡û Õàªo”€^ø7à @©H@ù‘Hù!û0 Õg”€]ø7Ê”÷ª 7Dù¶”àù`´â@ùWùúP ÕàªZ”à[ø7à @©H@ù‘Hùùp ÕR”àZø7¸”÷ª 7Dù¡”àù`]´â@ùWùø ÕàªE”@Yø7à @©H@ù‘Hùø0 Õ=”@Xø7¦”÷ª 7DùŒ”àùÀZ´â@ùWùáöP Õàª0” Vø7à @©H@ù‘Hùaöp Õ(” Uø7””÷ª 7Dùw”àù X´â@ùWùaõ ÕઔTø7à @©H@ù‘HùÁô0 Õ”Sø7‚”÷ª 7Dùb”àù€U´â@ùWùóP Õઔ`Qø7à @©H@ù‘Hù!ó0 Õþ”`Pø7p”÷ª 7DùM”àùàR´â@ùWù!ò Õàªñ”ÀNø7à @©H@ù‘HùñP Õé”ÀMø7^”÷ª 7Dù8”àù@P´â@ùWùað ÕàªÜ” Lø7à @©H@ù‘Hùáï ÕÔ” Kø7L”÷ª 7Dù#”ÀM´ôªùáî ÕàªâªÇ”€Mø7ˆ@ù‘ˆùaî Õà@ù⪾”`Lø79”÷ª 7Dù ”K´ôªù!í Õàªâª±”ÀJø7ˆ@ù‘ˆù¡ì Õà@ù⪨” Iø7&”÷ª 7Dù÷”@H´ôªùaë Õàªâª›”Hø7ˆ@ù‘ˆùáê Õà@ù⪒”àFø7%”÷ª 7DùᔀE´ôªù¡é Õàªâª…”@Eø7ˆ@ù‘ˆùé Õà@ùâª|” Dø7”÷ª 7DùË”ÀB´ôªù¡ç Õàªâªo”€Bø7ˆ@ù‘ˆù!çP Õà@ùâªf”`Aø7”÷ª 7Dùµ”@´ôªùæ ÕàªâªY”À?ø7ˆ@ù‘ˆùaå0 Õà@ùâªP” >ø7ò”÷ª 7DùŸ”@=´ôªùäP ÕàªâªC”=ø7ˆ@ù‘ˆùã0 Õà@ùâª:”à;ø7ß”÷ª 7Dù‰”€:´ôªùAâ Õàªâª-”@:ø7ˆ@ù‘ˆù¡áp Õà@ùâª$” 9ø7Ì”÷ª 7Dùs”À7´ôªùaàP Õàªâª”€7ø7ˆ@ù‘ˆùáß0 Õà@ù⪔`6ø7¹”÷ª 7Dù]”5´ôªù¡Þ Õàªâª”À4ø7ˆ@ù‘ˆùÞp Õà@ùâªø” 3ø7‘”÷ª 7DùG”@2´ôªùÁÜP Õàªâªë”2ø7ˆ@ù‘ˆùAÜ Õà@ùâªâ”à0ø7x”÷ª 7Dù1”€/´ôªùáÚP ÕàªâªÕ”@/ø7ˆ@ù‘ˆùAÚp Õà@ùâªÌ” .ø7Y”÷ª 7Dù”À,´ôªùÙ Õàªâª¿”€,ø7ˆ@ù‘ˆùAØ0 Õà@ù⪶”`+ø7F”÷ª 7Dù”*´ôªùÁÖ0 Õàªâª©”À)ø7ˆ@ù‘ˆùAÖ Õà@ù⪠” (ø7N”÷ª 7Dùï”@'´ôªùáÔP Õàªâª“”'ø7ˆ@ù‘ˆùAÔ Õà@ù⪊”à%ø7;”÷ª 7DùÙ”€$´ôªùÁÒ0 Õàªâª}”@$ø7ˆ@ù‘ˆù!Ò0 Õà@ùâªt” #ø7(”÷ª 7DùÔÀ!´ôªùÁÐ Õàªâªg”€!ø7ˆ@ù‘ˆù!Ð Õà@ùâª^”` ø7”÷ª 7Dù­”´ôªù¡Îp ÕàªâªQ”Àø7ˆ@ù‘ˆùÎp Õà@ùâªH” ø7”÷ª 7Dù—”@´ôªù¡ÌP Õàªâª;”ø7ˆ@ù‘ˆùÌP Õà@ùâª2”àø7z”÷ª 7Dù”€´ôªù¡Ê0 Õàªâª%”@ø7ˆ@ù‘ˆù!Ê Õà@ù⪔ ø7j”÷ª 7Dùk”À´ôªùÁÈp Õàªâª”€ø7ˆ@ù‘ˆùAÈP Õà@ù⪔`ø7Z”÷ª 7DùU”´ôªùÇ0 Õàªâªù”Àø7ˆ@ù‘ˆùÆ Õà@ùâªð” ø7é@ù(@ùñ(ùaTà@ùB”!Åp Õàªâªã” ø7€RN€Ò€Ò€Ò€Ò€Ò€Òõù€Òÿù€Ò€Ò€Ò€Òà@ù@ùñùAT&”ô@ùø´@ùñùaTઔõ´¨@ùñ¨ùaTઔô´ˆ@ùñˆùaTઔû´h@ùñhùaTઠ”ú´H@ùñHùaTઔ÷´è@ùñèùaTàªû”ü´ˆ@ùñˆùaTàªô”h@ùñhùaTàªî”€ý{F©ôOE©öWD©ø_C©úgB©üoA©ÿÑÀ_Ö€Ò€Ò€ÒÓÿÿ€Ò€Òÿù¯ÿÿ€Ò€Ò€Ò€Ò€Ò»ÿÿ€Ò¥ÿÿ€Ò€Ò£ÿÿ€Ò€ÒÈÿÿ€Ò€Òÿù€Òÿÿ€Ò€Òÿù€Ò€Ò€Ò˜ÿÿ€ÒÁÿÿ€Ò€Òÿù€Ò€Òÿÿ€Ò€Ò€Ò€Òô@ù ÿÿ€Ò€Ò€Ò€Ò€Ò€Òôù‚ÿÿ@ù¡@ù ÖÿÃÑüo©ý{©ýƒ‘ Õˆ³X@ù¨ƒø @ùH¥@©J@¹É´é«©èù¢²p Õè+©³p Õàs‘%€R¢”às‘”¨ƒ^ø ÕɰX)@ù?ë¡Tý{V©üoU©ÿÑÀ_Ö‰”ÿÃÑüo©ý{©ýƒ‘ Õ¯X@ù¨ƒø@ù¥@©©´è'©"°p Õèùâ¯P Õàs‘%€R€”às‘]”¨ƒ^ø Õ‰¬X)@ù?ë¡Tý{V©üoU©ÿÑÀ_Ög”@ù@ùO@ù @ù@´K Õà©X@ù‘ùÀ_Ö@ù@¹î@ù¡@ù ÖÿÃÑüo©ý{©ýƒ‘ Õh¨X@ù¨ƒø@ù @ù@ù©´è'©B¬0 Õèùb¬p Õàs‘%€RJ”às‘'”¨ƒ^ø ÕÉ¥X)@ù?ë¡Tý{V©üoU©ÿÑÀ_Ö1”ÿÃÑüo©ý{©ýƒ‘ Õ¤X@ù¨ƒø@ù @ù@ù©´è'©¥p Õèù¤P Õàs‘%€R'”às‘”¨ƒ^ø Õi¡X)@ù?ë¡Tý{V©üoU©ÿÑÀ_Ö”@ù@ùö@ù @ù@´ò ÕÀžX@ù‘ùÀ_ÖôO¾©ý{©ýC‘󪔀–FùÙ” ø7ˆ–Fù @ù)‘ ù‚–Fù¥P Õઓ”`ø7€R€ý{A©ôO¨À_ÖôO¾©ý{©ýC‘óª@ù@´'”`@ùÀ´@ùñùATØ”h@ù¡@ùàªý{A©ôO¨ ÖÿÑôO©ý{©ýÑèªóªÿùéc‘ ß Õê'©¾0 Õà Õàªáª±”4è@ùh´ @ù€Òþ”` ù ´€Rè@ùhù à»P Õþ”à@ùÀ´@ùñùAT©”€ý{C©ôOB©ÿ‘À_Öý{¿©ý‘€”@´|©ý{Á¨À_ÖÿÃÑöW©ôO©ý{©ýƒ‘èªàª¿ƒø‰  Õÿ§©é£‘êÑê'©©£Ñê~ Õê'©BŸp Õ Õáªv”à4â‡B©¨ƒ]ø @ù¢´¦”€Ò¥”ôª€´@ùA´¨ƒ]ø @ù!@ù"€RŸ”󪨃]ø @ù!@ù᪔ë@TÀ´Aœ Õ€Ò!›0 Õ Õ ÕI XÛ” Õ(‹X@ùàª?Ö€Òý{F©ôOE©öWD©ÿÑÀ_ÖÕ”õª¨ƒ]ø @ù!@ù€Òâªãª]”àªÈ” ÕhˆX@ùàª?Ö ÕÀ†X@ù‘ùæÿÿÿÑôO©ý{©ýÑèªóªÿùéc‘ês Õê'©â•p Õù Õàªáª”€4¬”ôª` @ùè@ù @ùv”óªàª¡”óø7 Õ`‚X@ù‘ù “p Õf”€Òý{C©ôOB©ÿ‘À_ÖÿCÑöW©ôO©ý{©ý‘èªóªÿùéc‘jn Õê'©"‘P Õô Õàªáªñ”à4€”ôª` @ùè@ù @ùM”õªàªu”uø7h @ù‰C¹qaT Õ`|X@ù‘ù Ž Õ6” Õ Õ: X¡0 Õ]”€Òý{D©ôOC©öWB©ÿC‘À_ÖÿƒÑôO©ý{©ýC‘èªóª¿>©ÿù Õ ÕIºXªcÑé+©é£‘ªƒÑê'©¢‹p Õí Õàªáªµ”@4h @ùi€R y¹¡#~©â+@¹ @ùઔ`4€Ò h @ùÁAùî”ôªh @ùÁAùí”á*ઠ”ý{E©ôOD©ÿƒ‘À_ÖÿCÑöW©ôO©ý{©ý‘èªóª¿=©¿ƒøÿÿ© Õ Õé³Xêã‘ë‘ë+©ª£Ñé+©©ãѪÃÑÂŒp Õê'©ç Õàªáª” 4h @ù‰€R y¹¡#}©¢ƒ\¸ @ùàªÜ”€5”ôªh @ùÉAùá#@ùâ;@¹ ‘G”õªàªø”•ø7h @ùÉAù @¹ q¡T Õ lX@ù‘ù Õ ÕÀ* Xˆ Õ Õ Õ* X¡}0 Õ:”€Òý{H©ôOG©öWF©ÿC‘À_ÖÿÑôO©ý{©ýÑèªóªÿù Õ ÕiªXêc‘é+©b…0 ÕCß Õàªáª9”€4È”ôª` @ùè@ù @ùŒ”óªàª½”óø7 ÕàeX@ù‘ù@ƒp Õ‚”€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªóªÿù Õ Õé¤Xêc‘é+©âP ÕCÚ Õàªáª ”€4œ”ôª` @ùè@ù @ùc”óªàª‘”óø7 Õ``X@ù‘ùà ÕV”€Òý{C©ôOB©ÿ‘À_ÖÿÑöW©ôO©ý{©ýÑèªôªé#‘é©B Õ£Õ Õàªáªä”`4à@ù±” ´óªˆ @ùÁ‘àªR”àªv”À´ôªö© ÕÁ@ùન”`4 @ùàªB”Àø7ˆ@ùñˆùaTàªÖ”àªb”ôªàýÿµh@ùñhùaTàªÌ” ÕÀWX@ù‘ù ÕHVX@ùyp Õ<” yp Õ ”ˆ@ùñˆùaTશ”h@ùñhùaTર”€Òý{C©ôOB©öWA©ÿ‘À_ÖöW½©ôO©ý{©ýƒ‘h`@9è7 Õ Õ  Xg Õóª@ù ¹Aù)´ ÉAùI´ Õ Õ  XAg0 Õ Õ Õà X¡eP Õ”€ý{B©ôOA©öWèÀ_Öôªõª ‘áª,”h @ùÉùh @ù ÉAùé´yC¹( ¹h @ùÉAùA‘?”h @ù¹AùA‘€Ò”q¡Th @ùÉAù¹Aù1”`ø7h @ùùh @ù ¹è”öªh @ù ‘áªâª”ôªàªÜ”ôø7€Rh @ù Aù ÁùÍÿÿ€aP Õ `b ÕÀb Õàb Õ™”¿ÿÿôO¾©ý{©ýC‘@ù¹Aù´óªg”h @ù¹Aùù¹ ÕàEX@ù‘ùý{A©ôO¨À_ÖôO¾©ý{©ýC‘óª´ôª Õ ÕÁâXàªñ” 4€ @ù ´h @ù¹Aùˆ´àª¸”€ @ù¹”h @ù¹ùh @ù¹Aù´€Rh @ù¹Aùà´«”€Rh @ù¹ù Õ¨?X@ùadp Õ Õè>X@ùÁdP Õ” d0 ÕO”€ý{A©ôO¨À_ÖôO¾©ý{©ýC‘󪔀z@ùØ” ø7ˆz@ù @ù)‘ ù‚z@ùe0 Õ઒”`ø7€R€ý{A©ôO¨À_ÖôO¾©ý{©ýC‘óª@ù@´>”`@ùÀ´@ùñùAT×”h@ù¡@ùàªý{A©ôO¨ ÖÿÑôO©ý{©ýÑèªóªÿùéc‘ê~ Õê'©â]0 ÕcÈ Õàªáª°”4è@ùh´ @ù€Ò”` ù ´€Rè@ùhù àkp Õý”à@ùÀ´@ùñùAT¨”€ý{C©ôOB©ÿ‘À_Öý{¿©ý‘”@´|©ý{Á¨À_ÖôO¾©ý{©ýC‘óª”ôª` @ù÷”ઔ Õ€0X@ù‘ùý{A©ôO¨À_ÖÿƒÑôO©ý{©ýC‘èªóª¿>©ÿù飑ªƒÑê'©©cÑê Õê'©ÂZ0 ÕC¼ Õàªáªe” 4ô”ôª` @ù¢#~© @ùã+@¹Ã”óªàªè”óø7¨ƒ^ø @ù)‘ ù ƒ^ø@X0 Õ­”€Òý{E©ôOD©ÿƒ‘À_ÖÿCÑüo©úg©ø_©öW©ôO©ý{©ý‘èªôªÿ©éƒ‘ê Õê'©é£‘ê'©âUP Õö Õàªáª3”4è@ù @ù!Up Õ`”óª`´ Õ/XઔÀ5 Õ¡.Xઔ 4ˆ @ù)€R ¹®”õªè@ù A©:@ùè@ù @ù7@ù_ë`Tàªáª"€R7”´øªè@ù᪠€Ò% Õ Õ ß X!P ÕŽ”€Ò€ @ù @ùv”è *}Sq£Ÿš;€R_ë`T@ø6àª!”€Ò€R;€R€R€Ò€Ràªy”€ @ùè@ù @ù*”k”à´ ÕÈX@ùàª?Ö€Òý{H©ôOG©öWF©ø_E©úgD©üoC©ÿC‘À_ÖÙ6 ÕèX@ùàª?Öè@ù @ùvµè@ù @ùáª@”ëÿÿ»6K0 Õ"”àÿÿ Õ Õ@× XAI Õ»ÿÿÿCÑôO©ý{©ý‘èªóª¿ƒøÿù郑é ù©cÑj Õê'©ÂHp ÕC¦ Õàªáª©” 48”ôª` @ù¨ƒ^ø @ùâ@ù”óªàª,”óø7¨ƒ^ø @ù)‘ ù ƒ^ø Fp Õñ”€Òý{D©ôOC©ÿC‘À_ÖÿƒÑø_©öW©ôO©ý{©ýC‘èªõªÿùéc‘ªÿ Õê'©BD0 ÕC¡ Õàªáª{”4è@ù @ù@ù7€R³´àªÞ” 4è@ù @ùáªä” ´óªè@ùBp ÕèùbB0 Õk”ôª€R€Ò€Ò8€Rï”öª¨ @ù ¹è@ù @ù ÕAX Õ X¢”q蟩 @ù(¹  @ùè@ù @ù¸”÷ªàª×”  @ùè@ù @ùˆ”×ø7¨ @ùmC¹¨4è@ù¸6 @ù@ùf” ´õªô´ˆ@ùñˆùaTàªB”ó´h@ùñhùaTàª;”è@ù @ù᪞”+@:p Õ”ô´ˆ@ùñˆùaTàª,”S´h@ùñhùÁTàª%”3ô´ˆ@ùñˆùaTઔó´h@ùñhùaTઔ¨ @ù±AùL”óª¨ @ù±AùK”á*àªj”õª @ùa.p Õ*”`´õª ÕXÞ”öª ÕHÿX@ùàª?Ö–4õª% Õ Õà» X!1 Õn”€Òàªý{E©ôOD©öWC©ø_B©ÿƒ‘À_Ö Õ Õ๠X10 Õ`”±ÿÿ Õ¨ûX@ù?Öàªáªš” õÿ´õªh@ùñhùaTàªÔ”ˆ@ùñˆùüÿTàªÎ”ÝÿÿöW½©ôO©ý{©ýƒ‘óªäAùV´ôªõªÖ@ùàªáª'”´@ùñùATº”¶þÿµàªÔ”6þÿµæùý{B©ôOA©öWèÀ_ÖôO¾©ý{©ýC‘@ù©Aù´óªÍ”h @ù©Aùù¹ Õ òX@ù‘ùý{A©ôO¨À_ÖôO¾©ý{©ýC‘óª´ôª Õ ÕXàªW” 4€ @ù ´h @ù©Aùˆ´àª”€ @ù”h @ù©ùh @ù©Aù´€Rh @ù©Aùà´”€Rh @ù©ù ÕhìX@ù!p Õ Õ¨ëX@ùP Õç”`0 Õµ”€ý{A©ôO¨À_Öúg»©ø_©öW©ôO©ý{©ý‘óªôªõªöª÷ªøªùª ÕHêX@ù€R?Öúª\©P)àªa”@ ùàª^”@ùàª[”@ùàªý{D©ôOC©öWB©ø_A©úgŨÀ_Ö ´ôO¾©ý{©ýC‘óª ÕtæXˆ@ù@ù?Öˆ@ù`@ù?Öˆ@ù`@ù?Ö@ùàªý{A©ôO¨ ÖÀ_ÖÿCÑø_©öW©ôO©ý{©ý‘ôªóª€Òw”  ´öª,@¹èS©!p Õઠ”õª ´Â.€¹Ap ÕàªK” Õàªâª*”È@ù× Õñ√ Õàª!”È@ùñ√0 ÕઔÂ*€¹P Õàª1”È@ùñ√Ap Õàª”È @ùñ√¡ ÕઔÈ@ùñ√áp Õઔ ÕWÛXè@ùÀ @ù?Öè@ùÀ@ù?Öè@ùÀ@ù?Öè@ùàª?Öuµ Õ Õ— X€èS©ap Õ½”õª´àªáª=”¨@ùñ¨ùàTý{D©ôOC©öWB©ø_A©ÿC‘À_Öàªý{D©ôOC©öWB©ø_A©ÿC‘³áª Õ Õà’ X‡ÿÿý{¿©ý‘€Ò”ý{Á¨kÿÿöW½©ôO©ý{©ýƒ‘óªÀ„  Õy”`4T„  Õàªq”õªàªáªs”àªàªVÿÿ—€Òý{B©ôOA©öWèÀ_Öˆði¹À_Öý{¿©ý‘€  Õ_” 4À Õý{Á¨óý{Á¨À_ÖÿCÑúg©ø_©öW©ôO©ý{©ý‘õªóªöª÷ªùªôªøªÿÿ—Èÿÿ—1ÿÿ— ÕÈ} h4€Ràª×”€´àªÑ”kÀTZ_qáþÿT€ÒàªË” ÕˆÊX© P Õ@ù?ñ*™šñ+˜šÿñ,—šßñ)–š P Õñ®€š¿ñ­•šî7©éO©ô3©ap Õê/©àªG”ý{H©ôOG©öWF©ø_E©úgD©ÿC‘À_ÖöW½©ôO©ý{©ýƒ‘óª–ƒ  Õßùuƒ  Õ¿ùTƒ  ÕŸù ÕHÂX@ù üP ÕAüp Õ€Ò– ”Àù`´âª@üp ÕÁü Õ€Ò ” ù`´Â@ùÀüP ÕAýp Õ€Ò„ ”€ù@´Â@ùý0 Õર ”€ø7¢@ùáüp Õપ ”Àø7‚@ù¡ü0 Õત ”ø7p  ÕÍ ”@5nÿÿ—€RÀ@ùÀ´@ùñùATï ” @ùÀ´@ùñùATè ”€@ùÀ´@ùñùATá ”€ý{B©ôOA©öWèÀ_ÖÿƒÑý{©ýC‘ Õ XXÿùŠ ”ý{A©ÿƒ‘À_ÖôO¾©ý{©ýC‘óª Õ¸Xë`Tôª Õ!cX ” 4tùˆ@ù‘ˆùù €R Õ(µX@ùá÷p Õ3 ”€Rý{A©ôO¨À_ÖöW½©ôO©ý{©ýƒ‘óªuð Bù ”`ø7tð€ÖBù‰ ”àø7¨Bù @ù)‘ ùˆÖBù @ù)‘ ù¢Bùõ Õàª? ” ø7‚ÖBùaô Õàª9 ”`ø7€R€ý{B©ôOA©öWèÀ_ÖôO¾©ý{©ýC‘óª@¹h4` @ù”h@ù¡@ùàªý{A©ôO¨ Öý{¿©ý‘Y ”`´ù¹ý{Á¨À_ÖÿƒÑôO©ý{©ýC‘èªóª¿>©ÿùÿ'¹é£‘ê“‘ê'©©ƒÑªcÑê'©‚ó Õcc ÕàªáªP ”4ÿùઠ”óª€´Ú ”ôª ƒ^ø¡^¸â'@¹ã@ù€Ò€Ò”` ùàªÌ ”h @ùˆ´(€Rh¹ @ðP Õ“þÿ—h@ùñhùaTàª? ”€Òàªý{E©ôOD©ÿƒ‘À_ÖÿÃÑöW©ôO©ý{©ýƒ‘èªôªÿÿ©ÿÿ©é£‘é ùé“‘êÑê'©"íP Õ] Õàªáª ”@4à@ùბ ”À´óªè#@¹qT¿ƒø¡£Ñâc‘àªq ”`ø7¶ƒ]øµ0€Ò5àªf ”öªV´ÿùા ”À´ôªˆ ”õªè#@¹(4á@¹â'@¹ã@ù઀ҀҠ”á'@¹â@ù઀ҀҸ ”öªÀøàªp ”È@ùˆ´(€Rˆ¹ Àå0 Õ7þÿ—ˆ@ùñˆùaTàªã ”€Òh@ùñhùaTàªÜ ”àªý{F©ôOE©öWD©ÿÑÀ_ÖÿCÑôO©ý{©ý‘èªóª¿ƒø¿cxÿ#¹ Õ Õ‰æXꃑ«kÑë+©ªcÑé+©âá0 ÕCQ Õàªáª¯ ”À4ÿùàªo ”óª@´9 ”ôª¨ƒ^ø @ù¡c^xâ#@¹M ”` ùàª- ”h @ùˆ´(€Rh¹ ÀÞp Õôýÿ—h@ùñhùaTઠ ”€Òàªý{D©ôOC©ÿC‘À_ÖÿƒÑöW©ôO©ý{©ýC‘èªóªÿ© Õ Õ)ßXꃑ ÕËXë+©ê£‘é+©ÂÛ ÕÃJ Õàªáªs ”@4à@ù× ”à´ôªÿùàª/ ”@´óªù ”õªè@ù @ù᪠”` ùàªî ”h @ù¨´(€Rh¹à@ù `Õ0 Õ´ýÿ—h@ùñhùaTàª` ”à@ù´€Ò@ùñùTX ”€Òàªý{E©ôOD©öWC©ÿƒ‘À_ÖÿƒÑôO©ý{©ýC‘èªóª¿>©ÿù Õ ÕéÕX꣑«ƒÑë+©ªcÑé+©BÓP ÕcB Õàªáª* ” 4ÿùàªê ”óª ´´ ”ôª¡#~© @ùâ+@¹Õ ”` ù઩ ”h @ùˆ´(€Rh¹ àÌ0 Õpýÿ—h@ùñhùaTઠ”€Òàªý{E©ôOD©ÿƒ‘À_ÖÿCÑôO©ý{©ý‘èªóª¿ƒøÿùÿ¹és‘é ù郑ªcÑê'©Í Õ#< Õàªáªò ”€4 ”ôª` @ù¡ƒ^øã‹C)º ”óªàªv ”óø7 Õ}X@ù‘ùÀÊP Õ;ýÿ—€Òý{D©ôOC©ÿC‘À_ÖÿƒÑöW©ôO©ý{©ýC‘èªôªÿÿ©és‘ꃑéÿ©êùÂÈp Õc7 ÕàªáªÆ ”€4à@ùác‘¾ ” ´óªè@¹qATÿùᣑâC‘àª" ”ø7ö@ùÖµ%ઠ”öª6´@ ”õªè@¹€ @ùÈ4â@¹ã@¹áªv ”â@¹áªo ”ôªàª. ”´ø7h@ùñhùaTન ” Õ@sX@ù‘ù ÁP Õíüÿ—h@ùñhùaTઙ ”€Òý{E©ôOD©öWC©ÿƒ‘À_ÖÿÑöW©ôO©ý{©ýÑÐ@©ÿù@ ”óªŸñ@úàT ”õªàª ”` ùàªÿ ”h @ùˆ´(€Rh¹ `½P ÕÆüÿ—h@ùñhùaTàªr ”€Òàªý{C©ôOB©öWA©ÿ‘À_Öý{¿©ý‘@ù ´ ”`´ý{Á¨Q  Õ(jX@ù¡ºp ÕÙ ”€Ò Õ iX@ù‘ùý{Á¨À_ÖôO¾©ý{©ýC‘óª@ù€´A´àª0 ”À´áª` @ùò ” ø6€¸p Õ Õ(fX@ù¡¶p Õ¹ ”æ ”`ø7€R@¶ Õƒüÿ—€ý{A©ôO¨À_ÖôO¾©ý{©ýC‘óª@ù@´Û ”h@ù¡@ùàªý{A©ôO¨ ÖôO¾©ý{©ýC‘óªÍ ”à´ôªÓ ”àø7€Rt ù  ¹P ÕàªÄ ” ¹ Õ^üÿ—€ý{A©ôO¨À_Öý{¿©ý‘è ”@´ùý{Á¨À_ÖÿCÑöW©ôO©ý{©ý‘èªóªÿù Õ©üXêc‘é+©±0 Õà Õàªáªã ”€4è@ù @ù(´o ”õªè@ù @ù‚ ”ôªàªe ”ô´f ”õª` @ù᪔ ”óªàª\ ”Sø7 ÕÀYX@ù‘ù ÕˆXX@ù¡¬ ÕL ” ­ Õüÿ—@­ Õüÿ—àª\ ”€Òý{D©ôOC©öWB©ÿC‘À_ÖÿƒÑöW©ôO©ý{©ýC‘èªóªÿ©éƒ‘ê“‘ê'©é£‘ ÕŠTXê'©bªp ÕC Õàªáª› ” 4à@ùÿ ”ôª' ”õª` @ùã D)áªi ”óªàª ”³ø7à@ù@ùñùAT– ” ÕQX@ù‘ù ÀžP ÕÛûÿ—à@ùà´@ùñùAT† ”€Òý{E©ôOD©öWC©ÿƒ‘À_ÖÿƒÑôO©ý{©ýC‘èªóª¿>©ÿù©sѪƒÑê'©é£‘ªcÑê'©£P Õc Õàªáª\ ” 4ë ”ôª` @ù¡ƒ^øâ+@¹£|)/ ”óªàªß ”óø7 Õ JX@ù‘ù` 0 Õ¤ûÿ—€Òý{E©ôOD©ÿƒ‘À_ÖôO¾©ý{©ýC‘ ¢P ÕÖ ” 4´óªá¡0 ÕBú Õ#¢ Õ¾”2ø7A£p Õ‚ù Õc£P Õવ”à0ø7A¤0 Õ¢ø ÕC¤ Õબ”À/ø7a¥p ÕÂ÷ Õ£¥0 Õણ” .ø7¡¦0 Õbõ Õà Õચ”€-ø7¦ ÕÂõ Õ㥠Õઑ”`,ø7ᨠÕâô Õèp Õઈ”@+ø7a«P Õô Õã« Õઔ *ø7Á¬P Õ"ó Õ#­ Õàªv”)ø7á­P ÕBò Õ¬ Õàªm”à'ø7¡­P Õbñ Õí0 Õàªd”À&ø7Á¯p Õ‚ð Õ£¯P Õàª[” %ø7¡° Õ¢ï Õ£° ÕàªR”€$ø7±P Õ‚ë Õ±P ÕàªI”`#ø7a±p Õ¢í Õ#±p Õàª@”@"ø7±p ÕÂì Õ°p Õàª7” !ø7!°p Õâë Õã¯P Õàª.” ø7° Õë ÕîP Õàª%”àø7¯p Õ"ê Õã®p ÕઔÀø7!¯p ÕBé Õíp Õઔ ø7a®p Õbè Õc®P Õઠ”€ø7Á®p Õ‚ç Õ#¯ Õઔ`ø7A° Õ¢æ ÕC°P Õàªø”@ø7a±p ÕÂå Õc±P Õàªï” ø7² Õâä Õ²P Õàªæ”ø7A²0 Õä ÕC²p ÕàªÝ”àø7A³P Õ"ã Õ#³p ÕàªÔ”Àø7Á³P ÕBâ Õ£P ÕàªË” ø7a³0 Õbá Õc¡p ÕàªÂ”€ø7²P Õ‚à Õc² Õહ”`ø7Á²0 Õ¢ß ÕC± Õર”@ø7!²p ÕÂÞ Õ#° Õધ” ø7¡±P ÕâÝ Õƒ±P Õઞ”ø7±p ÕÝ Õc°P Õક”à ø7á°p Õ"Ü Õðp Õઌ”À ø7Á±0 ÕBÛ Õã±P Õઃ”  ø7Á²p ÕbÚ Õ£²0 Õàªz”€ ø7á²0 Õ‚Ù Õƒ²P Õàªq”`ø7¡²0 Õ¢Ø Õc±P Õàªh”@ø7Á±P ÕÂ× ÕC°P Õàª_” ø7A±P ÕâÖ Õã”P ÕàªV”ø7¡°0 ÕÖ Õã°P ÕàªM”àø7¡±p Õ"Õ Õñ0 ÕàªD”Àø7á²p ÕBÔ Õã² Õàª;” ø7Á³P ÕbÓ Õ´P Õàª2”€ø7€Rh@ùh@ù€ñhù¡Tફ”€àªý{A©ôO¨À_Ö@¹)€RqêŸ!q(!ÈK$€R ™@z ŠÀ_Ö ÕÄX@ÖôO¾©ý{©ýC‘óª ÕhÃX?Ö´`ù@ùñùAT‰” €Rý{A©ôO¨À_ÖÿƒÑø_©öW©ôO©ý{©ýC‘õªöªôª÷ª®P Õ3” ´óªáªá”à´øªáªÚ” 4àªáªÓ”ÀùÀ´€Rh@ù€  Õ¨ X@ùઔàS©a«p ÕઠÕèX@ùઔ÷ªàª·”õ©÷S©A«0 Õઽ”h@ù€ñhùaTàªF”àªý{E©ôOD©öWC©ø_B©ÿƒ‘À_ÖôO¾©ý{©ýC‘àÊ Õ¡~€Rä”óª@´àªûùÿ—Àø7"”€ø7¡© Õ© ÕàªÔ” ø7Ùýÿ—`ø7àªPçÿ—ø7àªqúÿ— ø7àªô”@ø7ઠóÿ—àø7àªöÿ—€ø7àª0”@ø6€Òàªý{A©ôO¨À_Öý{¿©ý‘•” ø7 €RA€R¢€R#€RJ”qÁT€Ò¾”Àø7Ô”Àø7vùÿ—€R(€Rµp ÕHùÿ— µ0 Õ@¶P ÕAùÿ—] ”€R€‰°(¡9ý{Á¨À_Ö€¶ Õ7ùÿ—·”õÿÿý{¿©ý‘ˆ°¡_9i€Rq Ÿû”€Rý{Á¨À_Öý{¿©ý‘Éÿÿ—àø7 Õ@ùX@ù‘ù€Òý{Á¨À_Öý{¿©ý‘ˆ°¡_9i€Rq Ÿã” Õ ÷X@ù‘ùý{Á¨À_ÖÿƒÑý{©ýC‘èªàª ÕêõXé#‘é+©b¡P ÕC  Õ᪢”@4à@ùx” ùÿ— ÕàóX@ù‘ù€Òý{A©ÿƒ‘À_Öý{¿©ý‘” Õá ÕÂ# Õƒ+ Õ”ø7…” ÕàðX@ù‘ù€Òý{Á¨À_Öý{¿©ý‘”x” ” ø7À Õ¡ Õ‚  ÕC( Õþ”àø7 ÕÀíX@ù‘ù€Òý{Á¨À_ÖÿƒÑø_©öW©ôO©ý{©ýC‘ôªõª€Ru” ´óª ‘@‘`‘÷[©àc©bšp Õ# ÕàªáªL”à4`@ù¹”€4@ù¶”à4à@ù³”@4À@ù°” 4h@ù @ù)‘ ùh@ù @ù)‘ ùh @ù @ù)‘ ùh@ù @ù)‘ ùˆ° ùCùiùùù Õ€åX@ù‘ù ÕäX@ù•p Õ ÕHãX@ù•p Õ  ÕˆâX@ù–P Õ ÕÈáX@ù–0 Õ˜”àª#”€Òý{E©ôOD©öWC©ø_B©ÿƒ‘À_ÖÿÃÑôO©ý{©ýƒ‘èªàªé#‘é©B•0 Õƒø Õáªö”à4à@ùà´’”óªu”à´€Ò .”|@“” “ø7àª+” ÕàÜX@ù‘ùý{B©ôOA©ÿÑÀ_Ö ÕHÛX@ùá‘0 Õb”èÿÿý{¿©ý‘Q qƒT qaT¬”G”ˆ°¡9ý{Á¨À_ÖÿÑöW©ôO©ý{©ýÑôª Õˆ–X–°ÈþùR”óªôù „ ÕÅ”ôªÈþCùH´@ùáªz”@´õª‰”¨@ùѨù`5hµàª¸”ÈþCù@ùÈþùþÿµ€Rˆ@ùhµàª®”ˆ@ù5€RñˆùaTધ”àª-”àªý{C©ôOB©öWA©ÿ‘À_ÖÿÑöW©ôO©ý{©ýÑôª”óªôù~ Õ”ôª ÕÈŽX@ùáªE”õªˆ@ùñˆùaTઆ”ઠ”àªý{C©ôOB©öWA©ÿ‘À_ÖÿÑöW©ôO©ý{©ýÑôªõªöªú”óª~@“àª@€R”õªö© y Õh”öª ÕȉX @ù᪔ôªÈ@ùñÈùaTàª^”¨@ùñ¨ùàT4´ˆ@ù­B97€ àªR”4ÿÿµ€ àªÞ”õªˆ@ùñˆùaTàªF”àªÌ”àªý{C©ôOB©öWA©ÿ‘À_ÖÿÑöW©ôO©ý{©ýÑôª¼”óªôù r0 Õ/”öª Õ¨‚X @ùáªä”õªÈ@ùñÈùaTàª%”ˆ@ùñˆùaTઔ¨@ùñ¨ùaTઔટ”€Rý{C©ôOB©öWA©ÿ‘À_ÖöW½©ôO©ý{©ýƒ‘”°“úCùÓ´`@ù@ùñùAT”`@ù@ùñùATþ”` @ù@ùñùATø”`@ù@ùñùATò”u@ùàªø”óª•üÿµŸúùý{B©ôOA©öWèÀ_ÖôO¾©ý{©ýC‘ôª`Ô Õ¡~€RŒ”´óª¡æp Õàªâª”`ø7€Rh@ùñhùaTàªÐ”€ý{A©ôO¨À_ÖÿCÑôO©ý{©ý‘èªàª¿>©¿=©¿ƒø Õ ÕIøXªÃÑ«ãÑë«©êùª£Ñé+©ªƒÑé+©©cÑ ¤ÿ Õê'©"€ Õã  Õ᪟”4.”ôª¨ƒ^ø @ù@ù¨^ø @ù£#}© @ù¤ƒ\ø+”óªàª”Ó´¨ƒ^ø @ùáªýÿ—@}P Õäöÿ—€Òý{H©ôOG©ÿC‘À_ÖÿÑôO©ý{©ýÑèªàª¿>©¿=©ÿù Õ ÕéðXêã‘êùªÃÑ«£Ñë+©ªƒÑé+©©cÑÊœÿ Õê'©¢z Õc Õáªe”À4ô”ôª¨ƒ^ø @ù¢£}© @ù£]øä@ùð”óªàªæ”Ó´¨ƒ^ø @ùáªÉüÿ— xp Õ¬öÿ—€Òý{G©ôOF©ÿ‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù Õ Õ êXꃑé+©©cÑŠ–ÿ Õê'©Âu0 Õ£ Õáª3”€4”ôª¨ƒ^ø @ùè@ù @ù½”óªàª¶”Ó´¨ƒ^ø @ù᪙üÿ—€s Õ|öÿ—€Òý{D©ôOC©ÿC‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù郑é ù©cÑêÿ Õê'©bqP ÕÃü Õ᪔`4•”ôª¨ƒ^ø @ùá@ùš”óªàªŠ”Ó´¨ƒ^ø @ùáªmüÿ—@op ÕPöÿ—€Òý{D©ôOC©ÿC‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù郑é ù©cÑj‹ÿ Õê'©Bmp Õø ÕáªÚ”`4i”ôª¨ƒ^ø @ùá@ù\”óªàª^”Ó´¨ƒ^ø @ùáªAüÿ— k0 Õ$öÿ—€Òý{D©ôOC©ÿC‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘J†ÿ Õê'©biP Õ£ó Õ᪱”@4@”ôªè@ù @ù7”óªàª6”Ó´è@ù @ùáªüÿ—@gp Õüõÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘Jÿ Õê'©¢e0 Õ#ï Õ᪉”@4”ôªè@ù @ù”óªàª”Ó´è@ù @ùáªñûÿ—€cP ÕÔõÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘J|ÿ Õê'©âa Õ£ê Õáªa”@4ð”ôªè@ù @ù”óªàªæ”Ó´è@ù @ùáªÉûÿ— `p Õ¬õÿ—€Òý{C©ôOB©ÿ‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù郑é ù©cÑêvÿ Õê'©b^P ÕÃå Õáª6”`4Å”ôª¨ƒ^ø @ùá@ùß”óªàªº”Ó´¨ƒ^ø @ùáªûÿ—à\P Õ€õÿ—€Òý{D©ôOC©ÿC‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù郑é ù©cÑjqÿ Õê'©‚[0 Õá Õ᪠”`4™”ôª¨ƒ^ø @ùá@ù¶”óªàªŽ”Ó´¨ƒ^ø @ùáªqûÿ—Zp ÕTõÿ—€Òý{D©ôOC©ÿC‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘Jlÿ Õê'©âX0 Õ£Ü Õáªá”@4p”ôªè@ù @ùˆ”óªàªf”Ó´è@ù @ùáªIûÿ— Wp Õ,õÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘Jgÿ Õê'©ÂU0 Õ#Ø Õ᪹”@4H”ôªè@ù @ù]”óªàª>”Ó´è@ù @ùáª!ûÿ—ÀSP Õõÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘Jbÿ Õê'©Rp Õ£Ó Õ᪑”@4 ”ôªè@ù @ù/”óªàª”Ó´è@ù @ùáªùúÿ—`P ÕÜôÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘J]ÿ Õê'©âN0 Õ#Ï Õáªi”@4ø”ôªè@ù @ù”óªàªî”Ó´è@ù @ùáªÑúÿ—àLP Õ´ôÿ—€Òý{C©ôOB©ÿ‘À_ÖÿÑôO©ý{©ýÑèªàª¿>©¿=©ÿù Õ ÕéªXêã‘êùªÃÑ«£Ñë+©ªƒÑé+©©cÑÊVÿ Õê'©BJ Õ#É Õáª5”À4Ä”ôª¨ƒ^ø @ù¢£}© @ù£]øä@ù±”óªàª¶”Ó´¨ƒ^ø @ù᪙úÿ—àGp Õ|ôÿ—€Òý{G©ôOF©ÿ‘À_ÖÿƒÑôO©ý{ ©ýC‘èªàª¿>©¿=©¿<©ÿ'ù Õ ÕÉ£Xê#‘ê#ùªÑ«ãÑë+©ªÃÑ«£Ñë+©ªƒÑé+©©cÑJOÿ Õê'©E Õ#à Õáªù”€4ˆ”ôª¨ƒ^ø @ù@ù¢£}© @ù¤|©¥\øk”óªàªy”s´à'@ù€´Ö”h&@ù ù¨ƒ^ø @ùáªWúÿ— B0 Õ:ôÿ—€Òý{I©ôOH©ÿƒ‘À_ÖÿƒÑôO©ý{©ýC‘èªàª¿>©ÿù飑ªƒÑê'©©cÑŠHÿ Õê'©"@p Õc¾ ÕáªÃ”à4R”ôª¡#~© @ù@”óªàªH”s´à@ù€´¥”h&@ù ù¨ƒ^ø @ùáª&úÿ— > Õ ôÿ—€Òý{E©ôOD©ÿƒ‘À_ÖÿÑôO©ý{©ýÑèªàªÿùéc‘êBÿ Õê'©=p Õù Õ᪖”@4%”ôªè@ù @ù”óªàª”Ó´è@ù @ùáªþùÿ— ;0 Õáóÿ—€Òý{C©ôOB©ÿ‘À_ÖÿCÑôO©ý{©ý‘èªàª¿ƒøÿù郑é ù©cÑŠ=ÿ Õê'©¢:0 Õã´ Õáªk”€4è@ù @ù)U@ù?gò€T€:0 Õ_”óªè@ùá9p Õèù0 Õ`”àùh@ùñhùáTàªb”  à7 ÕˆIX@ùá7 ÕÖ” @ù)‘ ùà@ù´8”óªÓ”ôª¨ƒ^ø @ùáªÛ”óªàªÈ”4€6 Õ“óÿ—à@ùà´@ùñùAT>”€Òý{D©ôOC©ÿC‘À_Öà@ù@ùñùAT3” Õ DX@ù‘ùñÿÿôO¾©ý{©ýC‘ôª« Õ¡~€RÑ”´óªá3 ÕàªâªÄ”`ø7€Rh@ùñhùaTઔ€ý{A©ôO¨À_ÖÿƒÑôO©ý{©ýC‘èªàª¿>© Õ AXéù飑ªƒÑê'©©cÑŠ-ÿ Õê'©Â2 Õ#ì Õáªë”4z”ôª¡#~© @ùâ@ùh”óªàªo”´¨ƒ^ø @ùáªRùÿ—€Ò Õ@;X@ù‘ùý{E©ôOD©ÿƒ‘À_ÖÿƒÑôO©ý{©ýC‘èªàª¿>© ÕÉ:Xéù飑ªƒÑê'©©cÑJ'ÿ Õê'©-0 Õãæ Õ᪹”4H”ôª¡#~© @ùâ@ù<”óªàª=”´¨ƒ^ø @ù᪠ùÿ—€Ò Õ5X@ù‘ùý{E©ôOD©ÿƒ‘À_ÖÿƒÑôO©ý{©ýC‘èªàª¿>© Õ‰4Xéù飑ªƒÑê'©©cÑ !ÿ Õê'©B'p Õ£á Õ᪇”4”ôª¡#~© @ùâ@ù”óªàª ”´¨ƒ^ø @ùáªîøÿ—€Ò ÕÀ.X@ù‘ùý{E©ôOD©ÿƒ‘À_ÖÿÃÑø_©öW©ôO©ý{©ýƒ‘èªàªÿ©éƒ‘é ù飑 ÿ Õê'©â!p Õ£Ü ÕáªW”À4à@ù3”`ø·ôª Õ¨+X@ù ð}Ó !‘?Ö󪀴ô´€Òàªì” ´÷ªà@ù᪔öªè@ùñèùaTàªI”6´àª+”`z5øÈ@ùñÈùaTàª?”hzuøÈ´µ‘ŸëüÿTz4øº”ôªè@ù A© @ùâªb”ય”àªË” Õ$X@ù‘ù€Ò Õ"X@ù!p Õœ” ÕH#X@ùàª?Ö€Òý{F©ôOE©öWD©ø_C©ÿÑÀ_ÖÿÑöW©ôO©ý{©ýÑóªôªÿù¡0 ÕÍ” 4!0 Õ઀Òú”à´õª@ù­B9¨ 7ôª¹á#‘àªã”è@ùqôˆš€Ò àªØ”ôª¨@ùñ¨ùaTàªé”(€Rh¹àªý{C©ôOB©öWA©ÿ‘À_ÖöW½©ôO©ý{©ýƒ‘óªõªàªÇ”À´ôªàªáªâª ”óªˆ@ùñˆù¡TàªÌ”€àªý{B©ôOA©öWèÀ_ÖöW½©ôO©ý{©ýƒ‘óªõªàªQ”À´ôªàªáªâª„”óªˆ@ùñˆù¡Tર”€àªý{B©ôOA©öWèÀ_Ö ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ Õð XÖ ÕÐ XÖ Õ° XÖ Õ XÖ Õp XÖ ÕP XÖ Õ0 XÖ Õ XÖ Õð XÖ ÕÐ XÖ Õ° XÖ Õ XÖ Õp XÖ ÕP XÖ Õ0 XÖ Õ XÖ Õð XÖ ÕÐ XÖ Õ° XÖ Õ XÖ Õp XÖ ÕP XÖ Õ0 XÖ Õ XÖ Õð XÖ ÕÐ XÖ Õ° XÖ Õ XÖ Õp XÖ ÕP XÖ Õ0 XÖ Õ XÖ Õð XÖ ÕÐ XÖ Õ° XÖ Õ XÖ Õp XÖ ÕP XÖ Õ0 XÖ Õ XÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðXÖ ÕÐXÖ Õ°XÖ ÕXÖ ÕpXÖ ÕPXÖ Õ0XÖ ÕXÖ ÕðÿXÖ ÕÐÿXÖ Õ°ÿXÖ ÕÿXÖ ÕpÿXÖ ÕPÿXÖ Õ0ÿXÖ ÕÿXÖ ÕðþXÖ ÕÐþXÖ Õ°þXÖ ÕþXÖ ÕpþXÖ ÕPþXÖ Õ0þXÖ ÕþXÖ ÕðýXÖ ÕÐýXÖ Õ°ýXÖ ÕýXÖ ÕpýXÖ ÕPýXÖ Õ0ýXÖ ÕýXÖ ÕðüXÖ ÕÐüXÖ Õ°üXÖ ÕüXÖ ÕpüXÖ ÕPüXÖ Õ0üXÖ ÕüXÖ ÕðûXÖ ÕÐûXÖ Õ°ûXÖ ÕûXÖ ÕpûXÖ ÕPûXÖ Õ0ûXÖ ÕûXÖ ÕðúXÖ ÕÐúXÖ Õ°úXÖ ÕúXÖ ÕpúXÖ ÕPúXÖ Õ0úXÖ ÕúXÖ ÕðùXÖ ÕÐùXÖ Õ°ùXÖ ÕùXÖ ÕpùXÖ ÕPùXÖ Õ0ùXÖ ÕùXÖ ÕðøXÖ ÕÐøXÖ Õ°øXÖ ÕøXÖ ÕpøXÖ ÕPøXÖ Õ0øXÖ ÕøXÖ Õð÷XÖ ÕÐ÷XÖ Õ°÷XÖ Õ÷XÖ Õp÷XÖ ÕP÷XÖ Õ0÷XÖ Õ÷XÖ ÕðöXÖPªP§P¤7P¡XPžpP›‰P˜¥P•¾P’ÚPîPŒP‰%P†<PƒSP€oP}ˆPz¡Pw¼PtÚPqîPnPkPh7PeWPbjP_ŠP\ªPYÅPVèPSPPPM/PJTPGpPDPA¨P>ÁP;àP8üP5P23P/IP,eP)~P&žP#·P ÑPæPÿPP<PYP„P ©PÌPâPÿ‘á ÕðG¿© ÕP·XÖPùÿÿv Pöÿÿ¦ PóÿÿÒ Pðÿÿï Píÿÿ Pêÿÿ= Pçÿÿ] Päÿÿƒ Páÿÿ¬ PÞÿÿÛ PÛÿÿü PØÿÿPÕÿÿ>PÒÿÿfPÏÿÿŽPÌÿÿ¸PÉÿÿáPÆÿÿPÃÿÿ9PÀÿÿbP½ÿÿ’PºÿÿÂP·ÿÿòP´ÿÿ"P±ÿÿRP®ÿÿ‚P«ÿÿ°P¨ÿÿÞP¥ÿÿP¢ÿÿ@PŸÿÿrPœÿÿ¤P™ÿÿÖP–ÿÿP“ÿÿ8PÿÿgPÿÿ˜PŠÿÿÉP‡ÿÿúP„ÿÿ+PÿÿZP~ÿÿ‰P{ÿÿ¸PxÿÿåPuÿÿPrÿÿ?PoÿÿlPlÿÿšPiÿÿÉPfÿÿüPcÿÿ*P`ÿÿZP]ÿÿŠPZÿÿºPWÿÿêPTÿÿPQÿÿBPNÿÿoPKÿÿœPHÿÿAPEÿÿVPBÿÿ}P?ÿÿ¤P<ÿÿÀP9ÿÿÜP6ÿÿøP3ÿÿP0ÿÿ2P-ÿÿOP*ÿÿ}P'ÿÿ«P$ÿÿÅP!ÿÿáPÿÿ Pÿÿ Pÿÿ: PÿÿV Pÿÿp Pÿÿ P ÿÿ® P ÿÿÊ Pÿÿå Pÿÿ Pÿÿ Pýþÿ4 PúþÿM P÷þÿn Pôþÿ Pñþÿ¹ PîþÿÌ Pëþÿö Pèþÿ PåþÿE Pâþÿh Pßþÿ PÜþÿœ PÙþÿ¶ PÖþÿÏ PÓþÿæ PÐþÿ PÍþÿ" PÊþÿ; PÇþÿX PÄþÿÉPÁþÿâP¾þÿýP»þÿP¸þÿ4Pµþÿ_P²þÿ†P¯þÿ¯P¬þÿÓP©þÿøP¦þÿP£þÿEP þÿmPþÿ•Pšþÿ¾P—þÿïP”þÿP‘þÿ9PŽþÿcP‹þÿ„Pˆþÿ­P…þÿÝP‚þÿPþÿ7P|þÿaPyþÿŠPvþÿ²PsþÿæPpþÿPmþÿFPjþÿnPgþÿ¢PdþÿÓPaþÿñP^þÿP[þÿ0PXþÿZPUþÿ€PRþÿ¥POþÿÍPLþÿiPIþÿzPFþÿPCþÿ§P@þÿÄP=þÿØP:þÿéP7þÿüP4þÿP1þÿ$P.þÿñP+þÿP(þÿP%þÿ,P"þÿ<PþÿIPþÿXTransformUsageUnknownTransformUsageDSigTransformTransformUsageC14NMethodTransformUsageDigestMethodTransformUsageSignatureMethodTransformUsageEncryptionMethodTransformUsageAnyNamespaceNsBASEDSigNsDSEncNsENCXPathNsXPATHXPath2NsXPATH2XPointerNsXPOINTERSoap11NsSOAP11Soap12NsSOAP12NsExcC14NEXC_C14NNsExcC14NWithCommentsEXC_C14N_WITH_COMMENTEncryptionTypeTypeEncContentCONTENTTypeEncElementELEMENTNodeNodeSignatureSIGNATURENodeSignedInfoSIGNED_INFONodeCanonicalizationMethodCANONICALIZATION_METHODNodeSignatureMethodSIGNATURE_METHODNodeSignatureValueSIGNATURE_VALUENodeSignaturePropertiesSIGNATURE_PROPERTIESNodeDigestMethodDIGEST_METHODNodeDigestValueDIGEST_VALUENodeObjectOBJECTNodeManifestMANIFESTNodeEncryptedDataENCRYPTED_DATANodeEncryptedKeyENCRYPTED_KEYNodeEncryptionMethodENCRYPTION_METHODNodeEncryptionPropertyENCRYPTION_PROPERTYNodeEncryptionPropertiesENCRYPTION_PROPERTIESNodeCipherDataCIPHER_DATANodeCipherValueCIPHER_VALUENodeCipherReferenceCIPHER_REFERENCENodeDataReferenceDATA_REFERENCENodeKeyReferenceKEY_REFERENCENodeReferenceREFERENCENodeReferenceListREFERENCE_LISTNodeKeyInfoKEY_INFONodeKeyNameKEY_NAMENodeKeyValueKEY_VALUENodeX509DataX509_DATAKeyFormatKeyDataFormatUnknownUNKNOWNKeyDataFormatBinaryBINARYKeyDataFormatPemPEMKeyDataFormatDerDERKeyDataFormatPkcs8PemPKCS8_PEMKeyDataFormatPkcs8DerPKCS8_DERKeyDataFormatPkcs12PKCS12_PEMKeyDataFormatCertPemCERT_PEMKeyDataFormatCertDerCERT_DERKeyDataTypeKeyDataTypeUnknownKeyDataTypeNoneNONEKeyDataTypePublicPUBLICKeyDataTypePrivatePRIVATEKeyDataTypeSymmetricSYMMETRICKeyDataTypeSessionSESSIONKeyDataTypePermanentPERMANENTKeyDataTypeTrustedTRUSTEDKeyDataTypeAnyANYKeyDataKeyDataNameNAMEKeyDataValueVALUEKeyDataRetrievalMethodRETRIEVALMETHODKeyDataEncryptedKeyENCRYPTEDKEYKeyDataAesAESKeyDataDesDESKeyDataDsaDSAKeyDataEcdsaECDSAKeyDataHmacHMACKeyDataRsaRSAKeyDataX509X509KeyDataRawX509CertRAWX509CERTTransformTransformInclC14NC14NTransformInclC14NWithCommentsC14N_COMMENTSTransformInclC14N11C14N11TransformInclC14N11WithCommentsC14N11_COMMENTSTransformExclC14NEXCL_C14NTransformExclC14NWithCommentsEXCL_C14N_COMMENTSTransformEnvelopedENVELOPEDTransformXPathTransformXPath2TransformXPointerTransformRemoveXmlTagsC14NREMOVE_XML_TAGS_C14NTransformVisa3DHackVISA3D_HACKTransformAes128CbcAES128TransformAes192CbcAES192TransformAes256CbcAES256TransformKWAes128KW_AES128TransformKWAes192KW_AES192TransformKWAes256KW_AES256TransformDes3CbcDES3TransformKWDes3KW_DES3TransformDsaSha1DSA_SHA1TransformXsltXSLTTransformEcdsaSha1ECDSA_SHA1TransformEcdsaSha224ECDSA_SHA224TransformEcdsaSha256ECDSA_SHA256TransformEcdsaSha384ECDSA_SHA384TransformEcdsaSha512ECDSA_SHA512TransformHmacMd5HMAC_MD5TransformHmacRipemd160HMAC_RIPEMD160TransformHmacSha1HMAC_SHA1TransformHmacSha224HMAC_SHA224TransformHmacSha256HMAC_SHA256TransformHmacSha384HMAC_SHA384TransformHmacSha512HMAC_SHA512TransformRsaMd5RSA_MD5TransformRsaRipemd160RSA_RIPEMD160TransformRsaSha1RSA_SHA1TransformRsaSha224RSA_SHA224TransformRsaSha256RSA_SHA256TransformRsaSha384RSA_SHA384TransformRsaSha512RSA_SHA512TransformRsaPkcs1RSA_PKCS1TransformRsaOaepRSA_OAEPTransformMd5MD5TransformRipemd160RIPEMD160TransformSha1SHA1TransformSha224SHA224TransformSha256SHA256TransformSha384SHA384TransformSha512SHA512TransformAes128GcmAES128_GCMTransformAes192GcmAES192_GCMTransformAes256GcmAES256_GCMconstantsxmlsec.constants.__TransformThe xmlSecTransformId reflection__Transform('%s', '%s', %d)__Transform('%s', None, %d)%s, %s%s, Nonenamehrefusagexmlsec.constants.__KeyDataThe xmlSecKeyDataId reflection__KeyData('%s', '%s')__KeyData('%s', None)xmlsec.constantsVarious constants used by the library. SignatureContextxmlsec.SignatureContextXML Digital Signature implementationregister_idsignverifysign_binaryverify_binaryenable_reference_transformenable_signature_transformset_enabled_key_datanodeid_attrid_nsIDO&|sz:register_idmissing attribute.duplicated id.O&:signfailed to signO&:verifyfailed to verifySignature is invalid.bytestransforms#O!:sign_binaryincompatible signature methodSign key is not specified.Signature context already used; it is designed for one use only.could not create signature transform.inappropriate key type.cannot set key.failed to transform.signatures#O!s#:verify_binaryCannot verify signature.O!:enable_reference_transformcannot enable reference transform.O!:enable_signature_transformcannot enable signature transform.keydata_listO:set_enabled_key_dataexpected list of KeyData constants.cannot set enabled key.keyinstance of *xmlsec.Key* expected.empty key.failed to duplicate keymanager|O&:__init__failed to create the digital signature contextEncryptionContextxmlsec.EncryptionContextXML Encryption implementationresetencrypt_binaryencrypt_xmlencrypt_uridecrypttemplatedataO&s#:encrypt_binaryfailed to encrypt binaryO&O&:encrypt_xmlTypeunsupported `Type`, it should be `element` or `content`could not copy template treefailed to encrypt xmluriO&s:encrypt_urifailed to encrypt URIO&:decryptfailed to construct parentindexOfailed to decryptdecryption resulted in a non well formed documentfailed to create the encryption contextisxmlsec.ErrorThe common exception class.xmlsec.InternalErrorThe internal exception class.xmlsec.VerificationErrorThe verification exception class.ErrorInternalErrorVerificationErrorcodemessagedetailsNULLfilelinefuncobjectsubjectfunc=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s unknownKeysManager requiredKeyKeysManagerxmlsec.Keyfrom_memoryfrom_filegeneratefrom_binary_filefrom_binary_dataload_cert_from_memoryload_cert_from_file__copy____deepcopy__formatpasswords#I|z:from_memorycannot load keyOI|z:from_filecannot read keyklasssizetypeO!HI:generatecannot generate keyfilenameO!O&:from_binary_fileO!s#:from_binary_datas#I:load_cert_from_memorycannot load certOI:load_cert_from_filecannot duplicate keykey is not readycannot delete namecannot set namexmlsec.KeysManagerKeys Manageradd_keyload_certO!:add_keythe provided key is invalidcannot make copy of keycannot add keyO&II:load_certs#II:load_certcannot load cert from memoryfailed to create xmlsecKeyManagerfailed to initialize xmlsecKeyManagerlxml.etreedeepcopyNodeToDocumentstruct LxmlElement *(struct LxmlDocument *, xmlNode *)elementTreeFactorystruct LxmlElementTree *(struct LxmlElement *)newElementTreestruct LxmlElementTree *(struct LxmlElement *, PyObject *)adoptExternalDocumentstruct LxmlElementTree *(xmlDoc *, PyObject *, int)elementFactorymakeElementstruct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)makeSubElementstruct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)setElementClassLookupFunctionvoid (_element_class_lookup_function, PyObject *)lookupDefaultElementClassPyObject *(PyObject *, PyObject *, xmlNode *)lookupNamespaceElementClasscallLookupFallbackPyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)tagMatchesint (xmlNode *, const xmlChar *, const xmlChar *)documentOrRaisestruct LxmlDocument *(PyObject *)rootNodeOrRaisestruct LxmlElement *(PyObject *)hasTextint (xmlNode *)hasTailtextOfPyObject *(xmlNode *)tailOfsetNodeTextint (xmlNode *, PyObject *)setTailTextattributeValuePyObject *(xmlNode *, xmlAttr *)attributeValueFromNsNamePyObject *(xmlNode *, const xmlChar *, const xmlChar *)getAttributeValuePyObject *(struct LxmlElement *, PyObject *, PyObject *)iterattributesPyObject *(struct LxmlElement *, int)collectAttributesPyObject *(xmlNode *, int)setAttributeValueint (struct LxmlElement *, PyObject *, PyObject *)delAttributeint (struct LxmlElement *, PyObject *)delAttributeFromNsNamehasChildfindChildxmlNode *(xmlNode *, Py_ssize_t)findChildForwardsfindChildBackwardsnextElementxmlNode *(xmlNode *)previousElementappendChildvoid (struct LxmlElement *, struct LxmlElement *)appendChildToElementint (struct LxmlElement *, struct LxmlElement *)pyunicodePyObject *(const xmlChar *)utf8PyObject *(PyObject *)getNsTaggetNsTagWithEmptyNsnamespacedNamenamespacedNameFromNsNamePyObject *(const xmlChar *, const xmlChar *)iteratorStoreNextvoid (struct LxmlElementIterator *, struct LxmlElement *)initTagMatchvoid (struct LxmlElementTagMatcher *, PyObject *)findOrBuildNodeNsPrefixxmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)__pyx_capi__%.200s does not export expected C function %.200sC function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)__version__1.3.14.dev9+g1563947xmlsecThe tiny python wrapper around xmlsec1 (1.2.37) libraryinitshutdownenable_debug_tracecleanup_callbacksregister_default_callbacksregister_callbacksbase64_default_line_sizeenabled|O:enable_debug_trace(y)(OO)(O)input_match_callbackinput_open_callbackinput_read_callbackinput_close_callbackOOOO:register_callbacksinput_match_callback must be a callableinput_open_callback must be a callableinput_read_callback must be a callableinput_close_callback must be a callable|O:base64_default_line_sizesize must be positivecannot initialize xmlsec library.xmlsec library version mismatch.cannot initialize crypto library application.cannot initialize crypto library.xmlsec.templateXml Templates processingcreateadd_referenceadd_transformensure_key_infoadd_key_nameadd_key_valueadd_x509_datax509_data_add_issuer_serialx509_issuer_serial_add_issuer_namex509_issuer_serial_add_serial_numberx509_data_add_subject_namex509_data_add_skix509_data_add_certificatex509_data_add_crladd_encrypted_keyencrypted_data_createencrypted_data_ensure_key_infoencrypted_data_ensure_cipher_valuetransform_add_c14n_inclusive_namespacesc14n_methodsign_methodidnsO&O!O!|zzz:createcannot create template.digest_methodO&O!|zzz:add_referencecannot add reference.O&O!:add_transformcannot add transform.O&|z:ensure_key_infocannot ensure key info.O&|z:add_key_namecannot add key name.O&:add_key_valuecannot add key value.O&:add_x509_datacannot add x509 data.O&:x509_data_add_issuer_serialcannot add x509 issuer serial.O&|z:x509_issuer_serial_add_issuer_namecannot add x509 issuer serial name.serialO&|z:x509_issuer_serial_add_serial_numbercannot add x509 issuer serial number.O&:x509_data_add_subject_namecannot add x509 subject name.O&:x509_data_add_skicannot add x509 SKI.O&:x509_data_add_certificatecannot add x509 certificate.O&:x509_data_add_crlcannot add x509 CRL.methodrecipientO&O!|zzz:add_encrypted_keycannot add encrypted key.mime_typeencodingO&O!|zzzzz:encrypted_data_createcannot create encrypted data.O&|zz:encrypted_data_ensure_key_infocannot ensure key info for encrypted data.O&:encrypted_data_ensure_cipher_valuecannot ensure cipher value for encrypted data.prefixesO&O:transform_add_c14n_inclusive_namespaces joinexpected instance of str or list of strcannot add 'inclusive' namespaces to the ExcC14N transform nodetreexmlsec.treeCommon XML utility functionsfind_childfind_parentfind_nodeadd_idsparentnamespaceO&s|s:find_childO&s|s:find_parentO&s|s:find_nodeidsO&O:add_idsno memoryreadThe transform's name.The transform's identification string (href).The allowed transforms usages.The key data's name.The key data's identification string (href).register_id(node, id_attr = 'ID', id_ns = None) -> None Registers new id. :param node: the pointer to XML node :type node: :class:`lxml.etree._Element` :param id_attr: the attribute :type id_attr: :class:`str` :param id_ns: the namespace (optional) :type id_ns: :class:`str` or :data:`None`sign(node) -> None Signs according to the signature template. :param node: the pointer to :xml:`` node with signature template :type node: :class:`lxml.etree._Element`verify(node) -> None Verifies according to the signature template. :param node: the pointer with :xml:`` node :type node: :class:`lxml.etree._Element` :return: :data:`None` on success :raise VerificationError: on failure sign_binary(bytes, transform) -> bytes Signs binary data ``data`` with algorithm ``transform``. :param bytes: the binary data :type bytes: :class:`bytes` :param transform: the signature algorithm :type transform: :class:`__Transform` :return: the signature :rtype: :class:`bytes`verify_binary(bytes, transform, signature) -> None Verifies signature for binary data. :param bytes: the binary data :type bytes: :class:`bytes` :param transform: the signature algorithm :type transform: :class:`__Transform` :param signature: the signature :type signature: :class:`bytes` :return: :data:`None` on success :raise VerificationError: on failureenable_reference_transform(transform) -> None Enables use of ``transform`` as reference transform. .. note:: by default, all transforms are enabled. The first call of :meth:`~SignatureContext.enable_reference_transform` will switch to explicitly enabled transforms. :param transform: the transform klass. :type transform: :class:`__Transform`enable_signature_transform(transform) -> None Enables use of ``transform`` as signature transform. .. note:: by default, all transforms are enabled. The first call of :meth:`~SignatureContext.enable_signature_transform` will switch to explicitly enabled transforms. :param transform: the transform klass. :type transform: :class:`__Transform` set_enabled_key_data(keydata_list) -> None Adds selected :class:`__KeyData` to the list of enabled key data list. :param keydata_list: the list :type keydata_list: :class:`list` of :class:`__KeyData`Signature key. reset() -> None Reset this context, user settings are not touched. encrypt_binary(template, data) -> lxml.etree._Element Encrypts binary ``data`` according to ``EncryptedData`` template ``template``. .. note:: ``template`` is modified in place. :param template: the pointer to :xml:`` template node :type template: :class:`lxml.etree._Element` :param data: the data :type data: :class:`bytes` :return: the resulting :xml:`` subtree :rtype: :class:`lxml.etree._Element`encrypt_xml(template, node) -> lxml.etree._Element Encrypts ``node`` using ``template``. .. note:: The ``"Type"`` attribute of ``template`` decides whether ``node`` itself (``http://www.w3.org/2001/04/xmlenc#Element``) or its content (``http://www.w3.org/2001/04/xmlenc#Content``) is encrypted. It must have one of these two values (or an exception is raised). The operation modifies the tree and removes replaced nodes. :param template: the pointer to :xml:`` template node :type template: :class:`lxml.etree._Element` :param node: the pointer to node for encryption :type node: :class:`lxml.etree._Element` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`encrypt_uri(template, uri) -> lxml.etree._Element Encrypts binary data obtained from ``uri`` according to ``template``. .. note:: ``template`` is modified in place. :param template: the pointer to :xml:`` template node :type template: :class:`lxml.etree._Element` :param uri: the URI :type uri: :class:`str` :return: the resulting :xml:`` subtree :rtype: :class:`lxml.etree._Element`decrypt(node) Decrypts ``node`` (an ``EncryptedData`` or ``EncryptedKey`` element) and returns the result. The decryption may result in binary data or an XML subtree. In the former case, the binary data is returned. In the latter case, the input tree is modified and a reference to the decrypted XML subtree is returned. If the operation modifies the tree, it removes replaced nodes. :param node: the pointer to :xml:`` or :xml:`` node :type node: :class:`lxml.etree._Element` :return: depends on input parameters :rtype: :class:`lxml.etree._Element` or :class:`bytes`Encryption key. from_memory(data, format, password = None) -> xmlsec.Key Loads PKI key from memory. :param data: the binary key data :type data: :class:`str` or :class:`bytes` :param format: the key file format :type format: :class:`int` :param password: the key file password (optional) :type password: :class:`str` or :data:`None` :return: pointer to newly created key :rtype: :class:`~xmlsec.Key`from_file(file, format, password = None) -> xmlsec.Key Loads PKI key from a file. :param file: the file object or file path :type file: :class:`str`, :class:`bytes`, any :class:`~os.PathLike`, :class:`~typing.BinaryIO` or :class:`~typing.TextIO` :param format: the key file format :type format: :class:`int` :param password: the key file password (optional) :type password: :class:`str` or :data:`None` :return: pointer to newly created key :rtype: :class:`~xmlsec.Key`generate(klass, size, type) -> xmlsec.Key Generates key of kind ``klass`` with ``size`` and ``type``. :param klass: the requested key klass (rsa, dsa, aes, ...) :type klass: :class:`__KeyData` :param size: the new key size (in bits!) :type size: :class:`int` :param type: the new key type (session, permanent, ...) :type type: :class:`int` :return: pointer to newly created key :rtype: :class:`~xmlsec.Key`from_binary_file(klass, filename) -> xmlsec.Key Loads (symmetric) key of kind ``klass`` from ``filename``. :param klass: the key value data klass :type klass: :class:`__KeyData` :param filename: the key binary filename :type filename: :class:`str`, :class:`bytes` or any :class:`~os.PathLike` :return: pointer to newly created key :rtype: :class:`~xmlsec.Key`from_binary_data(klass, data) -> xmlsec.Key Loads (symmetric) key of kind ``klass`` from ``data``. :param klass: the key value data klass :type klass: :class:`__KeyData` :param data: the key binary data :type data: :class:`str` or :class:`bytes` :return: pointer to newly created key :rtype: :class:`~xmlsec.Key`load_cert_from_memory(data, format) -> None Loads certificate from memory. :param data: the certificate binary data :type data: :class:`str` or :class:`bytes` :param format: the certificate file format :type format: :class:`int`load_cert_from_file(file, format) -> None Loads certificate from file. :param file: the file object or file path :type file: :class:`str`, :class:`bytes`, any :class:`~os.PathLike`, :class:`~typing.BinaryIO` or :class:`~typing.TextIO` :param format: the certificate file format :type format: :class:`int`the name of this key. add_key(key: xmlsec.Key) -> None Adds a copy of ``key`` to keys manager :param key: the pointer to key :type key: :class:`~xmlsec.Key`load_cert(filename, format, type) -> None Loads certificate from ``filename``. :param filename: the certificate file :type filename: :class:`str`, :class:`bytes` or any :class:`~os.PathLike` :param format: the certificate file format :type format: :class:`int` :param type: the flag that indicates is the certificate in filename trusted or not :type type: :class:`int`load_cert_from_memory(data, format, type) -> None Loads certificate from ``data`` :param data: the certificate binary data :type data: :class:`str` or :class:`bytes` :param format: the certificate file format :type format: :class:`int` :param type: the flag that indicates is the certificate in filename trusted or not :type type: :class:`int`<<TTÁT =¨,´,Ì-.0/d/Ì0è0d23ð3´4ð5P74:Ð<ì<ô=(@ä@(DœDÐEdF¼FH¤H¼H$I0I`ItJìKLL0MhMˆMxNPôPR¼S°U V,WHW\YÈ`aHa`bcegÈgüg¼kp} ì§ø§¨¨¨(¨4¨@¨L¨X¨d¨p¨|¨ˆ¨”¨ ¨¬¨¸¨Ä¨Ð¨Ü¨è¨ô¨© ©©$©0©<©H©T©`©l©x©„©©œ©¨©´©À©Ì©Ø©ä©ð©ü©ªª ª,ª8ªDªPª\ªhªtª€ªŒªô±² ²²$²d±p±|±ˆ±”± ±¬±¸±Ä±Ð±t­€­Œ­˜­¤­°­¼­È­Ô­à­ì­ø­®®®(®4®@®L®X®d®p®|®ˆ®”® ®¬®¸®Ä®Ð®Ü®è®ô®¯ ¯¯$¯0¯<¯H¯T¯`¯l¯x¯°ª¼ªÈªÔªàªìªøª«««(«4«@«L«X«d«p«|«ˆ«”« «¬«¸«Ä«Ð«Ü«è«ô«¬ ¬¬$¬0¬<¬H¬T¬`¬l¬x¬„¬¬œ¬¨¬´¬À¬Ì¬Ø¬ä¬ð¬ü¬­­ ­,­8­D­P­\­h­„¯¯œ¯¨¯´¯À¯Ì¯Ø¯ä¯ð¯ü¯°° °,°8°D°P°\°h°t°€°Œ°˜°¤°°°¼°È°Ô°à°ì°ø°±±±(±4±@±L±X±Ü±è± À°I¼ILJ*ÀxJÐF£ÀK K¬K¾ÀKpH ÁÁÿÿÿÿÿÿÿÿ“ÀÔJߘÀàJ$ßÀKRß“À8LqߘÀDL†ßSÁ ÌLkÁ0MPNMÔMKÁðM³ßœÁlO×à¡ÁP‘á¨ÁøPâ´Á¼QšãÂÁøRåÝÁ¨S[æøÁXTµç·Ä None Initializes the library for general operation. This is called upon library import and does not need to be called again :func:`~.shutdown` is called explicitly). shutdown() -> None Shutdowns the library and cleanup any leftover resources. This is called automatically upon interpreter termination and should not need to be called explicitly.enable_debug_trace(enabled) -> None Enables or disables calling LibXML2 callback from the default errors callback. :param enabled: flag, debug trace is enabled or disabled :type enabled: :class:`bool`Unregister globally all sets of IO callbacks from xmlsec.Register globally xmlsec's own default set of IO callbacks.register_callbacks(input_match_callback, input_open_callback, input_read_callback, input_close_callback) -> None Register globally a custom set of IO callbacks with xmlsec. :param input_match_callback: A callable that takes a filename `bytestring` and returns a boolean as to whether the other callbacks in this set can handle that name. :type input_match_callback: ~collections.abc.Callable[[bytes], bool] :param input_open_callback: A callable that takes a filename and returns some context object (e.g. a file object) that the remaining callables in this set will be passed during handling. :type input_open_callback: ~collections.abc.Callable[[bytes], Any] :param input_read_callback: A callable that that takes the context object from the open callback and a buffer, and should fill the buffer with data (e.g. BytesIO.readinto()). xmlsec will call this function several times until there is no more data returned. :type input_read_callback: ~collections.abc.Callable[[Any, memoryview], int] :param input_close_callback: A callable that takes the context object from the open callback and can do any resource cleanup necessary. :type input_close_callback: ~collections.abc.Callable[[Any], None] base64_default_line_size(size = None) Configures the default maximum columns size for base64 encoding. If ``size`` is not given, this function returns the current default size, acting as a getter. If ``size`` is given, a new value is applied and this function returns nothing, acting as a setter. :param size: new default size value (optional) :type size: :class:`int` or :data:`None`®ÕÙÕîÕÖփɦ׶×ÿÿÿÿÿÿÿÿÈcÏ×4‰HfÖ× Š¤iä׋&mò×À‹ÃnØpŒqpØ rØÀ_s+Ø`Ž«tGØvjذøwØ`âyªØ‘P{¼Ø ‘¥|ÖØ@’~èØà’gúØÀ“a‚ÙÈ”ÿ…/ÙŒ•ˆRÙ,–w‰create(node, c14n_method, sign_method, id = None, ns = None) -> lxml.etree._Element Creates new :xml:`` node with the mandatory :xml:``, :xml:``, :xml:`` and :xml:`` children and sub-children. :param node: the signature node :type node: :class:`lxml.etree._Element` :param c14n_method: the signature canonicalization method :type c14n_method: :class:`__Transform` :param sign_method: the signature method :type sign_method: :class:`__Transform` :param id: the node id (optional) :type id: :class:`str` or :data:`None` :param ns: the namespace prefix for the signature element (e.g. ``"dsig"``) (optional) :type ns: :class:`str` or :data:`None` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_reference(node, digest_method, id = None, uri = None, type = None) -> lxml.etree._Element Adds :xml:`` node with given ``"URI"`` (``uri``), ``"Id"`` (``id``) and ``"Type"`` (``type``) attributes and the required children :xml:`` and :xml:`` to the :xml:`` child of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param digest_method: the reference digest method :type digest_method: :class:`__Transform` :param id: the node id (optional) :type id: :class:`str` or :data:`None` :param uri: the reference node URI (optional) :type uri: :class:`str` or :data:`None` :param type: the reference node type (optional) :type type: :class:`str` or :data:`None` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_transform(node) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param transform: the transform method id :type transform: :class:`__Transform` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`ensure_key_info(node, id = None) -> lxml.etree._Element Adds (if necessary) :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param id: the node id (optional) :type id: :class:`str` or :data:`None` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_key_name(node, name = None) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param name: the key name (optional) :type name: :class:`str` or :data:`None` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_key_value(node) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_x509_data(node) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element` x509_data_add_issuer_serial(node) -> lxml.etree._Element Adds :xml:`` node to the given :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_issuer_serial_add_issuer_name(node, name = None) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param name: the issuer name (optional) :type name: :class:`str` or :data:`None` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_issuer_serial_add_serial_number(node, serial = None) -> lxml.etree._Element Adds :xml:`` node to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param serial: the serial number (optional) :type serial: :class:`str` or :data:`None` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_data_add_subject_name(node) -> lxml.etree._Element Adds :xml:`` node to the given :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_data_add_ski(node) -> lxml.etree._Element Adds :xml:`` node to the given :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_data_add_certificate(node) -> lxml.etree._Element Adds :xml:`` node to the given :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`x509_data_add_crl(node) -> lxml.etree._Element Adds :xml:`` node to the given :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`add_encrypted_key(node, method, id = None, type = None, recipient = None) -> lxml.etree._Element Adds :xml:`` node with given attributes to the :xml:`` node of *node*. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param method: the encryption method :type method: :class:`__Transform` :param id: the ``"Id"`` attribute (optional) :type id: :class:`str` or :data:`None` :param type: the ``"Type"`` attribute (optional) :type type: :class:`str` or :data:`None` :param recipient: the ``"Recipient"`` attribute (optional) :type recipient: :class:`str` or :data:`None` :return: the pointer to the newly created :xml:`` node :rtype: :class:`lxml.etree._Element`encrypted_data_create(node, method, id = None, type = None, mime_type = None, encoding = None, ns = None) -> lxml.etree._Element Creates new :xml:`<{ns}:EncryptedData />` node for encryption template. :param node: the pointer to signature node :type node: :class:`lxml.etree._Element` :param method: the encryption method :type method: :class:`__Transform` :param id: the ``"Id"`` attribute (optional) :type id: :class:`str` or :data:`None` :param type: the ``"Type"`` attribute (optional) :type type: :class:`str` or :data:`None` :param mime_type: the ``"Recipient"`` attribute (optional) :type mime_type: :class:`str` or :data:`None` :param encoding: the ``"MimeType"`` attribute (optional) :type encoding: :class:`str` or :data:`None` :param ns: the namespace prefix (optional) :type ns: :class:`str` or :data:`None` :return: the pointer newly created :xml:`` node :rtype: :class:`lxml.etree._Element`encrypted_data_ensure_key_info(node, id = None, ns = None) -> lxml.etree._Element Adds :xml:`<{ns}:KeyInfo/>` to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :param id: the ``"Id"`` attribute (optional) :type id: :class:`str` or :data:`None` :param ns: the namespace prefix (optional) :type ns: :class:`str` or :data:`None` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`encrypted_data_ensure_cipher_value(node) -> lxml.etree._Element Adds :xml:`` to the :xml:`` node of ``node``. :param node: the pointer to :xml:`` node :type node: :class:`lxml.etree._Element` :return: the pointer to newly created :xml:`` node :rtype: :class:`lxml.etree._Element`transform_add_c14n_inclusive_namespaces(node, prefixes = None) -> None Adds 'inclusive' namespaces to the ExcC14N transform node ``node``. :param node: the pointer to :xml:`` node. :type node: :class:`lxml.etree._Element` :param prefixes: the list of namespace prefixes, where ``'default'`` indicates the default namespace (optional). :type prefixes: :class:`str` or :class:`list` of strings ÂzنْٕٓÀ ÂÂÙ’ÙÆˆÉ ¥ ’٠“À    “À ÂRÛ Â Â Â Â ÂsÜ’ÙˆÉzÜ ÂsܒوɹÜÃܕ٠’ٕ٠ °ÝYÞeÞÿÿÿÿÿÿÿÿˆ‚Þ ˜(ŽÞè˜ú™Þ°™Ä‘£ÞxšŒ“find_child(parent, name, namespace) Searches a direct child of the ``parent`` node having given ``name`` and ``namespace`` href. :param parent: the pointer to XML node :type parent: :class:`lxml.etree._Element` :param name: the name :type name: :class:`str` :param namespace: the namespace href (optional) :type namespace: :class:`str` :return: the pointer to the found node or :data:`None` if node is not found :rtype: :class:`lxml.etree._Element` or :data:`None`find_parent(node, name, namespace) Searches the ancestors axis of the ``node`` having given ``name`` and ``namespace`` href. :param node: the pointer to XML node :type node: :class:`lxml.etree._Element` :param name: the name :type name: :class:`str` :param namespace: the namespace href (optional) :type namespace: :class:`str` :return: the pointer to the found node or :data:`None` if node is not found :rtype: :class:`lxml.etree._Element` or :data:`None`find_node(node, name, namespace) Searches all children of the given ``node`` having given ``name`` and ``namespace`` href. :param node: the pointer to XML node :type node: :class:`lxml.etree._Element` :param name: the name :type name: :class:`str` :param namespace: the namespace href (optional) :type namespace: :class:`str` :return: the pointer to the found node or :data:`None` if node is not found :rtype: :class:`lxml.etree._Element` or :data:`None`add_ids(node, ids) -> None Registers ``ids`` as ids used below ``node``. ``ids`` is a sequence of attribute names used as XML ids in the subtree rooted at ``node``. A call to :func:`~.add_ids` may be necessary to make known which attributes contain XML ids. This is the case, if a transform references an id via ``XPointer`` or a self document uri and the id inkey_data_formation is not available by other means (e.g. an associated DTD or XML schema). :param node: the pointer to XML node :type node: :class:`lxml.etree._Element` :param ids: the list of ID attributes. :type ids: :class:`list` of strings«Þ“À²Þ “À²Þ “À²Þ ÂïÞ"`ÙDpp p(p p@p˜ppp p(p p@p˜p(RFRApRApRAp0RApRApHppxp0pp(ppXSASASASASASASASAp TFSAppRASA€p ppxp0pp(ppXSASASASASAp TFRARARApp ppxp0pp8pXpppxp0p8ppXSASASASASASASASASAp TFSASASARARARARARASASAp pSASFRAppRASASASASASASAp€pTAp0RAp RASASASASASASASASASASASASASASASASASASApðIVAUARARARA€RARA€UAWASApRFRAp RASASASApèSASASAR>@_PyExc_ExceptionQq@_PyExc_ImportError@_PyExc_MemoryError@_PyExc_TypeError@_PyExc_ValueError@_PyUnicode_FSConverter@__Py_NoneStruct@__Py_TrueStruct@_xmlSecDSigNs€ @_xmlSecEncNs@_xmlSecNodeCanonicalizationMethod@_xmlSecNodeCipherData@_xmlSecNodeCipherReference@_xmlSecNodeCipherValue@_xmlSecNodeDataReference@_xmlSecNodeDigestMethod@_xmlSecNodeDigestValue@_xmlSecNodeEncryptedData@_xmlSecNodeEncryptedKey@_xmlSecNodeEncryptionMethod@_xmlSecNodeEncryptionProperties@_xmlSecNodeEncryptionProperty@_xmlSecNodeKeyInfo@_xmlSecNodeKeyName@_xmlSecNodeKeyReference@_xmlSecNodeKeyValue@_xmlSecNodeManifest@_xmlSecNodeObject@_xmlSecNodeReference@_xmlSecNodeReferenceList@_xmlSecNodeSignature@_xmlSecNodeSignatureMethod@_xmlSecNodeSignatureProperties@_xmlSecNodeSignatureValue@_xmlSecNodeSignedInfo@_xmlSecNodeX509Data@_xmlSecNs@_xmlSecNsExcC14N@_xmlSecNsExcC14NWithComments@_xmlSecSoap11Ns@_xmlSecSoap12Ns@_xmlSecTypeEncContent@_xmlSecTypeEncElement@_xmlSecXPath2Ns@_xmlSecXPathNs@_xmlSecXPointerNs@_xmlFree€Àýÿÿÿÿÿÿÿ@_xmlMalloc@___stack_chk_guard€àÿÿÿÿÿÿÿÿ@___stderrp@dyld_stub_binder€Àr>@_PyBytes_AsStringr>@_PyBytes_AsStringAndSizer>@_PyBytes_FromStringAndSizer>@_PyCallable_Checkr >@_PyCapsule_GetNamer(>@_PyCapsule_GetPointerr0>@_PyCapsule_IsValidr8>@_PyDict_GetItemStringr@>@_PyErr_FormatrH>@_PyErr_NewExceptionWithDocrP>@_PyErr_OccurredrX>@_PyErr_SetObjectr`>@_PyErr_SetStringrh>@_PyEval_RestoreThreadrp>@_PyEval_SaveThreadrx>@_PyGILState_Ensurer€>@_PyGILState_Releaserˆ>@_PyImport_ImportModuler>@_PyIter_Nextr˜>@_PyLong_AsLongr >@_PyLong_FromLongr¨>@_PyLong_FromSsize_tr°>@_PyLong_FromUnsignedLongr¸>@_PyMem_FreerÀ>@_PyMemoryView_FromMemoryrÈ>@_PyModule_AddIntConstantrÐ>@_PyModule_AddObjectrØ>@_PyModule_AddStringConstantrà>@_PyModule_Create2rè>@_PyModule_GetNamerð>@_PyModule_Newrø>@_PyObject_CallFunctionObjArgsr€>@_PyObject_CallObjectrˆ>@_PyObject_GetAttrStringr>@_PyObject_GetItemr˜>@_PyObject_GetIterr >@_PyObject_HasAttrStringr¨>@_PyObject_IsInstancer°>@_PyObject_IsTruer¸>@_PyObject_SetAttrStringrÀ>@_PyObject_SizerÈ>@_PyThread_tss_createrÐ>@_PyThread_tss_getrØ>@_PyThread_tss_is_createdrà>@_PyThread_tss_setrè>@_PyType_GenericNewrð>@_PyType_Readyrø>@_PyUnicode_AsUTF8r€>@_PyUnicode_AsUTF8Stringrˆ>@_PyUnicode_FSConverterr>@_PyUnicode_FromStringr˜>@__PyArg_ParseTupleAndKeywords_SizeTr >@__PyObject_CallFunction_SizeTr¨>@__PyObject_CallMethod_SizeTr°>@__PyObject_Newr¸>@__Py_BuildValue_SizeTrÀ>@__Py_DeallocrÈ@___stack_chk_failrÐ@_fprintfrØ@_freerà@_mallocrè@_snprintfrð@_xmlAddIDrø@_xmlCharStrdupr€@_xmlDocCopyNoderˆ@_xmlDocGetRootElementr@_xmlFreeNoder˜@_xmlGetIDr @_xmlGetPropr¨@_xmlHasNsPropr°@_xmlHasPropr¸@_xmlNodeListGetStringrÀ@_xmlSecAddIDsrÈ@_xmlSecBase64GetDefaultLineSizerÐ@_xmlSecBase64SetDefaultLineSizerØ@_xmlSecBufferGetDatarà@_xmlSecBufferGetSizerè@_xmlSecCheckNodeNamerð@_xmlSecCheckVersionExtrø@_xmlSecDSigCtxCreater€@_xmlSecDSigCtxDestroyrˆ@_xmlSecDSigCtxEnableReferenceTransformr@_xmlSecDSigCtxEnableSignatureTransformr˜@_xmlSecDSigCtxSignr @_xmlSecDSigCtxVerifyr¨@_xmlSecEncCtxBinaryEncryptr°@_xmlSecEncCtxCreater¸@_xmlSecEncCtxDecryptrÀ@_xmlSecEncCtxDestroyrÈ@_xmlSecEncCtxResetrÐ@_xmlSecEncCtxUriEncryptrØ@_xmlSecEncCtxXmlEncryptrà@_xmlSecErrorsGetCoderè@_xmlSecErrorsGetMsgrð@_xmlSecErrorsSetCallbackrø@_xmlSecFindChildr€@_xmlSecFindNoderˆ@_xmlSecFindParentr@_xmlSecIOCleanupCallbacksr˜@_xmlSecIORegisterCallbacksr @_xmlSecIORegisterDefaultCallbacksr¨@_xmlSecInitr°@_xmlSecKeyDataEncryptedKeyGetKlassr¸@_xmlSecKeyDataNameGetKlassrÀ@_xmlSecKeyDataRetrievalMethodGetKlassrÈ@_xmlSecKeyDataValueGetKlassrÐ@_xmlSecKeyDestroyrØ@_xmlSecKeyDuplicaterà@_xmlSecKeyGeneraterè@_xmlSecKeyGetNamerð@_xmlSecKeyMatchrø@_xmlSecKeyReadBinaryFiler€@_xmlSecKeyReadMemoryrˆ@_xmlSecKeySetNamer@_xmlSecKeysMngrCreater˜@_xmlSecKeysMngrDestroyr @_xmlSecOpenSSLAppDefaultKeysMngrAdoptKeyr¨@_xmlSecOpenSSLAppDefaultKeysMngrInitr°@_xmlSecOpenSSLAppInitr¸@_xmlSecOpenSSLAppKeyCertLoadrÀ@_xmlSecOpenSSLAppKeyCertLoadMemoryrÈ@_xmlSecOpenSSLAppKeyLoadrÐ@_xmlSecOpenSSLAppKeyLoadMemoryrØ@_xmlSecOpenSSLAppKeysMngrCertLoadrà@_xmlSecOpenSSLAppKeysMngrCertLoadMemoryrè@_xmlSecOpenSSLAppShutdownrð@_xmlSecOpenSSLInitrø@_xmlSecOpenSSLKeyDataAesGetKlassr€@_xmlSecOpenSSLKeyDataDesGetKlassrˆ@_xmlSecOpenSSLKeyDataDsaGetKlassr@_xmlSecOpenSSLKeyDataEcdsaGetKlassr˜@_xmlSecOpenSSLKeyDataHmacGetKlassr @_xmlSecOpenSSLKeyDataRawX509CertGetKlassr¨@_xmlSecOpenSSLKeyDataRsaGetKlassr°@_xmlSecOpenSSLKeyDataX509GetKlassr¸@_xmlSecOpenSSLTransformAes128CbcGetKlassrÀ@_xmlSecOpenSSLTransformAes128GcmGetKlassrÈ@_xmlSecOpenSSLTransformAes192CbcGetKlassrÐ@_xmlSecOpenSSLTransformAes192GcmGetKlassrØ@_xmlSecOpenSSLTransformAes256CbcGetKlassrà@_xmlSecOpenSSLTransformAes256GcmGetKlassrè@_xmlSecOpenSSLTransformDes3CbcGetKlassrð@_xmlSecOpenSSLTransformDsaSha1GetKlassrø@_xmlSecOpenSSLTransformEcdsaSha1GetKlassr€ @_xmlSecOpenSSLTransformEcdsaSha224GetKlassrˆ @_xmlSecOpenSSLTransformEcdsaSha256GetKlassr @_xmlSecOpenSSLTransformEcdsaSha384GetKlassr˜ @_xmlSecOpenSSLTransformEcdsaSha512GetKlassr  @_xmlSecOpenSSLTransformHmacMd5GetKlassr¨ @_xmlSecOpenSSLTransformHmacRipemd160GetKlassr° @_xmlSecOpenSSLTransformHmacSha1GetKlassr¸ @_xmlSecOpenSSLTransformHmacSha224GetKlassrÀ @_xmlSecOpenSSLTransformHmacSha256GetKlassrÈ @_xmlSecOpenSSLTransformHmacSha384GetKlassrÐ @_xmlSecOpenSSLTransformHmacSha512GetKlassrØ @_xmlSecOpenSSLTransformKWAes128GetKlassrà @_xmlSecOpenSSLTransformKWAes192GetKlassrè @_xmlSecOpenSSLTransformKWAes256GetKlassrð @_xmlSecOpenSSLTransformKWDes3GetKlassrø @_xmlSecOpenSSLTransformMd5GetKlassr€ @_xmlSecOpenSSLTransformRipemd160GetKlassrˆ @_xmlSecOpenSSLTransformRsaMd5GetKlassr @_xmlSecOpenSSLTransformRsaOaepGetKlassr˜ @_xmlSecOpenSSLTransformRsaPkcs1GetKlassr  @_xmlSecOpenSSLTransformRsaRipemd160GetKlassr¨ @_xmlSecOpenSSLTransformRsaSha1GetKlassr° @_xmlSecOpenSSLTransformRsaSha224GetKlassr¸ @_xmlSecOpenSSLTransformRsaSha256GetKlassrÀ @_xmlSecOpenSSLTransformRsaSha384GetKlassrÈ @_xmlSecOpenSSLTransformRsaSha512GetKlassrÐ @_xmlSecOpenSSLTransformSha1GetKlassrØ @_xmlSecOpenSSLTransformSha224GetKlassrà @_xmlSecOpenSSLTransformSha256GetKlassrè @_xmlSecOpenSSLTransformSha384GetKlassrð @_xmlSecOpenSSLTransformSha512GetKlassrø @_xmlSecPtrListAddr€ @_xmlSecPtrListEmptyrˆ @_xmlSecShutdownr @_xmlSecTmplEncDataCreater˜ @_xmlSecTmplEncDataEnsureCipherValuer  @_xmlSecTmplEncDataEnsureKeyInfor¨ @_xmlSecTmplKeyInfoAddEncryptedKeyr° @_xmlSecTmplKeyInfoAddKeyNamer¸ @_xmlSecTmplKeyInfoAddKeyValuerÀ @_xmlSecTmplKeyInfoAddX509DatarÈ @_xmlSecTmplReferenceAddTransformrÐ @_xmlSecTmplSignatureAddReferencerØ @_xmlSecTmplSignatureCreateNsPrefrà @_xmlSecTmplSignatureEnsureKeyInforè @_xmlSecTmplTransformAddC14NInclNamespacesrð @_xmlSecTmplX509DataAddCRLrø @_xmlSecTmplX509DataAddCertificater€ @_xmlSecTmplX509DataAddIssuerSerialrˆ @_xmlSecTmplX509DataAddSKIr @_xmlSecTmplX509DataAddSubjectNamer˜ @_xmlSecTmplX509IssuerSerialAddIssuerNamer  @_xmlSecTmplX509IssuerSerialAddSerialNumberr¨ @_xmlSecTransformCtxBinaryExecuter° @_xmlSecTransformCtxCreateAndAppendr¸ @_xmlSecTransformEnvelopedGetKlassrÀ @_xmlSecTransformExclC14NGetKlassrÈ @_xmlSecTransformExclC14NWithCommentsGetKlassrÐ @_xmlSecTransformInclC14N11GetKlassrØ @_xmlSecTransformInclC14N11WithCommentsGetKlassrà @_xmlSecTransformInclC14NGetKlassrè @_xmlSecTransformInclC14NWithCommentsGetKlassrð @_xmlSecTransformRemoveXmlTagsC14NGetKlassrø @_xmlSecTransformSetKeyr€ @_xmlSecTransformSetKeyReqrˆ @_xmlSecTransformVerifyr @_xmlSecTransformVisa3DHackGetKlassr˜ @_xmlSecTransformXPath2GetKlassr  @_xmlSecTransformXPathGetKlassr¨ @_xmlSecTransformXPointerGetKlassr° @_xmlSecTransformXsltGetKlassr¸ @_xmlStrEqualrÀ @_xmlStrdup_Py èþInit_xmlsecXmlSec*¬ÌEnableDebugTrace$_n¬ËlearErrorAonstantsModule_Initiˆ: CGDSModule_InitõE¬GetFilePathOrContent„IÐKeyíLxmlElementConverterÅNewKeyËS—TÀVerificationError‡elementFactoryì˜ð°Module_InitûryptionContextType¦ð¡ncrrorÑxceptionsModule_Initþ€°HolderæØÅCreateàFreeøìÆüΔ¸ îitLxmlModuleŠstallErrorCallbackÄternalErrorʸ̈°nsElementáÐûˆ”DataTypeçModule_InitšType sManager¬˜Óˆ¨œÒConvert¦Type¿¨«ˆüôјË2ÛÄÇastErrorÑongAttrøкLáStringAttr‘à¹etþignatureContextType´¨šÄ‘emplateModule_InitºráèansformTypeÛeeModule_Init°¯°üûˆ:¨Y ˆ ( ŒŒ (`P¸ü¬àļ°°ä€Tà`P¸HÀ´¼ÄtTà”XÔh 0”ø(| 8 ðŒð¨è¸Ô \Œ4`”€¼° , H˜¸¨,45 ag5 cŒ5 (c³5 PcÜ5 `cõ5 Èc6 Hf/6 ¤iU6 &m{6 Ãn¢6 qpÆ6 rë6 _s7 «tD7 v‚7 øwÈ7 âyû7 P{&8 ¥|Y8 ~„8 g­8 a‚Ú8 ÿ…9 ˆF9 w‰~9 ‹ž9 P‹Ä9 €‹ê9 ˜‹: °‹5: È‹Z: Ø‹: 苳: ø‹ñ: Œ7; (Œj; 8Œ•; HŒÈ; XŒó; hŒ< ˜ŒI< ØŒ}< øŒµ< í< = ˆ= (Ž7= úW= Ä‘u= Œ“‘= ð•°= –Ð= 0–î= P– > h–&> p–=> €–f> ˆ–> –Á> ˜–î>  –? ¨–G? °–m? ¸––? À–Î? È–@ Ж8@ Ø–e@ à–Š@ è–´@ ð–Ö@ ø–ø@ —A —:A —`A —†A —¯A (—âA 0—B 8—7B @—cB H—B P—¶B X—çB `— C h—.C p—ZC x—‡C €—­C ˆ—×C —ýC ˜—,D  —PD ¨—oD °—’D ¸—ÀD À—éD È—E ЗHE Ø—oE à—¡E è—¬E ð—ÂE ø—dÔEdFdFfÖf‡d.F$$¨,N.°I¯F$°I$ N°I.¼IÊF$¼I$N¼I.LJæF$LJ$ˆNLJ.ÔJG$ÔJ$ NÔJ.àJG$àJ$(NàJ.K7G$K$ NK.KSG$K$ NK. KlG$ K$ŒN K.¬K†G$¬K$ŒN¬K.8LŸG$8L$ N8L.DL¸G$DL$(NDLÑG&ßóG&$ßH&Rß8H&qßXH&†ßxH& ÐF‘H ©H& pHÀH ÖH& JðH& xJ I& KdÔEd"Id'IfÖf‡d.lL¡I$lL$`NlL.ÌL¹I$ÌL$PNÌL.MÛI$M$¸NM.ÔMþI$ÔM$NÔM.ðM J$ðM$|NðM.lOEJ$lO$¬NlO.PdJ$P$àNP.øP…J$øP$ÄNøP.¼QªJ$¼Q$<N¼Q.øRÑJ$øR$°NøR.¨SK$¨S$°N¨S.XT7K$XT$dNXT.¼UcK$¼U$€N¼U.Z PZ& TkZ …Z& °UšZ& ðV®Z& @WÍZ& `WêZ& €W[&  W*[& ¸WM[& ÐWp[& èW‘[& X®[& €XÑ[& Xö[& °XdÔEd%\d,\f×f‡d. w¨\$ w$°N w.Ð}Á\$Ð}$,NÐ}.ü}Õ\$ü}$ Nü}.~î\$~$HN~.P~ ]$P~$NP~#]& €–L]& ˆ–v]& –§]& ˜–Ô]&  –ý]& ¨–-^& °–S^& ¸–|^& À–´^& È–è^& Ж_& Ø–K_& à–p_& è–š_& ð–¼_& ø–Þ_& —ÿ_& — `& —F`& —l`& —•`& (—È`& 0—ô`& 8—a& @—Ia& H—ua& P—œa& X—Ía& `—ða& h—b& p—@b& x—mb& €—“b& ˆ—½b& —ãb& ˜—c&  —6c& ¨—Uc& °—xc& ¸—¦c& À—Ïc& È—d& З.d& Ø—Ud& à—dÔEd‡ddŽdf×f‡d.h e$h$¸Nh. €e$ €$¨N €.È€(e$È€$,NÈ€.ô€:e$ô€$4Nô€.(Ke$($<N(.d`e$d$tNd.Ø~e$Ø$\NØ.4‚e$4‚$dN4‚.˜‚Äe$˜‚$€N˜‚.„äe$„$¸N„.Єf$Є$4NЄ.…f$…$äN….è…'f$è…$„Nè….l†8f$l†$Nl†.l‡If$l‡$´Nl‡. ˆ[f$ ˆ$¤N ˆif& ÐXyf& 8Yf& 8Z§f& êZÃf& Ÿ[èf& i\g& £\ Y  › ­ Á Ô æ ö  $ 6 L c … › ¶ Í æ þ .Fb‚ ³ÆÞò-F[v•¯ÅÙãô:_u’µÎí7Qd…¦Çê 5Vx¡ÊóEn•¼å;f‘¸å 7a‹µÝ-SvŸÅì@g¹â /U{¡ÇÙíý 6Zzœ¹×õ7Xz¤¾à?h“´×ùGj™ºç(BY|›¹Ú÷ #3BTalýþÿ    !"#$%&'()*+,-./0123456789:=@ABCDEFGIJKLMOPQRSTUVWXYZ[\^_`abcdfghijklmnopqrstuvwxyz{|}›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ  3;<>?HN]e~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™šÙÚýþÿ    !"#$%&'()*+,-./0123456789:=@ABCDEFGIJKLMOPQRSTUVWXYZ[\^_`abcdfghijklmnopqrstuvwxyz{|}›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ _PyInit_xmlsec_PyXmlSecEnableDebugTrace_PyXmlSec_ClearError_PyXmlSec_ConstantsModule_Init_PyXmlSec_DSModule_Init_PyXmlSec_EncModule_Init_PyXmlSec_EncryptionContextType_PyXmlSec_Error_PyXmlSec_ErrorHolderCreate_PyXmlSec_ErrorHolderFree_PyXmlSec_ExceptionsModule_Init_PyXmlSec_GetFilePathOrContent_PyXmlSec_InitLxmlModule_PyXmlSec_InstallErrorCallback_PyXmlSec_InternalError_PyXmlSec_IsElement_PyXmlSec_KeyDataType_PyXmlSec_KeyModule_Init_PyXmlSec_KeyType_PyXmlSec_KeysManagerConvert_PyXmlSec_KeysManagerType_PyXmlSec_LxmlElementConverter_PyXmlSec_NewKey_PyXmlSec_SetLastError_PyXmlSec_SetLastError2_PyXmlSec_SetLongAttr_PyXmlSec_SetStringAttr_PyXmlSec_SignatureContextType_PyXmlSec_TemplateModule_Init_PyXmlSec_TransformType_PyXmlSec_TreeModule_Init_PyXmlSec_VerificationError_PyXmlSec_elementFactory_PyBytes_AsString_PyBytes_AsStringAndSize_PyBytes_FromStringAndSize_PyCallable_Check_PyCapsule_GetName_PyCapsule_GetPointer_PyCapsule_IsValid_PyDict_GetItemString_PyErr_Format_PyErr_NewExceptionWithDoc_PyErr_Occurred_PyErr_SetObject_PyErr_SetString_PyEval_RestoreThread_PyEval_SaveThread_PyExc_Exception_PyExc_ImportError_PyExc_MemoryError_PyExc_TypeError_PyExc_ValueError_PyGILState_Ensure_PyGILState_Release_PyImport_ImportModule_PyIter_Next_PyLong_AsLong_PyLong_FromLong_PyLong_FromSsize_t_PyLong_FromUnsignedLong_PyMem_Free_PyMemoryView_FromMemory_PyModule_AddIntConstant_PyModule_AddObject_PyModule_AddStringConstant_PyModule_Create2_PyModule_GetName_PyModule_New_PyObject_CallFunctionObjArgs_PyObject_CallObject_PyObject_GetAttrString_PyObject_GetItem_PyObject_GetIter_PyObject_HasAttrString_PyObject_IsInstance_PyObject_IsTrue_PyObject_SetAttrString_PyObject_Size_PyThread_tss_create_PyThread_tss_get_PyThread_tss_is_created_PyThread_tss_set_PyType_GenericNew_PyType_Ready_PyUnicode_AsUTF8_PyUnicode_AsUTF8String_PyUnicode_FSConverter_PyUnicode_FromString__PyArg_ParseTupleAndKeywords_SizeT__PyObject_CallFunction_SizeT__PyObject_CallMethod_SizeT__PyObject_New__Py_BuildValue_SizeT__Py_Dealloc__Py_NoneStruct__Py_TrueStruct___stack_chk_fail___stack_chk_guard___stderrp_fprintf_free_malloc_snprintf_xmlAddID_xmlCharStrdup_xmlDocCopyNode_xmlDocGetRootElement_xmlFree_xmlFreeNode_xmlGetID_xmlGetProp_xmlHasNsProp_xmlHasProp_xmlMalloc_xmlNodeListGetString_xmlSecAddIDs_xmlSecBase64GetDefaultLineSize_xmlSecBase64SetDefaultLineSize_xmlSecBufferGetData_xmlSecBufferGetSize_xmlSecCheckNodeName_xmlSecCheckVersionExt_xmlSecDSigCtxCreate_xmlSecDSigCtxDestroy_xmlSecDSigCtxEnableReferenceTransform_xmlSecDSigCtxEnableSignatureTransform_xmlSecDSigCtxSign_xmlSecDSigCtxVerify_xmlSecDSigNs_xmlSecEncCtxBinaryEncrypt_xmlSecEncCtxCreate_xmlSecEncCtxDecrypt_xmlSecEncCtxDestroy_xmlSecEncCtxReset_xmlSecEncCtxUriEncrypt_xmlSecEncCtxXmlEncrypt_xmlSecEncNs_xmlSecErrorsGetCode_xmlSecErrorsGetMsg_xmlSecErrorsSetCallback_xmlSecFindChild_xmlSecFindNode_xmlSecFindParent_xmlSecIOCleanupCallbacks_xmlSecIORegisterCallbacks_xmlSecIORegisterDefaultCallbacks_xmlSecInit_xmlSecKeyDataEncryptedKeyGetKlass_xmlSecKeyDataNameGetKlass_xmlSecKeyDataRetrievalMethodGetKlass_xmlSecKeyDataValueGetKlass_xmlSecKeyDestroy_xmlSecKeyDuplicate_xmlSecKeyGenerate_xmlSecKeyGetName_xmlSecKeyMatch_xmlSecKeyReadBinaryFile_xmlSecKeyReadMemory_xmlSecKeySetName_xmlSecKeysMngrCreate_xmlSecKeysMngrDestroy_xmlSecNodeCanonicalizationMethod_xmlSecNodeCipherData_xmlSecNodeCipherReference_xmlSecNodeCipherValue_xmlSecNodeDataReference_xmlSecNodeDigestMethod_xmlSecNodeDigestValue_xmlSecNodeEncryptedData_xmlSecNodeEncryptedKey_xmlSecNodeEncryptionMethod_xmlSecNodeEncryptionProperties_xmlSecNodeEncryptionProperty_xmlSecNodeKeyInfo_xmlSecNodeKeyName_xmlSecNodeKeyReference_xmlSecNodeKeyValue_xmlSecNodeManifest_xmlSecNodeObject_xmlSecNodeReference_xmlSecNodeReferenceList_xmlSecNodeSignature_xmlSecNodeSignatureMethod_xmlSecNodeSignatureProperties_xmlSecNodeSignatureValue_xmlSecNodeSignedInfo_xmlSecNodeX509Data_xmlSecNs_xmlSecNsExcC14N_xmlSecNsExcC14NWithComments_xmlSecOpenSSLAppDefaultKeysMngrAdoptKey_xmlSecOpenSSLAppDefaultKeysMngrInit_xmlSecOpenSSLAppInit_xmlSecOpenSSLAppKeyCertLoad_xmlSecOpenSSLAppKeyCertLoadMemory_xmlSecOpenSSLAppKeyLoad_xmlSecOpenSSLAppKeyLoadMemory_xmlSecOpenSSLAppKeysMngrCertLoad_xmlSecOpenSSLAppKeysMngrCertLoadMemory_xmlSecOpenSSLAppShutdown_xmlSecOpenSSLInit_xmlSecOpenSSLKeyDataAesGetKlass_xmlSecOpenSSLKeyDataDesGetKlass_xmlSecOpenSSLKeyDataDsaGetKlass_xmlSecOpenSSLKeyDataEcdsaGetKlass_xmlSecOpenSSLKeyDataHmacGetKlass_xmlSecOpenSSLKeyDataRawX509CertGetKlass_xmlSecOpenSSLKeyDataRsaGetKlass_xmlSecOpenSSLKeyDataX509GetKlass_xmlSecOpenSSLTransformAes128CbcGetKlass_xmlSecOpenSSLTransformAes128GcmGetKlass_xmlSecOpenSSLTransformAes192CbcGetKlass_xmlSecOpenSSLTransformAes192GcmGetKlass_xmlSecOpenSSLTransformAes256CbcGetKlass_xmlSecOpenSSLTransformAes256GcmGetKlass_xmlSecOpenSSLTransformDes3CbcGetKlass_xmlSecOpenSSLTransformDsaSha1GetKlass_xmlSecOpenSSLTransformEcdsaSha1GetKlass_xmlSecOpenSSLTransformEcdsaSha224GetKlass_xmlSecOpenSSLTransformEcdsaSha256GetKlass_xmlSecOpenSSLTransformEcdsaSha384GetKlass_xmlSecOpenSSLTransformEcdsaSha512GetKlass_xmlSecOpenSSLTransformHmacMd5GetKlass_xmlSecOpenSSLTransformHmacRipemd160GetKlass_xmlSecOpenSSLTransformHmacSha1GetKlass_xmlSecOpenSSLTransformHmacSha224GetKlass_xmlSecOpenSSLTransformHmacSha256GetKlass_xmlSecOpenSSLTransformHmacSha384GetKlass_xmlSecOpenSSLTransformHmacSha512GetKlass_xmlSecOpenSSLTransformKWAes128GetKlass_xmlSecOpenSSLTransformKWAes192GetKlass_xmlSecOpenSSLTransformKWAes256GetKlass_xmlSecOpenSSLTransformKWDes3GetKlass_xmlSecOpenSSLTransformMd5GetKlass_xmlSecOpenSSLTransformRipemd160GetKlass_xmlSecOpenSSLTransformRsaMd5GetKlass_xmlSecOpenSSLTransformRsaOaepGetKlass_xmlSecOpenSSLTransformRsaPkcs1GetKlass_xmlSecOpenSSLTransformRsaRipemd160GetKlass_xmlSecOpenSSLTransformRsaSha1GetKlass_xmlSecOpenSSLTransformRsaSha224GetKlass_xmlSecOpenSSLTransformRsaSha256GetKlass_xmlSecOpenSSLTransformRsaSha384GetKlass_xmlSecOpenSSLTransformRsaSha512GetKlass_xmlSecOpenSSLTransformSha1GetKlass_xmlSecOpenSSLTransformSha224GetKlass_xmlSecOpenSSLTransformSha256GetKlass_xmlSecOpenSSLTransformSha384GetKlass_xmlSecOpenSSLTransformSha512GetKlass_xmlSecPtrListAdd_xmlSecPtrListEmpty_xmlSecShutdown_xmlSecSoap11Ns_xmlSecSoap12Ns_xmlSecTmplEncDataCreate_xmlSecTmplEncDataEnsureCipherValue_xmlSecTmplEncDataEnsureKeyInfo_xmlSecTmplKeyInfoAddEncryptedKey_xmlSecTmplKeyInfoAddKeyName_xmlSecTmplKeyInfoAddKeyValue_xmlSecTmplKeyInfoAddX509Data_xmlSecTmplReferenceAddTransform_xmlSecTmplSignatureAddReference_xmlSecTmplSignatureCreateNsPref_xmlSecTmplSignatureEnsureKeyInfo_xmlSecTmplTransformAddC14NInclNamespaces_xmlSecTmplX509DataAddCRL_xmlSecTmplX509DataAddCertificate_xmlSecTmplX509DataAddIssuerSerial_xmlSecTmplX509DataAddSKI_xmlSecTmplX509DataAddSubjectName_xmlSecTmplX509IssuerSerialAddIssuerName_xmlSecTmplX509IssuerSerialAddSerialNumber_xmlSecTransformCtxBinaryExecute_xmlSecTransformCtxCreateAndAppend_xmlSecTransformEnvelopedGetKlass_xmlSecTransformExclC14NGetKlass_xmlSecTransformExclC14NWithCommentsGetKlass_xmlSecTransformInclC14N11GetKlass_xmlSecTransformInclC14N11WithCommentsGetKlass_xmlSecTransformInclC14NGetKlass_xmlSecTransformInclC14NWithCommentsGetKlass_xmlSecTransformRemoveXmlTagsC14NGetKlass_xmlSecTransformSetKey_xmlSecTransformSetKeyReq_xmlSecTransformVerify_xmlSecTransformVisa3DHackGetKlass_xmlSecTransformXPath2GetKlass_xmlSecTransformXPathGetKlass_xmlSecTransformXPointerGetKlass_xmlSecTransformXsltGetKlass_xmlSecTypeEncContent_xmlSecTypeEncElement_xmlSecXPath2Ns_xmlSecXPathNs_xmlSecXPointerNs_xmlStrEqual_xmlStrdupdyld_stub_binder_PyXmlSec_Transform__del___PyXmlSec_Transform__repr___PyXmlSec_Transform__str___PyXmlSec_TransformNameGet_PyXmlSec_TransformHrefGet_PyXmlSec_TransformUsageGet_PyXmlSec_KeyData__del___PyXmlSec_KeyData__repr___PyXmlSec_KeyData__str___PyXmlSec_KeyDataNameGet_PyXmlSec_KeyDataHrefGet_PyXmlSec_SignatureContext__del___PyXmlSec_SignatureContext__init___PyXmlSec_SignatureContext__new___PyXmlSec_SignatureContextRegisterId_PyXmlSec_SignatureContextSign_PyXmlSec_SignatureContextVerify_PyXmlSec_SignatureContextSignBinary_PyXmlSec_SignatureContextVerifyBinary_PyXmlSec_SignatureContextEnableReferenceTransform_PyXmlSec_SignatureContextEnableSignatureTransform_PyXmlSec_SignatureContextSetEnabledKeyData_PyXmlSec_ProcessSignBinary_PyXmlSec_SignatureContextKeyGet_PyXmlSec_SignatureContextKeySet_PyXmlSec_EncryptionContext__del___PyXmlSec_EncryptionContext__init___PyXmlSec_EncryptionContext__new___PyXmlSec_EncryptionContextReset_PyXmlSec_EncryptionContextEncryptBinary_PyXmlSec_EncryptionContextEncryptXml_PyXmlSec_EncryptionContextEncryptUri_PyXmlSec_EncryptionContextDecrypt_PyXmlSec_ClearReplacedNodes_PyXmlSec_EncryptionContextKeyGet_PyXmlSec_EncryptionContextKeySet_PyXmlSec_ExchangeLastError_PyXmlSec_ErrorCallback_PyXmlSec_Key__del___PyXmlSec_Key__new___PyXmlSec_KeyFromMemory_PyXmlSec_KeyFromFile_PyXmlSec_KeyGenerate_PyXmlSec_KeyFromBinaryFile_PyXmlSec_KeyFromBinaryData_PyXmlSec_KeyCertFromMemory_PyXmlSec_KeyCertFromFile_PyXmlSec_Key__copy___PyXmlSec_KeyNameGet_PyXmlSec_KeyNameSet_PyXmlSec_KeysManager__del___PyXmlSec_KeysManager__init___PyXmlSec_KeysManager__new___PyXmlSec_KeysManagerAddKey_PyXmlSec_KeysManagerLoadCert_PyXmlSec_KeysManagerLoadCertFromMemory___Pyx_ImportFunction_PyXmlSec_Init_PyXmlSec_PyClear_PyXmlSec_PyInit_PyXmlSec_PyShutdown_PyXmlSec_PyEnableDebugOutput_PyXmlSec_PyIOCleanupCallbacks_PyXmlSec_PyIORegisterDefaultCallbacks_PyXmlSec_PyIORegisterCallbacks_PyXmlSec_PyBase64DefaultLineSize_PyXmlSec_Free_PyXmlSec_MatchCB_PyXmlSec_OpenCB_PyXmlSec_ReadCB_PyXmlSec_CloseCB_RCBListClear_PyXmlSec_TemplateCreate_PyXmlSec_TemplateAddReference_PyXmlSec_TemplateAddTransform_PyXmlSec_TemplateEnsureKeyInfo_PyXmlSec_TemplateAddKeyName_PyXmlSec_TemplateAddKeyValue_PyXmlSec_TemplateAddX509Data_PyXmlSec_TemplateAddX509DataAddIssuerSerial_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber_PyXmlSec_TemplateAddX509DataAddSubjectName_PyXmlSec_TemplateAddX509DataAddSKI_PyXmlSec_TemplateAddX509DataAddCertificate_PyXmlSec_TemplateAddX509DataAddCRL_PyXmlSec_TemplateAddEncryptedKey_PyXmlSec_TemplateCreateEncryptedData_PyXmlSec_TemplateEncryptedDataEnsureKeyInfo_PyXmlSec_TemplateEncryptedDataEnsureCipherValue_PyXmlSec_TemplateTransformAddC14NInclNamespaces_PyXmlSec_TreeFindChild_PyXmlSec_TreeFindParent_PyXmlSec_TreeFindNode_PyXmlSec_TreeAddIds_PyXmlSec_TransformNameGet__doc___PyXmlSec_TransformHrefGet__doc___PyXmlSec_TransformUsageGet__doc___PyXmlSec_KeyDataNameGet__doc___PyXmlSec_KeyDataHrefGet__doc___PyXmlSec_SignatureContextRegisterId__doc___PyXmlSec_SignatureContextSign__doc___PyXmlSec_SignatureContextVerify__doc___PyXmlSec_SignatureContextSignBinary__doc___PyXmlSec_SignatureContextVerifyBinary__doc___PyXmlSec_SignatureContextEnableReferenceTransform__doc___PyXmlSec_SignatureContextEnableSignatureTransform__doc___PyXmlSec_SignatureContextSetEnabledKeyData__doc___PyXmlSec_SignatureContextKey__doc___PyXmlSec_EncryptionContextReset__doc___PyXmlSec_EncryptionContextEncryptBinary__doc___PyXmlSec_EncryptionContextEncryptXml__doc___PyXmlSec_EncryptionContextEncryptUri__doc___PyXmlSec_EncryptionContextDecrypt__doc___PyXmlSec_EncryptionContextKey__doc___PyXmlSec_KeyFromMemory__doc___PyXmlSec_KeyFromFile__doc___PyXmlSec_KeyGenerate__doc___PyXmlSec_KeyFromBinaryFile__doc___PyXmlSec_KeyFromBinaryData__doc___PyXmlSec_KeyCertFromMemory__doc___PyXmlSec_KeyCertFromFile__doc___PyXmlSec_KeyName__doc___PyXmlSec_KeysManagerAddKey__doc___PyXmlSec_KeysManagerLoadCert__doc___PyXmlSec_KeysManagerLoadCertFromMemory__doc____dyld_private__PyXmlSec_TransformType__PyXmlSec_KeyDataType_PyXmlSec_ConstantsModule_PyXmlSec_TransformGetSet_PyXmlSec_KeyDataGetSet__PyXmlSec_SignatureContextType_PyXmlSec_SignatureContextMethods_PyXmlSec_SignatureContextGetSet_PyXmlSec_SignatureContextRegisterId.kwlist_PyXmlSec_SignatureContextSign.kwlist_PyXmlSec_SignatureContextVerify.kwlist_PyXmlSec_SignatureContextSignBinary.kwlist_PyXmlSec_SignatureContextVerifyBinary.kwlist_PyXmlSec_SignatureContextEnableReferenceTransform.kwlist_PyXmlSec_SignatureContextEnableSignatureTransform.kwlist_PyXmlSec_SignatureContextSetEnabledKeyData.kwlist_PyXmlSec_SignatureContext__init__.kwlist__PyXmlSec_EncryptionContextType_PyXmlSec_EncryptionContextMethods_PyXmlSec_EncryptionContextGetSet_PyXmlSec_EncryptionContextEncryptBinary.kwlist_PyXmlSec_EncryptionContextEncryptXml.kwlist_PyXmlSec_EncryptionContextEncryptUri.kwlist_PyXmlSec_EncryptionContextDecrypt.kwlist_PyXmlSec_EncryptionContext__init__.kwlist__PyXmlSec_KeyType__PyXmlSec_KeysManagerType_PyXmlSec_KeyMethods_PyXmlSec_KeyGetSet_PyXmlSec_KeyFromMemory.kwlist_PyXmlSec_KeyFromFile.kwlist_PyXmlSec_KeyGenerate.kwlist_PyXmlSec_KeyFromBinaryFile.kwlist_PyXmlSec_KeyFromBinaryData.kwlist_PyXmlSec_KeyCertFromMemory.kwlist_PyXmlSec_KeyCertFromFile.kwlist_PyXmlSec_KeysManagerMethods_PyXmlSec_KeysManagerAddKey.kwlist_PyXmlSec_KeysManagerLoadCert.kwlist_PyXmlSec_KeysManagerLoadCertFromMemory.kwlist_PyXmlSecModule_PyXmlSec_MainMethods_PyXmlSec_PyInit__doc___PyXmlSec_PyShutdown__doc___PyXmlSec_PyEnableDebugOutput__doc___PyXmlSec_PyIOCleanupCallbacks__doc___PyXmlSec_PyIORegisterDefaultCallbacks__doc___PyXmlSec_PyIORegisterCallbacks__doc___PyXmlSec_PyBase64DefaultLineSize__doc___PyXmlSec_PyEnableDebugOutput.kwlist_PyXmlSec_PyIORegisterCallbacks.kwlist_PyXmlSec_PyBase64DefaultLineSize.kwlist_PyXmlSec_TemplateModule_PyXmlSec_TemplateMethods_PyXmlSec_TemplateCreate__doc___PyXmlSec_TemplateAddReference__doc___PyXmlSec_TemplateAddTransform__doc___PyXmlSec_TemplateEnsureKeyInfo__doc___PyXmlSec_TemplateAddKeyName__doc___PyXmlSec_TemplateAddKeyValue__doc___PyXmlSec_TemplateAddX509Data__doc___PyXmlSec_TemplateAddX509DataAddIssuerSerial__doc___PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName__doc___PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber__doc___PyXmlSec_TemplateAddX509DataAddSubjectName__doc___PyXmlSec_TemplateAddX509DataAddSKI__doc___PyXmlSec_TemplateAddX509DataAddCertificate__doc___PyXmlSec_TemplateAddX509DataAddCRL__doc___PyXmlSec_TemplateAddEncryptedKey__doc___PyXmlSec_TemplateCreateEncryptedData__doc___PyXmlSec_TemplateEncryptedDataEnsureKeyInfo__doc___PyXmlSec_TemplateEncryptedDataEnsureCipherValue__doc___PyXmlSec_TemplateTransformAddC14NInclNamespaces__doc___PyXmlSec_TemplateCreate.kwlist_PyXmlSec_TemplateAddReference.kwlist_PyXmlSec_TemplateAddTransform.kwlist_PyXmlSec_TemplateEnsureKeyInfo.kwlist_PyXmlSec_TemplateAddKeyName.kwlist_PyXmlSec_TemplateAddKeyValue.kwlist_PyXmlSec_TemplateAddX509Data.kwlist_PyXmlSec_TemplateAddX509DataAddIssuerSerial.kwlist_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName.kwlist_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber.kwlist_PyXmlSec_TemplateAddX509DataAddSubjectName.kwlist_PyXmlSec_TemplateAddX509DataAddSKI.kwlist_PyXmlSec_TemplateAddX509DataAddCertificate.kwlist_PyXmlSec_TemplateAddX509DataAddCRL.kwlist_PyXmlSec_TemplateAddEncryptedKey.kwlist_PyXmlSec_TemplateCreateEncryptedData.kwlist_PyXmlSec_TemplateEncryptedDataEnsureKeyInfo.kwlist_PyXmlSec_TemplateEncryptedDataEnsureCipherValue.kwlist_PyXmlSec_TemplateTransformAddC14NInclNamespaces.kwlist_PyXmlSec_TreeModule_PyXmlSec_TreeMethods_PyXmlSec_TreeFindChild__doc___PyXmlSec_TreeFindParent__doc___PyXmlSec_TreeFindNode__doc___PyXmlSec_TreeAddIds__doc___PyXmlSec_TreeFindChild.kwlist_PyXmlSec_TreeFindParent.kwlist_PyXmlSec_TreeFindNode.kwlist_PyXmlSec_TreeAddIds.kwlist_PyXmlSec_PrintErrorMessage_PyXmlSec_LastErrorKey___pyx_api_f_4lxml_5etree_elementFactory___pyx_api_f_4lxml_5etree_rootNodeOrRaise___pyx_api_f_4lxml_5etree_deepcopyNodeToDocument___pyx_api_f_4lxml_5etree_elementTreeFactory___pyx_api_f_4lxml_5etree_newElementTree___pyx_api_f_4lxml_5etree_adoptExternalDocument___pyx_api_f_4lxml_5etree_makeElement___pyx_api_f_4lxml_5etree_makeSubElement___pyx_api_f_4lxml_5etree_setElementClassLookupFunction___pyx_api_f_4lxml_5etree_lookupDefaultElementClass___pyx_api_f_4lxml_5etree_lookupNamespaceElementClass___pyx_api_f_4lxml_5etree_callLookupFallback___pyx_api_f_4lxml_5etree_tagMatches___pyx_api_f_4lxml_5etree_documentOrRaise___pyx_api_f_4lxml_5etree_hasText___pyx_api_f_4lxml_5etree_hasTail___pyx_api_f_4lxml_5etree_textOf___pyx_api_f_4lxml_5etree_tailOf___pyx_api_f_4lxml_5etree_setNodeText___pyx_api_f_4lxml_5etree_setTailText___pyx_api_f_4lxml_5etree_attributeValue___pyx_api_f_4lxml_5etree_attributeValueFromNsName___pyx_api_f_4lxml_5etree_getAttributeValue___pyx_api_f_4lxml_5etree_iterattributes___pyx_api_f_4lxml_5etree_collectAttributes___pyx_api_f_4lxml_5etree_setAttributeValue___pyx_api_f_4lxml_5etree_delAttribute___pyx_api_f_4lxml_5etree_delAttributeFromNsName___pyx_api_f_4lxml_5etree_hasChild___pyx_api_f_4lxml_5etree_findChild___pyx_api_f_4lxml_5etree_findChildForwards___pyx_api_f_4lxml_5etree_findChildBackwards___pyx_api_f_4lxml_5etree_nextElement___pyx_api_f_4lxml_5etree_previousElement___pyx_api_f_4lxml_5etree_appendChild___pyx_api_f_4lxml_5etree_appendChildToElement___pyx_api_f_4lxml_5etree_pyunicode___pyx_api_f_4lxml_5etree_utf8___pyx_api_f_4lxml_5etree_getNsTag___pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs___pyx_api_f_4lxml_5etree_namespacedName___pyx_api_f_4lxml_5etree_namespacedNameFromNsName___pyx_api_f_4lxml_5etree_iteratorStoreNext___pyx_api_f_4lxml_5etree_initTagMatch___pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix_free_mode_registered_callbacks_cur_cb_list_item/Users/amin/Workspace/repos/python-xmlsec/src/constants.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/constants.o_PyXmlSec_ConstantsModule_Init_PyXmlSec_Transform__del___PyXmlSec_Transform__repr___PyXmlSec_Transform__str___PyXmlSec_TransformNameGet_PyXmlSec_TransformHrefGet_PyXmlSec_TransformUsageGet_PyXmlSec_KeyData__del___PyXmlSec_KeyData__repr___PyXmlSec_KeyData__str___PyXmlSec_KeyDataNameGet_PyXmlSec_KeyDataHrefGet_PyXmlSec_TransformNameGet__doc___PyXmlSec_TransformHrefGet__doc___PyXmlSec_TransformUsageGet__doc___PyXmlSec_KeyDataNameGet__doc___PyXmlSec_KeyDataHrefGet__doc____PyXmlSec_TransformType_PyXmlSec_TransformType__PyXmlSec_KeyDataType_PyXmlSec_KeyDataType_PyXmlSec_ConstantsModule_PyXmlSec_TransformGetSet_PyXmlSec_KeyDataGetSetds.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/ds.o_PyXmlSec_DSModule_Init_PyXmlSec_SignatureContext__del___PyXmlSec_SignatureContext__init___PyXmlSec_SignatureContext__new___PyXmlSec_SignatureContextRegisterId_PyXmlSec_SignatureContextSign_PyXmlSec_SignatureContextVerify_PyXmlSec_SignatureContextSignBinary_PyXmlSec_SignatureContextVerifyBinary_PyXmlSec_SignatureContextEnableReferenceTransform_PyXmlSec_SignatureContextEnableSignatureTransform_PyXmlSec_SignatureContextSetEnabledKeyData_PyXmlSec_ProcessSignBinary_PyXmlSec_SignatureContextKeyGet_PyXmlSec_SignatureContextKeySet_PyXmlSec_SignatureContextRegisterId__doc___PyXmlSec_SignatureContextSign__doc___PyXmlSec_SignatureContextVerify__doc___PyXmlSec_SignatureContextSignBinary__doc___PyXmlSec_SignatureContextVerifyBinary__doc___PyXmlSec_SignatureContextEnableReferenceTransform__doc___PyXmlSec_SignatureContextEnableSignatureTransform__doc___PyXmlSec_SignatureContextSetEnabledKeyData__doc___PyXmlSec_SignatureContextKey__doc____PyXmlSec_SignatureContextType_PyXmlSec_SignatureContextType_PyXmlSec_SignatureContextMethods_PyXmlSec_SignatureContextGetSet_PyXmlSec_SignatureContextRegisterId.kwlist_PyXmlSec_SignatureContextSign.kwlist_PyXmlSec_SignatureContextVerify.kwlist_PyXmlSec_SignatureContextSignBinary.kwlist_PyXmlSec_SignatureContextVerifyBinary.kwlist_PyXmlSec_SignatureContextEnableReferenceTransform.kwlist_PyXmlSec_SignatureContextEnableSignatureTransform.kwlist_PyXmlSec_SignatureContextSetEnabledKeyData.kwlist_PyXmlSec_SignatureContext__init__.kwlistenc.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/enc.o_PyXmlSec_EncModule_Init_PyXmlSec_EncryptionContext__del___PyXmlSec_EncryptionContext__init___PyXmlSec_EncryptionContext__new___PyXmlSec_EncryptionContextReset_PyXmlSec_EncryptionContextEncryptBinary_PyXmlSec_EncryptionContextEncryptXml_PyXmlSec_EncryptionContextEncryptUri_PyXmlSec_EncryptionContextDecrypt_PyXmlSec_ClearReplacedNodes_PyXmlSec_EncryptionContextKeyGet_PyXmlSec_EncryptionContextKeySet_PyXmlSec_EncryptionContextReset__doc___PyXmlSec_EncryptionContextEncryptBinary__doc___PyXmlSec_EncryptionContextEncryptXml__doc___PyXmlSec_EncryptionContextEncryptUri__doc___PyXmlSec_EncryptionContextDecrypt__doc___PyXmlSec_EncryptionContextKey__doc____PyXmlSec_EncryptionContextType_PyXmlSec_EncryptionContextType_PyXmlSec_EncryptionContextMethods_PyXmlSec_EncryptionContextGetSet_PyXmlSec_EncryptionContextEncryptBinary.kwlist_PyXmlSec_EncryptionContextEncryptXml.kwlist_PyXmlSec_EncryptionContextEncryptUri.kwlist_PyXmlSec_EncryptionContextDecrypt.kwlist_PyXmlSec_EncryptionContext__init__.kwlistexception.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/exception.o_PyXmlSec_ErrorHolderCreate_PyXmlSec_ErrorHolderFree_PyXmlSec_SetLastError2_PyXmlSec_SetLastError_PyXmlSec_ClearError_PyXmlSec_ExchangeLastError_PyXmlSecEnableDebugTrace_PyXmlSec_InstallErrorCallback_PyXmlSec_ErrorCallback_PyXmlSec_ExceptionsModule_Init_PyXmlSec_PrintErrorMessage_PyXmlSec_LastErrorKey_PyXmlSec_Error_PyXmlSec_InternalError_PyXmlSec_VerificationErrorkeys.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/keys.o_PyXmlSec_NewKey_PyXmlSec_KeysManagerConvert_PyXmlSec_KeyModule_Init_PyXmlSec_Key__del___PyXmlSec_Key__new___PyXmlSec_KeyFromMemory_PyXmlSec_KeyFromFile_PyXmlSec_KeyGenerate_PyXmlSec_KeyFromBinaryFile_PyXmlSec_KeyFromBinaryData_PyXmlSec_KeyCertFromMemory_PyXmlSec_KeyCertFromFile_PyXmlSec_Key__copy___PyXmlSec_KeyNameGet_PyXmlSec_KeyNameSet_PyXmlSec_KeysManager__del___PyXmlSec_KeysManager__init___PyXmlSec_KeysManager__new___PyXmlSec_KeysManagerAddKey_PyXmlSec_KeysManagerLoadCert_PyXmlSec_KeysManagerLoadCertFromMemory_PyXmlSec_KeyFromMemory__doc___PyXmlSec_KeyFromFile__doc___PyXmlSec_KeyGenerate__doc___PyXmlSec_KeyFromBinaryFile__doc___PyXmlSec_KeyFromBinaryData__doc___PyXmlSec_KeyCertFromMemory__doc___PyXmlSec_KeyCertFromFile__doc___PyXmlSec_KeyName__doc___PyXmlSec_KeysManagerAddKey__doc___PyXmlSec_KeysManagerLoadCert__doc___PyXmlSec_KeysManagerLoadCertFromMemory__doc____PyXmlSec_KeyType_PyXmlSec_KeyType__PyXmlSec_KeysManagerType_PyXmlSec_KeysManagerType_PyXmlSec_KeyMethods_PyXmlSec_KeyGetSet_PyXmlSec_KeyFromMemory.kwlist_PyXmlSec_KeyFromFile.kwlist_PyXmlSec_KeyGenerate.kwlist_PyXmlSec_KeyFromBinaryFile.kwlist_PyXmlSec_KeyFromBinaryData.kwlist_PyXmlSec_KeyCertFromMemory.kwlist_PyXmlSec_KeyCertFromFile.kwlist_PyXmlSec_KeysManagerMethods_PyXmlSec_KeysManagerAddKey.kwlist_PyXmlSec_KeysManagerLoadCert.kwlist_PyXmlSec_KeysManagerLoadCertFromMemory.kwlistlxml.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/lxml.o_PyXmlSec_InitLxmlModule_PyXmlSec_IsElement_PyXmlSec_elementFactory_PyXmlSec_LxmlElementConverter___Pyx_ImportFunction___pyx_api_f_4lxml_5etree_elementFactory___pyx_api_f_4lxml_5etree_rootNodeOrRaise___pyx_api_f_4lxml_5etree_deepcopyNodeToDocument___pyx_api_f_4lxml_5etree_elementTreeFactory___pyx_api_f_4lxml_5etree_newElementTree___pyx_api_f_4lxml_5etree_adoptExternalDocument___pyx_api_f_4lxml_5etree_makeElement___pyx_api_f_4lxml_5etree_makeSubElement___pyx_api_f_4lxml_5etree_setElementClassLookupFunction___pyx_api_f_4lxml_5etree_lookupDefaultElementClass___pyx_api_f_4lxml_5etree_lookupNamespaceElementClass___pyx_api_f_4lxml_5etree_callLookupFallback___pyx_api_f_4lxml_5etree_tagMatches___pyx_api_f_4lxml_5etree_documentOrRaise___pyx_api_f_4lxml_5etree_hasText___pyx_api_f_4lxml_5etree_hasTail___pyx_api_f_4lxml_5etree_textOf___pyx_api_f_4lxml_5etree_tailOf___pyx_api_f_4lxml_5etree_setNodeText___pyx_api_f_4lxml_5etree_setTailText___pyx_api_f_4lxml_5etree_attributeValue___pyx_api_f_4lxml_5etree_attributeValueFromNsName___pyx_api_f_4lxml_5etree_getAttributeValue___pyx_api_f_4lxml_5etree_iterattributes___pyx_api_f_4lxml_5etree_collectAttributes___pyx_api_f_4lxml_5etree_setAttributeValue___pyx_api_f_4lxml_5etree_delAttribute___pyx_api_f_4lxml_5etree_delAttributeFromNsName___pyx_api_f_4lxml_5etree_hasChild___pyx_api_f_4lxml_5etree_findChild___pyx_api_f_4lxml_5etree_findChildForwards___pyx_api_f_4lxml_5etree_findChildBackwards___pyx_api_f_4lxml_5etree_nextElement___pyx_api_f_4lxml_5etree_previousElement___pyx_api_f_4lxml_5etree_appendChild___pyx_api_f_4lxml_5etree_appendChildToElement___pyx_api_f_4lxml_5etree_pyunicode___pyx_api_f_4lxml_5etree_utf8___pyx_api_f_4lxml_5etree_getNsTag___pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs___pyx_api_f_4lxml_5etree_namespacedName___pyx_api_f_4lxml_5etree_namespacedNameFromNsName___pyx_api_f_4lxml_5etree_iteratorStoreNext___pyx_api_f_4lxml_5etree_initTagMatch___pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefixmain.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/main.o_PyInit_xmlsec_PyXmlSec_Init_PyXmlSec_PyClear_PyXmlSec_PyInit_PyXmlSec_PyShutdown_PyXmlSec_PyEnableDebugOutput_PyXmlSec_PyIOCleanupCallbacks_PyXmlSec_PyIORegisterDefaultCallbacks_PyXmlSec_PyIORegisterCallbacks_PyXmlSec_PyBase64DefaultLineSize_PyXmlSec_Free_PyXmlSec_MatchCB_PyXmlSec_OpenCB_PyXmlSec_ReadCB_PyXmlSec_CloseCB_RCBListClear_PyXmlSecModule_PyXmlSec_MainMethods_PyXmlSec_PyInit__doc___PyXmlSec_PyShutdown__doc___PyXmlSec_PyEnableDebugOutput__doc___PyXmlSec_PyIOCleanupCallbacks__doc___PyXmlSec_PyIORegisterDefaultCallbacks__doc___PyXmlSec_PyIORegisterCallbacks__doc___PyXmlSec_PyBase64DefaultLineSize__doc___PyXmlSec_PyEnableDebugOutput.kwlist_PyXmlSec_PyIORegisterCallbacks.kwlist_PyXmlSec_PyBase64DefaultLineSize.kwlist_free_mode_registered_callbacks_cur_cb_list_itemtemplate.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/template.o_PyXmlSec_TemplateModule_Init_PyXmlSec_TemplateCreate_PyXmlSec_TemplateAddReference_PyXmlSec_TemplateAddTransform_PyXmlSec_TemplateEnsureKeyInfo_PyXmlSec_TemplateAddKeyName_PyXmlSec_TemplateAddKeyValue_PyXmlSec_TemplateAddX509Data_PyXmlSec_TemplateAddX509DataAddIssuerSerial_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber_PyXmlSec_TemplateAddX509DataAddSubjectName_PyXmlSec_TemplateAddX509DataAddSKI_PyXmlSec_TemplateAddX509DataAddCertificate_PyXmlSec_TemplateAddX509DataAddCRL_PyXmlSec_TemplateAddEncryptedKey_PyXmlSec_TemplateCreateEncryptedData_PyXmlSec_TemplateEncryptedDataEnsureKeyInfo_PyXmlSec_TemplateEncryptedDataEnsureCipherValue_PyXmlSec_TemplateTransformAddC14NInclNamespaces_PyXmlSec_TemplateModule_PyXmlSec_TemplateMethods_PyXmlSec_TemplateCreate__doc___PyXmlSec_TemplateAddReference__doc___PyXmlSec_TemplateAddTransform__doc___PyXmlSec_TemplateEnsureKeyInfo__doc___PyXmlSec_TemplateAddKeyName__doc___PyXmlSec_TemplateAddKeyValue__doc___PyXmlSec_TemplateAddX509Data__doc___PyXmlSec_TemplateAddX509DataAddIssuerSerial__doc___PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName__doc___PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber__doc___PyXmlSec_TemplateAddX509DataAddSubjectName__doc___PyXmlSec_TemplateAddX509DataAddSKI__doc___PyXmlSec_TemplateAddX509DataAddCertificate__doc___PyXmlSec_TemplateAddX509DataAddCRL__doc___PyXmlSec_TemplateAddEncryptedKey__doc___PyXmlSec_TemplateCreateEncryptedData__doc___PyXmlSec_TemplateEncryptedDataEnsureKeyInfo__doc___PyXmlSec_TemplateEncryptedDataEnsureCipherValue__doc___PyXmlSec_TemplateTransformAddC14NInclNamespaces__doc___PyXmlSec_TemplateCreate.kwlist_PyXmlSec_TemplateAddReference.kwlist_PyXmlSec_TemplateAddTransform.kwlist_PyXmlSec_TemplateEnsureKeyInfo.kwlist_PyXmlSec_TemplateAddKeyName.kwlist_PyXmlSec_TemplateAddKeyValue.kwlist_PyXmlSec_TemplateAddX509Data.kwlist_PyXmlSec_TemplateAddX509DataAddIssuerSerial.kwlist_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerName.kwlist_PyXmlSec_TemplateAddX509DataIssuerSerialAddIssuerSerialNumber.kwlist_PyXmlSec_TemplateAddX509DataAddSubjectName.kwlist_PyXmlSec_TemplateAddX509DataAddSKI.kwlist_PyXmlSec_TemplateAddX509DataAddCertificate.kwlist_PyXmlSec_TemplateAddX509DataAddCRL.kwlist_PyXmlSec_TemplateAddEncryptedKey.kwlist_PyXmlSec_TemplateCreateEncryptedData.kwlist_PyXmlSec_TemplateEncryptedDataEnsureKeyInfo.kwlist_PyXmlSec_TemplateEncryptedDataEnsureCipherValue.kwlist_PyXmlSec_TemplateTransformAddC14NInclNamespaces.kwlisttree.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/tree.o_PyXmlSec_TreeModule_Init_PyXmlSec_TreeFindChild_PyXmlSec_TreeFindParent_PyXmlSec_TreeFindNode_PyXmlSec_TreeAddIds_PyXmlSec_TreeModule_PyXmlSec_TreeMethods_PyXmlSec_TreeFindChild__doc___PyXmlSec_TreeFindParent__doc___PyXmlSec_TreeFindNode__doc___PyXmlSec_TreeAddIds__doc___PyXmlSec_TreeFindChild.kwlist_PyXmlSec_TreeFindParent.kwlist_PyXmlSec_TreeFindNode.kwlist_PyXmlSec_TreeAddIds.kwlistutils.c/var/folders/t0/56fhs_rn5z50sj6_4tf0f2hm0000gn/T/tmpe6eojwzq.build-temp/Users/amin/Workspace/repos/python-xmlsec/src/utils.o_PyXmlSec_GetFilePathOrContent_PyXmlSec_SetStringAttr_PyXmlSec_SetLongAttrúÞ ÀúÞ ôtX,´à  xmlsec.cpython-39-darwin.so¿·qÁÖ={AˆožÕf\—ÆM©¾ÀšPcbg¼••N÷Œ—Ž€"ºñ¿íªüc²"ŒBÂÄ̼q›Šõ¨¡-Ò' ýtye¬ž9x{?“ŸD!–D¸ŽG”€ˆÌ)ÌÿVõot3g½„=xWÖÈe}-»NŒ^ý8à$ýÉèï×7 ÷+“ÓmÄšÓZfžÈ¨¨ÑµëJ‹„ÔàHaXú”+¼ÊRuH‘]RÍà-@æz´ûÔ-Z;í-Í “ v½F¬ œ/m2ÇKB·â!î¸+SKz°ý“í,ò«É´éärFŠ¢[‚bh °’ð­õhjGwÇ#K“6ëq¡¡u0Ž; ‘_G¢­ßŸp$Ìì]÷ßî‚üAq\=’¸æ¤”Ü}¨/Ç­¬²XoÆéfÀ×ÑÑkOXÿ|´|z…Ú½‹H‰,§­¬²XoÆéfÀ×ÑÑkOXÿ|´|z…Ú½‹H‰,§­¬²XoÆéfÀ×ÑÑkOXÿ|´|z…Ú½‹H‰,§­¬²XoÆéfÀ×ÑÑkOXÿ|´|z…Ú½‹H‰,§Y”ƒ¯Ô»2¸&WJ½>;„ºwˆ.ÁàŠ–š4z­…™Ô7Á¬!”‚ù=»¸âŒ*:J†W)ñi[¸}‘óÒx¯kõ þ?Ið;7­l¼Y*Òg%+›ë(M½t¢Î™Äõà°ý}ceœ”dÊšÕ§H(çeëhyb€Ïtö…‡`Ù0 “‘$ï zçÁã~ÇÞ&¤9ä°Ô$@ãÒ"߀=ùH©æ"–!/åŒ!R5'I ¯ø .@ÁÿŒzi}ñàò᥃ÞäŠy‡»ž–ÂÏX_2”Ô˜—ß½žøÇR0 VöèÖA !ÝS WO÷s­•’’p³µo-…Y[µ[XI7Þ^×­í\nb”ƒ}~ÑŠÒÚMÍ:È|Ũ]-²/Å«¾MÎëþ¾ÆbÄW b—4ßûØ×Ö”õ!Ž!7ªôë?#YŒÄ0+½ Úh>Šðç«ÜLÚÁMB!ƒ)‰èÕ´±1¹}ç¾ë|êÀŽ«Í¿Za•8-gŽKÞ¯à q2Èn²EƒšW“‰¹ç+¹¶¼™IÂ¥ÿÓý5·ŒD¼ŽÁø^B‹žÍ+‘G‚ ý¥úìv©U>];ôàö ¬¡\.ƒëÛ/TbäÌi0$K"{)é?Ã/³òA§õ"çÊ^µ…S_'õñàZ~°&À»Ýi~³¡=Ër²™÷1oâî|â»Z|¨$¿izÆA¿ÎL\„Øš¼M.ï˜ÇÈäü1² >Ûáâ$»-™°óËwhBÏêè././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3405762 xmlsec-1.3.17/src/xmlsec.egg-info/0000755000076500000240000000000015104652320015517 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762874576.0 xmlsec-1.3.17/src/xmlsec.egg-info/PKG-INFO0000644000076500000240000001516615104652320016625 0ustar00aminstaffMetadata-Version: 2.4 Name: xmlsec Version: 1.3.17 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin Author-email: support@mehcode.com Maintainer: Oleg Hoefling Maintainer-email: oleg.hoefling@gmail.com License: MIT Project-URL: Documentation, https://xmlsec.readthedocs.io Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: C Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Typing :: Typed Requires-Python: >=3.9 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: lxml>=3.8 Dynamic: author Dynamic: author-email Dynamic: classifier Dynamic: description Dynamic: description-content-type Dynamic: home-page Dynamic: keywords Dynamic: license Dynamic: license-file Dynamic: maintainer Dynamic: maintainer-email Dynamic: project-url Dynamic: requires-dist Dynamic: requires-python Dynamic: summary # python-xmlsec [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg)](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml) [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml) [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec) [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest) Python bindings for the [XML Security Library](https://www.aleksey.com/xmlsec/). ## Documentation Documentation for `xmlsec` can be found at [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/). ## Usage Check the [examples](https://xmlsec.readthedocs.io/en/latest/examples.html) section in the documentation to see various examples of signing and verifying using the library. ## Requirements - `libxml2 >= 2.9.1` - `libxmlsec1 >= 1.2.33` ## Install `xmlsec` is available on PyPI: ``` bash pip install xmlsec ``` Depending on your OS, you may need to install the required native libraries first: ### Linux (Debian) ``` bash apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl ``` Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually. ``` bash wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz tar -xvf libxml2-2.9.1.tar.gz cd libxml2-2.9.1 ./configure && make && make install ``` ### Linux (CentOS) ``` bash yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Linux (Fedora) ``` bash dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel ``` ### Mac ``` bash brew install libxml2 libxmlsec1 pkg-config ``` or ``` bash port install libxml2 xmlsec pkgconfig ``` ### Alpine ``` bash apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec ``` ## Troubleshooting ### Mac If you get any fatal errors about missing `.h` files, update your `C_INCLUDE_PATH` environment variable to include the appropriate files from the `libxml2` and `libxmlsec1` libraries. ### Windows Starting with 1.3.7, prebuilt wheels are available for Windows, so running `pip install xmlsec` should suffice. If you want to build from source: 1. Configure build environment, see [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for more details. 2. Install from source dist: ``` bash pip install xmlsec --no-binary=xmlsec ``` ## Building from source 1. Clone the `xmlsec` source code repository to your local computer. ``` bash git clone https://github.com/xmlsec/python-xmlsec.git ``` 2. Change into the `python-xmlsec` root directory. ``` bash cd /path/to/xmlsec ``` 3. Install the project and all its dependencies using `pip`. ``` bash pip install . ``` ## Contributing ### Setting up your environment 1. Follow steps 1 and 2 of the [manual installation instructions](#building-from-source). 2. Initialize a virtual environment to develop in. This is done so as to ensure every contributor is working with close-to-identical versions of packages. ``` bash mkvirtualenv xmlsec ``` The `mkvirtualenv` command is available from `virtualenvwrapper` package which can be installed by following [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation). 3. Activate the created virtual environment: ``` bash workon xmlsec ``` 4. Install `xmlsec` in development mode with testing enabled. This will download all dependencies required for running the unit tests. ``` bash pip install -r requirements-test.txt pip install -e "." ``` ### Running the test suite 1. [Set up your environment](#setting-up-your-environment). 2. Run the unit tests. ``` bash pytest tests ``` 3. Tests configuration Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test iterations to detect memory leaks. ### Reporting an issue Please attach the output of following information: - version of `xmlsec` - version of `libxmlsec1` - version of `libxml2` - output from the command ``` bash pkg-config --cflags xmlsec1 ``` ## License Unless otherwise noted, all files contained within this project are licensed under the MIT open source license. See the included `LICENSE` file or visit [opensource.org](http://opensource.org/licenses/MIT) for more information. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762874576.0 xmlsec-1.3.17/src/xmlsec.egg-info/SOURCES.txt0000644000076500000240000000543715104652320017414 0ustar00aminstaff.pre-commit-config.yaml .readthedocs.yaml LICENSE MANIFEST.in README.md pyproject.toml setup.cfg setup.py /Users/amin/Workspace/personal/python-xmlsec/src/constants.c /Users/amin/Workspace/personal/python-xmlsec/src/ds.c /Users/amin/Workspace/personal/python-xmlsec/src/enc.c /Users/amin/Workspace/personal/python-xmlsec/src/exception.c /Users/amin/Workspace/personal/python-xmlsec/src/keys.c /Users/amin/Workspace/personal/python-xmlsec/src/lxml.c /Users/amin/Workspace/personal/python-xmlsec/src/main.c /Users/amin/Workspace/personal/python-xmlsec/src/template.c /Users/amin/Workspace/personal/python-xmlsec/src/tree.c /Users/amin/Workspace/personal/python-xmlsec/src/utils.c build_support/__init__.py build_support/build_ext.py build_support/network.py build_support/releases.py build_support/static_build.py src/common.h src/constants.c src/constants.h src/debug.h src/ds.c src/enc.c src/exception.c src/exception.h src/keys.c src/keys.h src/lxml.c src/lxml.h src/main.c src/platform.h src/template.c src/tree.c src/utils.c src/utils.h src/xmlsec.cpython-39-darwin.so src/python_xmlsec1.egg-info/PKG-INFO src/python_xmlsec1.egg-info/SOURCES.txt src/python_xmlsec1.egg-info/dependency_links.txt src/python_xmlsec1.egg-info/not-zip-safe src/python_xmlsec1.egg-info/requires.txt src/python_xmlsec1.egg-info/top_level.txt src/pyxmlsec.egg-info/PKG-INFO src/pyxmlsec.egg-info/SOURCES.txt src/pyxmlsec.egg-info/dependency_links.txt src/pyxmlsec.egg-info/not-zip-safe src/pyxmlsec.egg-info/requires.txt src/pyxmlsec.egg-info/top_level.txt src/xmlsec/__init__.pyi src/xmlsec/constants.pyi src/xmlsec/py.typed src/xmlsec/template.pyi src/xmlsec/tree.pyi src/xmlsec.egg-info/PKG-INFO src/xmlsec.egg-info/SOURCES.txt src/xmlsec.egg-info/dependency_links.txt src/xmlsec.egg-info/not-zip-safe src/xmlsec.egg-info/requires.txt src/xmlsec.egg-info/top_level.txt tests/__init__.py tests/base.py tests/conftest.py tests/softhsm_setup.py tests/test_constants.py tests/test_doc_examples.py tests/test_ds.py tests/test_enc.py tests/test_keys.py tests/test_main.py tests/test_pkcs11.py tests/test_templates.py tests/test_tree.py tests/test_type_stubs.py tests/test_xmlsec.py tests/data/deskey.bin tests/data/doc.xml tests/data/dsacert.der tests/data/dsakey.der tests/data/enc1-in.xml tests/data/enc1-out.xml tests/data/enc2-in.xml tests/data/enc2-out.xml tests/data/enc3-in.xml tests/data/enc3-out.xml tests/data/enc_template.xml tests/data/rsacert.pem tests/data/rsakey.pem tests/data/rsapub.pem tests/data/sign1-in.xml tests/data/sign1-out.xml tests/data/sign2-in.xml tests/data/sign2-out.xml tests/data/sign3-in.xml tests/data/sign3-out.xml tests/data/sign4-in.xml tests/data/sign4-out.xml tests/data/sign5-in.xml tests/data/sign5-out-xmlsec_1_2_36_to_37.xml tests/data/sign5-out.xml tests/data/sign6-in.bin tests/data/sign6-out.bin tests/data/sign_template.xml././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762874576.0 xmlsec-1.3.17/src/xmlsec.egg-info/dependency_links.txt0000644000076500000240000000000115104652320021565 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1712817733.0 xmlsec-1.3.17/src/xmlsec.egg-info/not-zip-safe0000644000076500000240000000000114605703105017750 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762874576.0 xmlsec-1.3.17/src/xmlsec.egg-info/requires.txt0000644000076500000240000000001215104652320020110 0ustar00aminstafflxml>=3.8 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1762874576.0 xmlsec-1.3.17/src/xmlsec.egg-info/top_level.txt0000644000076500000240000000000715104652320020246 0ustar00aminstaffxmlsec ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3341951 xmlsec-1.3.17/tests/0000755000076500000240000000000015104652320013105 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/__init__.py0000644000076500000240000000000014441560770015216 0ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/base.py0000644000076500000240000000743015035212077014401 0ustar00aminstaffimport gc import os import sys import unittest from lxml import etree import xmlsec etype = type(etree.Element('test')) ns = {'dsig': xmlsec.constants.DSigNs, 'enc': xmlsec.constants.EncNs} try: import resource test_iterations = int(os.environ.get('PYXMLSEC_TEST_ITERATIONS', '10')) except (ImportError, ValueError): test_iterations = 0 class TestMemoryLeaks(unittest.TestCase): maxDiff = None iterations = test_iterations data_dir = os.path.join(os.path.dirname(__file__), 'data') def setUp(self): gc.disable() self.addTypeEqualityFunc(etype, 'assertXmlEqual') xmlsec.enable_debug_trace(1) def run(self, result=None): # run first time super().run(result=result) if self.iterations == 0: return m_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss o_count = gc.get_count()[0] m_hits = 0 o_hits = 0 for _ in range(self.iterations): super().run(result=result) m_usage_n = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss if m_usage_n > m_usage: m_usage = m_usage_n m_hits += 1 o_count_n = gc.get_count()[0] if o_count_n > o_count: o_count = o_count_n o_hits += 1 del m_usage_n del o_count_n if m_hits > int(self.iterations * 0.8): result.buffer = False try: raise AssertionError('memory leak detected') except AssertionError: result.addError(self, sys.exc_info()) if o_hits > int(self.iterations * 0.8): result.buffer = False try: raise AssertionError('unreferenced objects detected') except AssertionError: result.addError(self, sys.exc_info()) def path(self, name): """Return full path for resource.""" return os.path.join(self.data_dir, name) def load(self, name): """Load resource by name.""" with open(self.path(name), 'rb') as stream: return stream.read() def load_xml(self, name, xpath=None): """Return xml.etree.""" with open(self.path(name)) as f: root = etree.parse(f).getroot() if xpath is None: return root return root.find(xpath) def dump(self, root): print(etree.tostring(root)) def assertXmlEqual(self, first, second, msg=None): """Check equality of etree.roots.""" msg = msg or '' if first.tag != second.tag: self.fail(f'Tags do not match: {first.tag} and {second.tag}. {msg}') for name, value in first.attrib.items(): if second.attrib.get(name) != value: self.fail(f'Attributes do not match: {name}={value!r}, {name}={second.attrib.get(name)!r}. {msg}') for name in second.attrib: if name not in first.attrib: self.fail(f'x2 has an attribute x1 is missing: {name}. {msg}') if not _xml_text_compare(first.text, second.text): self.fail(f'text: {first.text!r} != {second.text!r}. {msg}') if not _xml_text_compare(first.tail, second.tail): self.fail(f'tail: {first.tail!r} != {second.tail!r}. {msg}') cl1 = sorted(first.getchildren(), key=lambda x: x.tag) cl2 = sorted(second.getchildren(), key=lambda x: x.tag) if len(cl1) != len(cl2): self.fail(f'children length differs, {len(cl1)} != {len(cl2)}. {msg}') for c1, c2 in zip(cl1, cl2): self.assertXmlEqual(c1, c2) def _xml_text_compare(t1, t2): if not t1 and not t2: return True if t1 == '*' or t2 == '*': return True return (t1 or '').strip() == (t2 or '').strip() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/conftest.py0000644000076500000240000000056515035212077015316 0ustar00aminstaffdef pytest_collection_modifyitems(items): """Put the module init test first. This way, we implicitly check whether any subsequent test fails because of module reinitialization. """ def module_init_tests_first(item): return int('test_xmlsec.py::TestModule::test_reinitialize_module' not in item.nodeid) items.sort(key=module_init_tests_first) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1762874576.3403604 xmlsec-1.3.17/tests/data/0000755000076500000240000000000015104652320014016 5ustar00aminstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/deskey.bin0000644000076500000240000000003114441560770016000 0ustar00aminstaff012345670123456701234567 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/doc.xml0000644000076500000240000000024714441560770015322 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/dsacert.der0000644000076500000240000000210014441560770016142 0ustar00aminstaff0‚<0‚æ  ¯¢‹¹3­Ú®0  *†H†÷ 0œ1 0 UUS10U California1=0;U 4XML Security Library (http://www.aleksey.com/xmlsec)10U Aleksey Sanin1!0 *†H†÷  xmlsec@aleksey.com0  140523175426Z21140429175426Z0Ç1 0 UUS10U California1=0;U 4XML Security Library (http://www.aleksey.com/xmlsec)1)0'U  Test Third Level DSA Certificate10U Aleksey Sanin1!0 *†H†÷  xmlsec@aleksey.com0ð0¨*†HÎ80œAÈ1ü:?¿Es !¯ «w‡¼&z÷=åHßbG@W%¿W¹-»Ö\áüæ Š!â¢TU%½–j93I”C«š¨É{_N=^2n3p6É@3Ã9›§Ûgæó ÔéA¡Üˆ?LWKv¾Í퉖…-¯ÿ~—”ݲ½ÍB‘‘Eþ­{×=œˆ&•dìãC@:'H0É“uZ!÷UùΊÔjW•Ïó’Ã[Ñg¥—eþª$—ךSï.ˆ~˶Å4A…ý”O$N™\QÐôoÃ`£‚E0‚A0 U0ÿ0, `†H†øB OpenSSL Generated Certificate0U¥XŸ)p-BGDÚ®g§º÷)e>0ãU#Û0Ø€þäìS$ð••ǵáDµ]9eZã~¡´¤±0®1 0 UUS10U California1=0;U 4XML Security Library (http://www.aleksey.com/xmlsec)10U Root CA10U Aleksey Sanin1!0 *†H†÷  xmlsec@aleksey.com‚ ¯¢‹¹3­Ú­0  *†H†÷ A~¥äï²4­¤ÙñE-ÅÒ—ÛšK™«Tãwn—³Éœ£8’}²cÆÒmˆ§½LZkøù¦Oÿ³­h`Ü ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/dsakey.der0000644000076500000240000000037214441560770016006 0ustar00aminstaff0÷AÈ1ü:?¿Es !¯ «w‡¼&z÷=åHßbG@W%¿W¹-»Ö\áüæ Š!â¢TU%½–j93I”C«š¨É{_N=^2n3p6É@3Ã9›§Ûgæó ÔéA¡Üˆ?LWKv¾Í퉖…-¯ÿ~—”ݲ½ÍB‘‘Eþ­{×=œˆ&•dìã@:'H0É“uZ!÷UùΊÔjW•Ïó’Ã[Ñg¥—eþª$—ךSï.ˆ~˶Å4A…ý”O$N™\QÐôoÃ`¤Ÿá~i_B}=U9W<¯././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc1-in.xml0000644000076500000240000000024714441560770016007 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc1-out.xml0000644000076500000240000000203114441560770016201 0ustar00aminstaff UrTgE0UxQa8xevs4SyRA0rsibEz/ZFDjCBD+t4pKSdajB/cefYObZzqq2l41Q6R/ tqYLht5hEBh26AHfjmQSJAL+eChXOt/EaOf63zzJedO90HGqIQyzOeOPURAl3Li8 ivPyLVyocJDeVNeh7W+7kYwpFQ6PLuQxWsFFQXVoRAWbXHpZkSzVheR+5RpYJRTb 1UYXKxu8jg4NqbjucVMDIxUOzsVCDRyk8R8sQrM7D/H/N0y7DAY8oX/WZ45xLwUy DY/U86tTpTn95NwHD10SLyrL6rpXdbEuoIQHhWLwV9uQxnJA/Pn1KZ+xXK/fePfP 26PBo/hUrN5pm5U8ycc4iw== 2pb5Mxd0f+AW56Cs3MfQ9HJkUVeliSi1hVCNCVHTKeMyC2VL6lPhQ9+L01aSeTSY ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc2-in.xml0000644000076500000240000000010114441560770015775 0ustar00aminstaff test ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc2-out.xml0000644000076500000240000000204414441560770016206 0ustar00aminstaff HJwrfL7kOIB0QaldMJdza1HitpLCjw+eoult1C6yExDXJ09zKaSQER+pUL9Vt5fm d4Oitsf0CUNkjG1xWJdFsftqUIuvYGnkUNhT0vtqoYbdhJkCcB9cCwvTrww2+VTF NIasTdechlSD1qQOR8uf6+S94Ae4PVSfWU+5YLTJFpMjR+OT7f6BSbYNv1By6Cko G39WTSKTRcVDzcMxRepAGb59r508yKIJhwabCf3Opu+Ams7ia7BH4oa4ro9YSWwm hAJ0CN4a6b5odcRbNvuHcwWSxpoysWKbOROQ0H4xC4nGZeL/AXlpSc8eNuNG+g6D CTBwsOXCAEJYXPkTrnB3qQ== 4m5BRKEswOe8JISY7NrPGLBYv7Ay5pBV+nG6it51gz0= ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc3-in.xml0000644000076500000240000000010314441560770016000 0ustar00aminstaff test ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc3-out.xml0000644000076500000240000000200414441560770016203 0ustar00aminstaff HJwrfL7kOIB0QaldMJdza1HitpLCjw+eoult1C6yExDXJ09zKaSQER+pUL9Vt5fm d4Oitsf0CUNkjG1xWJdFsftqUIuvYGnkUNhT0vtqoYbdhJkCcB9cCwvTrww2+VTF NIasTdechlSD1qQOR8uf6+S94Ae4PVSfWU+5YLTJFpMjR+OT7f6BSbYNv1By6Cko G39WTSKTRcVDzcMxRepAGb59r508yKIJhwabCf3Opu+Ams7ia7BH4oa4ro9YSWwm hAJ0CN4a6b5odcRbNvuHcwWSxpoysWKbOROQ0H4xC4nGZeL/AXlpSc8eNuNG+g6D CTBwsOXCAEJYXPkTrnB3qQ== 4m5BRKEswOe8JISY7NrPGLBYv7Ay5pBV+nG6it51gz0= ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/enc_template.xml0000644000076500000240000000056214441560770017215 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/rsacert.pem0000644000076500000240000001125714441560770016204 0ustar00aminstaffCertificate: Data: Version: 3 (0x2) Serial Number: 5 (0x5) Signature Algorithm: md5WithRSAEncryption Issuer: C=US, ST=California, L=Sunnyvale, O=XML Security Library (http://www.aleksey.com/xmlsec), OU=Root Certificate, CN=Aleksey Sanin/emailAddress=xmlsec@aleksey.com Validity Not Before: Mar 31 04:02:22 2003 GMT Not After : Mar 28 04:02:22 2013 GMT Subject: C=US, ST=California, O=XML Security Library (http://www.aleksey.com/xmlsec), OU=Examples RSA Certificate, CN=Aleksey Sanin/emailAddress=xmlsec@aleksey.com Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (2048 bit) Modulus (2048 bit): 00:97:b8:fe:b4:3f:83:35:78:16:89:04:ec:2b:61: 8c:bf:c4:5f:00:81:4a:45:e6:d9:cd:e9:e2:3c:97: 3b:45:ad:aa:e6:8d:0b:77:71:07:01:4f:7c:f9:7d: e2:19:aa:dd:91:59:f4:f1:cf:3d:ba:78:46:96:11: 9c:b6:5b:46:39:73:55:23:aa:f7:9e:00:5c:e5:e9: 49:ec:3b:9c:3f:84:99:3a:90:ad:df:7e:64:86:c6: 26:72:ce:31:08:79:7e:13:15:b8:e5:bf:d6:56:02: 8d:60:21:4c:27:18:64:fb:fb:55:70:f6:33:bd:2f: 55:70:d5:5e:7e:99:ae:a4:e0:aa:45:47:13:a8:30: d5:a0:8a:9d:cc:20:ec:e4:8e:51:c9:54:c5:7f:3e: 66:2d:74:bf:a3:7a:f8:f3:ec:94:57:39:b4:ac:00: 75:62:61:54:b4:d0:e0:52:86:f8:5e:77:ec:50:43: 9c:d2:ba:a7:8c:62:5a:bc:b2:fe:f3:cc:62:7e:23: 60:6b:c7:51:49:37:78:7e:25:15:30:ab:fa:b4:ae: 25:8f:22:fc:a3:48:7f:f2:0a:8a:6e:e0:fe:8d:f0: 01:ed:c6:33:cc:6b:a1:fd:a6:80:ef:06:8c:af:f6: 40:3a:8e:42:14:20:61:12:1f:e3:fc:05:b1:05:d5: 65:c3 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: 24:84:2C:F2:D4:59:20:62:8B:2E:5C:86:90:A3:AA:30:BA:27:1A:9C X509v3 Authority Key Identifier: keyid:B4:B9:EF:9A:E6:97:0E:68:65:1E:98:CE:FA:55:0D:89:06:DB:4C:7C DirName:/C=US/ST=California/L=Sunnyvale/O=XML Security Library (http://www.aleksey.com/xmlsec)/OU=Root Certificate/CN=Aleksey Sanin/emailAddress=xmlsec@aleksey.com serial:00 Signature Algorithm: md5WithRSAEncryption b5:3f:9b:32:31:4a:ff:2f:84:3b:a8:9b:11:5c:a6:5c:f0:76: 52:d9:6e:f4:90:ad:fa:0d:90:c1:98:d5:4a:12:dd:82:6b:37: e8:d9:2d:62:92:c9:61:37:98:86:8f:a4:49:6a:5e:25:d0:18: 69:30:0f:98:8f:43:58:89:31:b2:3b:05:e2:ef:c7:a6:71:5f: f7:fe:73:c5:a7:b2:cd:2e:73:53:71:7d:a8:4c:68:1a:32:1b: 5e:48:2f:8f:9b:7a:a3:b5:f3:67:e8:b1:a2:89:4e:b2:4d:1b: 79:9c:ff:f0:0d:19:4f:4e:b1:03:3d:99:f0:44:b7:8a:0b:34: 9d:83 -----BEGIN CERTIFICATE----- MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tMB4X DTAzMDMzMTA0MDIyMloXDTEzMDMyODA0MDIyMlowgb8xCzAJBgNVBAYTAlVTMRMw EQYDVQQIEwpDYWxpZm9ybmlhMT0wOwYDVQQKEzRYTUwgU2VjdXJpdHkgTGlicmFy eSAoaHR0cDovL3d3dy5hbGVrc2V5LmNvbS94bWxzZWMpMSEwHwYDVQQLExhFeGFt cGxlcyBSU0EgQ2VydGlmaWNhdGUxFjAUBgNVBAMTDUFsZWtzZXkgU2FuaW4xITAf BgkqhkiG9w0BCQEWEnhtbHNlY0BhbGVrc2V5LmNvbTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAJe4/rQ/gzV4FokE7CthjL/EXwCBSkXm2c3p4jyXO0Wt quaNC3dxBwFPfPl94hmq3ZFZ9PHPPbp4RpYRnLZbRjlzVSOq954AXOXpSew7nD+E mTqQrd9+ZIbGJnLOMQh5fhMVuOW/1lYCjWAhTCcYZPv7VXD2M70vVXDVXn6ZrqTg qkVHE6gw1aCKncwg7OSOUclUxX8+Zi10v6N6+PPslFc5tKwAdWJhVLTQ4FKG+F53 7FBDnNK6p4xiWryy/vPMYn4jYGvHUUk3eH4lFTCr+rSuJY8i/KNIf/IKim7g/o3w Ae3GM8xrof2mgO8GjK/2QDqOQhQgYRIf4/wFsQXVZcMCAwEAAaOCAVcwggFTMAkG A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp ZmljYXRlMB0GA1UdDgQWBBQkhCzy1FkgYosuXIaQo6owuicanDCB+AYDVR0jBIHw MIHtgBS0ue+a5pcOaGUemM76VQ2JBttMfKGB0aSBzjCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tggEA MA0GCSqGSIb3DQEBBAUAA4GBALU/mzIxSv8vhDuomxFcplzwdlLZbvSQrfoNkMGY 1UoS3YJrN+jZLWKSyWE3mIaPpElqXiXQGGkwD5iPQ1iJMbI7BeLvx6ZxX/f+c8Wn ss0uc1NxfahMaBoyG15IL4+beqO182fosaKJTrJNG3mc//ANGU9OsQM9mfBEt4oL NJ2D -----END CERTIFICATE----- ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/rsakey.pem0000644000076500000240000000321314441560770016030 0ustar00aminstaff-----BEGIN RSA PRIVATE KEY----- MIIEowIBAAKCAQEAl7j+tD+DNXgWiQTsK2GMv8RfAIFKRebZzeniPJc7Ra2q5o0L d3EHAU98+X3iGardkVn08c89unhGlhGctltGOXNVI6r3ngBc5elJ7DucP4SZOpCt 335khsYmcs4xCHl+ExW45b/WVgKNYCFMJxhk+/tVcPYzvS9VcNVefpmupOCqRUcT qDDVoIqdzCDs5I5RyVTFfz5mLXS/o3r48+yUVzm0rAB1YmFUtNDgUob4XnfsUEOc 0rqnjGJavLL+88xifiNga8dRSTd4fiUVMKv6tK4ljyL8o0h/8gqKbuD+jfAB7cYz zGuh/aaA7waMr/ZAOo5CFCBhEh/j/AWxBdVlwwIDAQABAoIBAQCAvt6DnZF9gdW9 l4vAlBqXb88d4phgELCp5tmviLUnP2NSGEWuqR7Eoeru2z9NgIxblvYfazh6Ty22 kmNk6rcAcTnB9oYAcVZjUj8EUuEXlTFhXPvuNpafNu3RZd59znqJP1mSu+LpQWku NZMlabHnkTLDlGf7FXtvL9/rlgV4qk3QcDVF793JFszWrtK3mnld3KHQ6cuo9iSm 0rQKtkDjeHsRell8qTQvfBsgG1q2bv8QWT45/eQrra9mMbGTr3DbnXvoeJmTj1VN XJV7tBNllxxPahlYMByJaf/Tuva5j6HWUEIfYky5ihr2z1P/fNQ2OSCM6SQHpkiG EXQDueXBAoGBAMfW7KcmToEQEcTiqfey6C1LOLoemcX0/ROUktPq/5JQJRRrT4t7 XevLX0ed8sLyR5T29XQtdnuV0DJfvcJD+6ZwfOcQ+f6ZzCaNXJP97JtEt5kSWY01 Ei+nphZ0RFvPb04V3qDU9dElU26GR36CRBYJyM2WQPx4v+/YyDSZH9kLAoGBAMJc ZBU8pRbIia/FFOHUlS3v5P18nVmXyOd0fvRq0ZelaQCebTZ4K9wjnCfw//yzkb2Z 0vZFNB+xVBKB0Pt6nVvnSNzxdQ8EAXVFwHtXa25FUyP2RERQgTvmajqmgWjZsDYp 6GHcK3ZhmdmscQHF/Q2Uo4scvBcheahm9IXiNskpAoGAXelEgTBhSAmTMCEMmti6 fz6QQ/bJcNu2apMxhOE0hT+gjT34vaWV9481EWTKho5w0TJVGumaem1mz6VqeXaV Nhw6tiOmN91ysNNRpEJ6BGWAmjCjYNaF21s/k+HDlhmfRuTEIHSzqDuQP6pewrbY 5Dpo4SQxGfRsznvjacRj0Q0CgYBN247oBvQnDUxCkhNMZ8kersOvW5T4x9neBge5 R3UQZ12Jtu0O7dK8C7PJODyDcTeHmTAuIQjBTVrdUw1xP+v7XcoNX9hBnJws6zUw 85MAiFrGxCcSqqEqaqHRPtQGOXXiLKV/ViA++tgTn4VhbXtyTkG5P1iFd45xjFSV sUm7CQKBgDn92tHxzePly1L1mK584TkVryx4cP9RFHpebnmNduGwwjnRuYipoj8y pPPAkVbbaA3f9OB2go48rN0Ft9nHdlqgh9BpIKCVtkIb1XN0K3Oa/8BW8W/GAiNG HJcsrOtIrGVRdlyJG6bDaN8T49DnhOcsqMbf+IkIvfh50VeE9L/e -----END RSA PRIVATE KEY----- ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/rsapub.pem0000644000076500000240000000070314441560770016027 0ustar00aminstaff-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl7j+tD+DNXgWiQTsK2GM v8RfAIFKRebZzeniPJc7Ra2q5o0Ld3EHAU98+X3iGardkVn08c89unhGlhGctltG OXNVI6r3ngBc5elJ7DucP4SZOpCt335khsYmcs4xCHl+ExW45b/WVgKNYCFMJxhk +/tVcPYzvS9VcNVefpmupOCqRUcTqDDVoIqdzCDs5I5RyVTFfz5mLXS/o3r48+yU Vzm0rAB1YmFUtNDgUob4XnfsUEOc0rqnjGJavLL+88xifiNga8dRSTd4fiUVMKv6 tK4ljyL8o0h/8gqKbuD+jfAB7cYzzGuh/aaA7waMr/ZAOo5CFCBhEh/j/AWxBdVl wwIDAQAB -----END PUBLIC KEY----- ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign1-in.xml0000644000076500000240000000150714441560770016202 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign1-out.xml0000644000076500000240000000231214441560770016376 0ustar00aminstaff Hello, World! 9H/rQr2Axe9hYTV2n/tCp+3UIQQ= Mx4psIy9/UY+u8QBJRDrwQWKRaCGz0WOVftyDzAe6WHAFSjMNr7qb2ojq9kdipT8 Oub5q2OQ7mzdSLiiejkrO1VeqM/90yEIGI4En6KEB6ArEzw+iq4N1wm6EptcyxXx M9StAOOa9ilWYqR9Tfx3SW1urUIuKYgUitxsONiUHBVaW6HeX51bsXoTF++4ZI+D jiPBjN4HHmr0cbJ6BXk91S27ffZIfp1Qj5nL9onFLUGbR6EFgu2luiRzQbPuM2tP XxyI7GZ8AfHnRJK28ARvBC9oi+O1ej20S79CIV7gdBxbLbFprozBHAwOEC57YgJc x+YEjSjcO7SBIR1FiUA7pw== rsakey.pem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign2-in.xml0000644000076500000240000000030514441560770016176 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign2-out.xml0000644000076500000240000000214714441560770016405 0ustar00aminstaff Hello, World! HjY8ilZAIEM2tBbPn5mYO1ieIX4= SIaj/6KY3C1SmDXU2++Gm31U1xTadFp04WhBgfsJFbxrL+q7GKSKN9kfQ+UpN9+i D5fWmuavXEHe4Gw6RMaMEkq2URQo7F68+d5J/ajq8/l4n+xE6/reGScVwT6L4dEP XXVJcAi2ZnQ3O7GTNvNGCPibL9mUcyCWBFZ92Uemtc/vJFCQ7ZyKMdMfACgxOwyN T/9971oog241/2doudhonc0I/3mgPYWkZdX6yvr62mEjnG+oUZkhWYJ4ewZJ4hM4 JjbFqZO+OEzDRSbw3DkmuBA/mtlx+3t13SESfEub5hqoMdVmtth/eTb64dsPdl9r 3k1ACVX9f8aHfQQdJOmLFQ== rsakey.pem ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign3-in.xml0000644000076500000240000000030514441560770016177 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign3-out.xml0000644000076500000240000000544214441560770016407 0ustar00aminstaff Hello, World! HjY8ilZAIEM2tBbPn5mYO1ieIX4= SIaj/6KY3C1SmDXU2++Gm31U1xTadFp04WhBgfsJFbxrL+q7GKSKN9kfQ+UpN9+i D5fWmuavXEHe4Gw6RMaMEkq2URQo7F68+d5J/ajq8/l4n+xE6/reGScVwT6L4dEP XXVJcAi2ZnQ3O7GTNvNGCPibL9mUcyCWBFZ92Uemtc/vJFCQ7ZyKMdMfACgxOwyN T/9971oog241/2doudhonc0I/3mgPYWkZdX6yvr62mEjnG+oUZkhWYJ4ewZJ4hM4 JjbFqZO+OEzDRSbw3DkmuBA/mtlx+3t13SESfEub5hqoMdVmtth/eTb64dsPdl9r 3k1ACVX9f8aHfQQdJOmLFQ== MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tMB4X DTAzMDMzMTA0MDIyMloXDTEzMDMyODA0MDIyMlowgb8xCzAJBgNVBAYTAlVTMRMw EQYDVQQIEwpDYWxpZm9ybmlhMT0wOwYDVQQKEzRYTUwgU2VjdXJpdHkgTGlicmFy eSAoaHR0cDovL3d3dy5hbGVrc2V5LmNvbS94bWxzZWMpMSEwHwYDVQQLExhFeGFt cGxlcyBSU0EgQ2VydGlmaWNhdGUxFjAUBgNVBAMTDUFsZWtzZXkgU2FuaW4xITAf BgkqhkiG9w0BCQEWEnhtbHNlY0BhbGVrc2V5LmNvbTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAJe4/rQ/gzV4FokE7CthjL/EXwCBSkXm2c3p4jyXO0Wt quaNC3dxBwFPfPl94hmq3ZFZ9PHPPbp4RpYRnLZbRjlzVSOq954AXOXpSew7nD+E mTqQrd9+ZIbGJnLOMQh5fhMVuOW/1lYCjWAhTCcYZPv7VXD2M70vVXDVXn6ZrqTg qkVHE6gw1aCKncwg7OSOUclUxX8+Zi10v6N6+PPslFc5tKwAdWJhVLTQ4FKG+F53 7FBDnNK6p4xiWryy/vPMYn4jYGvHUUk3eH4lFTCr+rSuJY8i/KNIf/IKim7g/o3w Ae3GM8xrof2mgO8GjK/2QDqOQhQgYRIf4/wFsQXVZcMCAwEAAaOCAVcwggFTMAkG A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp ZmljYXRlMB0GA1UdDgQWBBQkhCzy1FkgYosuXIaQo6owuicanDCB+AYDVR0jBIHw MIHtgBS0ue+a5pcOaGUemM76VQ2JBttMfKGB0aSBzjCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tggEA MA0GCSqGSIb3DQEBBAUAA4GBALU/mzIxSv8vhDuomxFcplzwdlLZbvSQrfoNkMGY 1UoS3YJrN+jZLWKSyWE3mIaPpElqXiXQGGkwD5iPQ1iJMbI7BeLvx6ZxX/f+c8Wn ss0uc1NxfahMaBoyG15IL4+beqO182fosaKJTrJNG3mc//ANGU9OsQM9mfBEt4oL NJ2D ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign4-in.xml0000644000076500000240000000035714441560770016207 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign4-out.xml0000644000076500000240000000561614441560770016413 0ustar00aminstaff Hello, World! ERS7F/ifxZoyTe0mhco+HeAEKGo= G+mZNFqh9w0wIkDSbuYwvVDu7CMP8PEsw7jfwiZBC8nyF3loAtYKKAkdi6Zy3dJs tU8qKfhzvabmCjdIrGkFTdtlCNCVKDMzwogFtxEX4Oh77X6jjx4b22XNJx4AbnUG JV/EcsD+po8s5qVEXw62lRRd8cMDafbzOA/rBH96CMNgZhzxyaF9VRLa/vbt1ht2 hE1KkdZCB4Y0Lv3QyeDL2jax3NFks9FUv8IqoWYQSvywdMLY2ZMiQ9UpPeVfMizi trd5zDUSD/s3hyIEs4gD5NJF3HZPD/Fe2Zw1PBPj9eLADdEzcdueyCdPJ2YioFIi 1sMW/qPDhR/DoOJwGpUxwQ== MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tMB4X DTAzMDMzMTA0MDIyMloXDTEzMDMyODA0MDIyMlowgb8xCzAJBgNVBAYTAlVTMRMw EQYDVQQIEwpDYWxpZm9ybmlhMT0wOwYDVQQKEzRYTUwgU2VjdXJpdHkgTGlicmFy eSAoaHR0cDovL3d3dy5hbGVrc2V5LmNvbS94bWxzZWMpMSEwHwYDVQQLExhFeGFt cGxlcyBSU0EgQ2VydGlmaWNhdGUxFjAUBgNVBAMTDUFsZWtzZXkgU2FuaW4xITAf BgkqhkiG9w0BCQEWEnhtbHNlY0BhbGVrc2V5LmNvbTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAJe4/rQ/gzV4FokE7CthjL/EXwCBSkXm2c3p4jyXO0Wt quaNC3dxBwFPfPl94hmq3ZFZ9PHPPbp4RpYRnLZbRjlzVSOq954AXOXpSew7nD+E mTqQrd9+ZIbGJnLOMQh5fhMVuOW/1lYCjWAhTCcYZPv7VXD2M70vVXDVXn6ZrqTg qkVHE6gw1aCKncwg7OSOUclUxX8+Zi10v6N6+PPslFc5tKwAdWJhVLTQ4FKG+F53 7FBDnNK6p4xiWryy/vPMYn4jYGvHUUk3eH4lFTCr+rSuJY8i/KNIf/IKim7g/o3w Ae3GM8xrof2mgO8GjK/2QDqOQhQgYRIf4/wFsQXVZcMCAwEAAaOCAVcwggFTMAkG A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp ZmljYXRlMB0GA1UdDgQWBBQkhCzy1FkgYosuXIaQo6owuicanDCB+AYDVR0jBIHw MIHtgBS0ue+a5pcOaGUemM76VQ2JBttMfKGB0aSBzjCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tggEA MA0GCSqGSIb3DQEBBAUAA4GBALU/mzIxSv8vhDuomxFcplzwdlLZbvSQrfoNkMGY 1UoS3YJrN+jZLWKSyWE3mIaPpElqXiXQGGkwD5iPQ1iJMbI7BeLvx6ZxX/f+c8Wn ss0uc1NxfahMaBoyG15IL4+beqO182fosaKJTrJNG3mc//ANGU9OsQM9mfBEt4oL NJ2D ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign5-in.xml0000644000076500000240000000030514441560770016201 0ustar00aminstaff Hello, World! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1710328830.0 xmlsec-1.3.17/tests/data/sign5-out-xmlsec_1_2_36_to_37.xml0000644000076500000240000000567614574305776021711 0ustar00aminstaff Hello, World! HjY8ilZAIEM2tBbPn5mYO1ieIX4= SIaj/6KY3C1SmDXU2++Gm31U1xTadFp04WhBgfsJFbxrL+q7GKSKN9kfQ+UpN9+i D5fWmuavXEHe4Gw6RMaMEkq2URQo7F68+d5J/ajq8/l4n+xE6/reGScVwT6L4dEP XXVJcAi2ZnQ3O7GTNvNGCPibL9mUcyCWBFZ92Uemtc/vJFCQ7ZyKMdMfACgxOwyN T/9971oog241/2doudhonc0I/3mgPYWkZdX6yvr62mEjnG+oUZkhWYJ4ewZJ4hM4 JjbFqZO+OEzDRSbw3DkmuBA/mtlx+3t13SESfEub5hqoMdVmtth/eTb64dsPdl9r 3k1ACVX9f8aHfQQdJOmLFQ== Test Issuer 1 MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tMB4X DTAzMDMzMTA0MDIyMloXDTEzMDMyODA0MDIyMlowgb8xCzAJBgNVBAYTAlVTMRMw EQYDVQQIEwpDYWxpZm9ybmlhMT0wOwYDVQQKEzRYTUwgU2VjdXJpdHkgTGlicmFy eSAoaHR0cDovL3d3dy5hbGVrc2V5LmNvbS94bWxzZWMpMSEwHwYDVQQLExhFeGFt cGxlcyBSU0EgQ2VydGlmaWNhdGUxFjAUBgNVBAMTDUFsZWtzZXkgU2FuaW4xITAf BgkqhkiG9w0BCQEWEnhtbHNlY0BhbGVrc2V5LmNvbTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAJe4/rQ/gzV4FokE7CthjL/EXwCBSkXm2c3p4jyXO0Wt quaNC3dxBwFPfPl94hmq3ZFZ9PHPPbp4RpYRnLZbRjlzVSOq954AXOXpSew7nD+E mTqQrd9+ZIbGJnLOMQh5fhMVuOW/1lYCjWAhTCcYZPv7VXD2M70vVXDVXn6ZrqTg qkVHE6gw1aCKncwg7OSOUclUxX8+Zi10v6N6+PPslFc5tKwAdWJhVLTQ4FKG+F53 7FBDnNK6p4xiWryy/vPMYn4jYGvHUUk3eH4lFTCr+rSuJY8i/KNIf/IKim7g/o3w Ae3GM8xrof2mgO8GjK/2QDqOQhQgYRIf4/wFsQXVZcMCAwEAAaOCAVcwggFTMAkG A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp ZmljYXRlMB0GA1UdDgQWBBQkhCzy1FkgYosuXIaQo6owuicanDCB+AYDVR0jBIHw MIHtgBS0ue+a5pcOaGUemM76VQ2JBttMfKGB0aSBzjCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tggEA MA0GCSqGSIb3DQEBBAUAA4GBALU/mzIxSv8vhDuomxFcplzwdlLZbvSQrfoNkMGY 1UoS3YJrN+jZLWKSyWE3mIaPpElqXiXQGGkwD5iPQ1iJMbI7BeLvx6ZxX/f+c8Wn ss0uc1NxfahMaBoyG15IL4+beqO182fosaKJTrJNG3mc//ANGU9OsQM9mfBEt4oL NJ2D ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686597553.0 xmlsec-1.3.17/tests/data/sign5-out.xml0000644000076500000240000000621214441667661016414 0ustar00aminstaff Hello, World! HjY8ilZAIEM2tBbPn5mYO1ieIX4= SIaj/6KY3C1SmDXU2++Gm31U1xTadFp04WhBgfsJFbxrL+q7GKSKN9kfQ+UpN9+i D5fWmuavXEHe4Gw6RMaMEkq2URQo7F68+d5J/ajq8/l4n+xE6/reGScVwT6L4dEP XXVJcAi2ZnQ3O7GTNvNGCPibL9mUcyCWBFZ92Uemtc/vJFCQ7ZyKMdMfACgxOwyN T/9971oog241/2doudhonc0I/3mgPYWkZdX6yvr62mEjnG+oUZkhWYJ4ewZJ4hM4 JjbFqZO+OEzDRSbw3DkmuBA/mtlx+3t13SESfEub5hqoMdVmtth/eTb64dsPdl9r 3k1ACVX9f8aHfQQdJOmLFQ== Test Issuer 1 MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tMB4X DTAzMDMzMTA0MDIyMloXDTEzMDMyODA0MDIyMlowgb8xCzAJBgNVBAYTAlVTMRMw EQYDVQQIEwpDYWxpZm9ybmlhMT0wOwYDVQQKEzRYTUwgU2VjdXJpdHkgTGlicmFy eSAoaHR0cDovL3d3dy5hbGVrc2V5LmNvbS94bWxzZWMpMSEwHwYDVQQLExhFeGFt cGxlcyBSU0EgQ2VydGlmaWNhdGUxFjAUBgNVBAMTDUFsZWtzZXkgU2FuaW4xITAf BgkqhkiG9w0BCQEWEnhtbHNlY0BhbGVrc2V5LmNvbTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAJe4/rQ/gzV4FokE7CthjL/EXwCBSkXm2c3p4jyXO0Wt quaNC3dxBwFPfPl94hmq3ZFZ9PHPPbp4RpYRnLZbRjlzVSOq954AXOXpSew7nD+E mTqQrd9+ZIbGJnLOMQh5fhMVuOW/1lYCjWAhTCcYZPv7VXD2M70vVXDVXn6ZrqTg qkVHE6gw1aCKncwg7OSOUclUxX8+Zi10v6N6+PPslFc5tKwAdWJhVLTQ4FKG+F53 7FBDnNK6p4xiWryy/vPMYn4jYGvHUUk3eH4lFTCr+rSuJY8i/KNIf/IKim7g/o3w Ae3GM8xrof2mgO8GjK/2QDqOQhQgYRIf4/wFsQXVZcMCAwEAAaOCAVcwggFTMAkG A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp ZmljYXRlMB0GA1UdDgQWBBQkhCzy1FkgYosuXIaQo6owuicanDCB+AYDVR0jBIHw MIHtgBS0ue+a5pcOaGUemM76VQ2JBttMfKGB0aSBzjCByzELMAkGA1UEBhMCVVMx EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v eG1sc2VjKTEZMBcGA1UECxMQUm9vdCBDZXJ0aWZpY2F0ZTEWMBQGA1UEAxMNQWxl a3NleSBTYW5pbjEhMB8GCSqGSIb3DQEJARYSeG1sc2VjQGFsZWtzZXkuY29tggEA MA0GCSqGSIb3DQEBBAUAA4GBALU/mzIxSv8vhDuomxFcplzwdlLZbvSQrfoNkMGY 1UoS3YJrN+jZLWKSyWE3mIaPpElqXiXQGGkwD5iPQ1iJMbI7BeLvx6ZxX/f+c8Wn ss0uc1NxfahMaBoyG15IL4+beqO182fosaKJTrJNG3mc//ANGU9OsQM9mfBEt4oL NJ2D emailAddress=xmlsec@aleksey.com,CN=Aleksey Sanin,OU=Examples RSA Certificate,O=XML Security Library (http://www.aleksey.com/xmlsec),ST=California,C=US JIQs8tRZIGKLLlyGkKOqMLonGpw= ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign6-in.bin0000644000076500000240000000005014441560770016147 0ustar00aminstaff¨f4dP‚Óõ.ÁïĆ«Cì·>Ž££Å¹qc±-¤Bß>ºÑ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign6-out.bin0000644000076500000240000000040014441560770016347 0ustar00aminstaffh˱‚ú`e‰xåÅirÖÑQš êU_GÌ'¤c£>›27¿^`§pû˜ËÒ± 'â ì²<Ï@˜=à}O8}fyÂÄéì‡öÁÞý–*o«®É{Ì“yš€o’ë^h| ›<™_—Ëâ7éuÃú_Ìt/sTb  Ó“'´¤zËLDÛㄈ6éJ[çÎÀ±™{Æ:ÿtý«^2÷ž¤ÌTŽ~bÛšºMú½ì)z»‰×²Q¬¯ÜDÍ 6’úo¹Ù–$Î¦ÏøäBb60õÒa±oŒ‹lˆvhµhúú¶6íQÄïúðÉ.^˜PQSž¯Ayä•V ¥dÂ*¶×$À 2¡././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1686561272.0 xmlsec-1.3.17/tests/data/sign_template.xml0000644000076500000240000000342014441560770017404 0ustar00aminstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1758568219.0 xmlsec-1.3.17/tests/softhsm_setup.py0000644000076500000240000002240315064317433016373 0ustar00aminstaff"""Testing the PKCS#11 shim layer. Heavily inspired by from https://github.com/IdentityPython/pyXMLSecurity by leifj under license "As is", see https://github.com/IdentityPython/pyXMLSecurity/blob/master/LICENSE.txt """ import logging import os import shutil import subprocess import tempfile import traceback import unittest DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') def paths_for_component(component: str, default_paths): env_path = os.environ.get(component) return [env_path] if env_path else default_paths def find_alts(component_name, alts) -> str: for a in alts: if os.path.exists(a): return a raise unittest.SkipTest(f'Required component is missing: {component_name}') def run_cmd(args, softhsm_conf=None): env = {} if softhsm_conf is not None: env['SOFTHSM_CONF'] = softhsm_conf env['SOFTHSM2_CONF'] = softhsm_conf proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) out, err = proc.communicate() if err is not None and len(err) > 0: logging.error(err) if out is not None and len(out) > 0: logging.debug(out) rv = proc.wait() if rv: with open(softhsm_conf) as f: conf = f.read() msg = '[cmd: {cmd}] [code: {code}] [stdout: {out}] [stderr: {err}] [config: {conf}]' msg = msg.format( cmd=' '.join(args), code=rv, out=out.strip(), err=err.strip(), conf=conf, ) raise RuntimeError(msg) return out, err component_default_paths = { 'P11_MODULE': [ '/usr/lib/softhsm/libsofthsm2.so', '/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so', '/usr/lib/softhsm/libsofthsm.so', '/usr/lib64/softhsm/libsofthsm2.so', ], 'P11_ENGINE': [ '/usr/lib/ssl/engines/libpkcs11.so', '/usr/lib/engines/engine_pkcs11.so', '/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so', '/usr/lib64/engines-1.1/pkcs11.so', '/usr/lib64/engines-1.1/libpkcs11.so', '/usr/lib64/engines-3/pkcs11.so', '/usr/lib64/engines-3/libpkcs11.so', '/usr/lib/x86_64-linux-gnu/engines-3/pkcs11.so', '/usr/lib/x86_64-linux-gnu/engines-3/libpkcs11.so', ], 'PKCS11_TOOL': [ '/usr/bin/pkcs11-tool', ], 'SOFTHSM': [ '/usr/bin/softhsm2-util', '/usr/bin/softhsm', ], 'OPENSSL': [ '/usr/bin/openssl', ], } component_path = { component_name: find_alts(component_name, paths_for_component(component_name, default_paths)) for component_name, default_paths in component_default_paths.items() } softhsm_version = 1 if component_path['SOFTHSM'].endswith('softhsm2-util'): softhsm_version = 2 openssl_version = subprocess.check_output([component_path['OPENSSL'], 'version'])[8:11].decode() p11_test_files = [] softhsm_conf = None softhsm_db = None def _temp_file() -> str: f = tempfile.NamedTemporaryFile(delete=False) # noqa: SIM115 p11_test_files.append(f.name) return f.name def _temp_dir() -> str: d = tempfile.mkdtemp() p11_test_files.append(d) return d @unittest.skipIf(component_path['P11_MODULE'] is None, 'SoftHSM PKCS11 module not installed') def setup() -> None: logging.debug('Creating test pkcs11 token using softhsm') try: global softhsm_conf softhsm_conf = _temp_file() logging.debug('Generating softhsm.conf') with open(softhsm_conf, 'w') as f: if softhsm_version == 2: softhsm_db = _temp_dir() f.write( f""" # Generated by test directories.tokendir = {softhsm_db} objectstore.backend = file log.level = DEBUG """ ) else: softhsm_db = _temp_file() f.write( f""" # Generated by test 0:{softhsm_db} """ ) logging.debug('Initializing the token') _, _ = run_cmd( [ component_path['SOFTHSM'], '--slot', '0', '--label', 'test', '--init-token', '--pin', 'secret1', '--so-pin', 'secret2', ], softhsm_conf=softhsm_conf, ) hash_priv_key = _temp_file() logging.debug('Converting test private key to format for softhsm') run_cmd( [ component_path['OPENSSL'], 'pkcs8', '-topk8', '-inform', 'PEM', '-outform', 'PEM', '-nocrypt', '-in', os.path.join(DATA_DIR, 'rsakey.pem'), '-out', hash_priv_key, ], softhsm_conf=softhsm_conf, ) logging.debug('Importing the test key to softhsm') run_cmd( [ component_path['SOFTHSM'], '--import', hash_priv_key, '--token', 'test', '--id', 'a1b2', '--label', 'test', '--pin', 'secret1', ], softhsm_conf=softhsm_conf, ) run_cmd( [ component_path['PKCS11_TOOL'], '--module', component_path['P11_MODULE'], '-l', '--pin', 'secret1', '-O', ], softhsm_conf=softhsm_conf, ) signer_cert_pem = _temp_file() openssl_conf = _temp_file() logging.debug('Generating OpenSSL config for version %s', openssl_version) with open(openssl_conf, 'w') as f: f.write( '\n'.join( [ 'openssl_conf = openssl_def', '[openssl_def]', 'engines = engine_section', '[engine_section]', 'pkcs11 = pkcs11_section', '[req]', 'distinguished_name = req_distinguished_name', '[req_distinguished_name]', '[pkcs11_section]', 'engine_id = pkcs11', # dynamic_path, 'MODULE_PATH = {}'.format(component_path['P11_MODULE']), 'init = 0', ] ) ) with open(openssl_conf) as f: logging.debug('-------- START DEBUG openssl_conf --------') logging.debug(f.readlines()) logging.debug('-------- END DEBUG openssl_conf --------') logging.debug('-------- START DEBUG paths --------') logging.debug(run_cmd(['ls', '-ld', component_path['P11_ENGINE']])) logging.debug(run_cmd(['ls', '-ld', component_path['P11_MODULE']])) logging.debug('-------- END DEBUG paths --------') signer_cert_der = _temp_file() logging.debug('Generating self-signed certificate') run_cmd( [ component_path['OPENSSL'], 'req', '-new', '-x509', '-subj', '/CN=Test Signer', '-engine', 'pkcs11', '-config', openssl_conf, '-keyform', 'engine', '-key', 'label_test', '-passin', 'pass:secret1', '-out', signer_cert_pem, ], softhsm_conf=softhsm_conf, ) run_cmd( [ component_path['OPENSSL'], 'x509', '-inform', 'PEM', '-outform', 'DER', '-in', signer_cert_pem, '-out', signer_cert_der, ], softhsm_conf=softhsm_conf, ) logging.debug('Importing certificate into token') run_cmd( [ component_path['PKCS11_TOOL'], '--module', component_path['P11_MODULE'], '-l', '--slot-index', '0', '--id', 'a1b2', '--label', 'test', '-y', 'cert', '-w', signer_cert_der, '--pin', 'secret1', ], softhsm_conf=softhsm_conf, ) # TODO: Should be teardowned in teardown os.environ['SOFTHSM_CONF'] = softhsm_conf os.environ['SOFTHSM2_CONF'] = softhsm_conf except Exception as ex: print('-' * 64) traceback.print_exc() print('-' * 64) logging.exception('PKCS11 tests disabled: unable to initialize test token') raise ex def teardown() -> None: global p11_test_files for o in p11_test_files: if os.path.exists(o): if os.path.isdir(o): shutil.rmtree(o) else: os.unlink(o) p11_test_files = [] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_constants.py0000644000076500000240000000265715035212077016550 0ustar00aminstaff"""Test constants from :mod:`xmlsec.constants` module.""" import pytest import xmlsec def _constants(typename): return list( sorted( ( getattr(xmlsec.constants, name) for name in dir(xmlsec.constants) if type(getattr(xmlsec.constants, name)).__name__ == typename ), key=lambda t: t.name.lower(), ) ) @pytest.mark.parametrize('transform', _constants('__Transform'), ids=repr) def test_transform_str(transform): """Test string representation of ``xmlsec.constants.__Transform``.""" assert str(transform) == f'{transform.name}, {transform.href}' @pytest.mark.parametrize('transform', _constants('__Transform'), ids=repr) def test_transform_repr(transform): """Test raw string representation of ``xmlsec.constants.__Transform``.""" assert repr(transform) == f'__Transform({transform.name!r}, {transform.href!r}, {transform.usage})' @pytest.mark.parametrize('keydata', _constants('__KeyData'), ids=repr) def test_keydata_str(keydata): """Test string representation of ``xmlsec.constants.__KeyData``.""" assert str(keydata) == f'{keydata.name}, {keydata.href}' @pytest.mark.parametrize('keydata', _constants('__KeyData'), ids=repr) def test_keydata_repr(keydata): """Test raw string representation of ``xmlsec.constants.__KeyData``.""" assert repr(keydata) == f'__KeyData({keydata.name!r}, {keydata.href!r})' ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_doc_examples.py0000644000076500000240000000156315035212077017172 0ustar00aminstaff"""Run tests over code examples in the documentation.""" import contextlib import os import runpy from pathlib import Path import pytest examples_dir = Path(__file__, '../../doc/source/examples').resolve() examples = sorted(examples_dir.glob('*.py')) @contextlib.contextmanager def cd(where_to): """Temporarily change the working directory. Restore the current working dir after exiting the context. """ curr = Path.cwd() try: os.chdir(str(where_to)) yield finally: os.chdir(str(curr)) @pytest.mark.parametrize('example', examples, ids=lambda p: p.name) def test_doc_example(example): """Verify example scripts included in the docs are up to date. Execute each script in :file:`docs/source/examples`, not raising any errors is good enough. """ with cd(example.parent): runpy.run_path(str(example)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_ds.py0000644000076500000240000003514015035212077015133 0ustar00aminstaffimport unittest import xmlsec from tests import base consts = xmlsec.constants class TestSignContext(base.TestMemoryLeaks): def test_init(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) del ctx def test_init_no_keys_manager(self): ctx = xmlsec.SignatureContext() del ctx def test_init_bad_args(self): with self.assertRaisesRegex(TypeError, 'KeysManager required'): xmlsec.SignatureContext(manager='foo') def test_no_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) self.assertIsNone(ctx.key) def test_del_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) del ctx.key self.assertIsNone(ctx.key) def test_set_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) def test_set_key_bad_type(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) with self.assertRaisesRegex(TypeError, r'instance of \*xmlsec.Key\* expected.'): ctx.key = '' def test_set_invalid_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) with self.assertRaisesRegex(TypeError, 'empty key.'): ctx.key = xmlsec.Key() def test_register_id(self): ctx = xmlsec.SignatureContext() root = self.load_xml('sign_template.xml') sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1, 'Id') ctx.register_id(sign, 'Id') def test_register_id_bad_args(self): ctx = xmlsec.SignatureContext() with self.assertRaises(TypeError): ctx.register_id('') def test_register_id_with_namespace_without_attribute(self): ctx = xmlsec.SignatureContext() root = self.load_xml('sign_template.xml') sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1, 'Id') with self.assertRaisesRegex(xmlsec.Error, 'missing attribute.'): ctx.register_id(sign, 'Id', id_ns='foo') def test_sign_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.sign('') def test_sign_fail(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaisesRegex(xmlsec.Error, 'failed to sign'): ctx.sign(self.load_xml('sign1-in.xml')) def test_sign_case1(self): """Should sign a pre-constructed template file using a key from a PEM file.""" root = self.load_xml('sign1-in.xml') sign = xmlsec.tree.find_node(root, consts.NodeSignature) self.assertIsNotNone(sign) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) self.assertEqual(self.load_xml('sign1-out.xml'), root) def test_sign_case2(self): """Should sign a dynamicaly constructed template file using a key from a PEM file.""" root = self.load_xml('sign2-in.xml') sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1) self.assertIsNotNone(sign) root.append(sign) ref = xmlsec.template.add_reference(sign, consts.TransformSha1) xmlsec.template.add_transform(ref, consts.TransformEnveloped) ki = xmlsec.template.ensure_key_info(sign) xmlsec.template.add_key_name(ki) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) self.assertEqual(self.load_xml('sign2-out.xml'), root) def test_sign_case3(self): """Should sign a file using a dynamicaly created template, key from PEM and an X509 cert.""" root = self.load_xml('sign3-in.xml') sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1) self.assertIsNotNone(sign) root.append(sign) ref = xmlsec.template.add_reference(sign, consts.TransformSha1) xmlsec.template.add_transform(ref, consts.TransformEnveloped) ki = xmlsec.template.ensure_key_info(sign) xmlsec.template.add_x509_data(ki) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.load_cert_from_file(self.path('rsacert.pem'), consts.KeyDataFormatPem) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) self.assertEqual(self.load_xml('sign3-out.xml'), root) def test_sign_case4(self): """Should sign a file using a dynamically created template, key from PEM and an X509 cert with custom ns.""" root = self.load_xml('sign4-in.xml') xmlsec.tree.add_ids(root, ['ID']) elem_id = root.get('ID', None) if elem_id: elem_id = '#' + elem_id sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1, ns='ds') self.assertIsNotNone(sign) root.append(sign) ref = xmlsec.template.add_reference(sign, consts.TransformSha1, uri=elem_id) xmlsec.template.add_transform(ref, consts.TransformEnveloped) xmlsec.template.add_transform(ref, consts.TransformExclC14N) ki = xmlsec.template.ensure_key_info(sign) xmlsec.template.add_x509_data(ki) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.load_cert_from_file(self.path('rsacert.pem'), consts.KeyDataFormatPem) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) self.assertEqual(self.load_xml('sign4-out.xml'), root) def test_sign_case5(self): """Should sign a file using a dynamicaly created template, key from PEM file and an X509 certificate.""" root = self.load_xml('sign5-in.xml') sign = xmlsec.template.create(root, consts.TransformExclC14N, consts.TransformRsaSha1) self.assertIsNotNone(sign) root.append(sign) ref = xmlsec.template.add_reference(sign, consts.TransformSha1) xmlsec.template.add_transform(ref, consts.TransformEnveloped) ki = xmlsec.template.ensure_key_info(sign) x509 = xmlsec.template.add_x509_data(ki) xmlsec.template.x509_data_add_subject_name(x509) xmlsec.template.x509_data_add_certificate(x509) xmlsec.template.x509_data_add_ski(x509) x509_issuer_serial = xmlsec.template.x509_data_add_issuer_serial(x509) xmlsec.template.x509_issuer_serial_add_issuer_name(x509_issuer_serial, 'Test Issuer') xmlsec.template.x509_issuer_serial_add_serial_number(x509_issuer_serial, '1') ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.load_cert_from_file(self.path('rsacert.pem'), consts.KeyDataFormatPem) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) if (1, 2, 36) <= xmlsec.get_libxmlsec_version() <= (1, 2, 37): expected_xml_file = 'sign5-out-xmlsec_1_2_36_to_37.xml' else: expected_xml_file = 'sign5-out.xml' self.assertEqual(self.load_xml(expected_xml_file), root) def test_sign_binary_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.sign_binary(bytes=1, transform='') def test_sign_binary_no_key(self): ctx = xmlsec.SignatureContext() with self.assertRaisesRegex(xmlsec.Error, 'Sign key is not specified.'): ctx.sign_binary(bytes=b'', transform=consts.TransformRsaSha1) @unittest.skipIf(not hasattr(consts, 'TransformXslt'), reason='XSLT transformations not enabled') def test_sign_binary_invalid_signature_method(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaisesRegex(xmlsec.Error, 'incompatible signature method'): ctx.sign_binary(bytes=b'', transform=consts.TransformXslt) def test_sign_binary(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) sign = ctx.sign_binary(self.load('sign6-in.bin'), consts.TransformRsaSha1) self.assertEqual(self.load('sign6-out.bin'), sign) def test_sign_binary_twice_not_possible(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) data = self.load('sign6-in.bin') ctx.sign_binary(data, consts.TransformRsaSha1) with self.assertRaisesRegex(xmlsec.Error, 'Signature context already used; it is designed for one use only.'): ctx.sign_binary(data, consts.TransformRsaSha1) def test_verify_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.verify('') def test_verify_fail(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaisesRegex(xmlsec.Error, 'failed to verify'): ctx.verify(self.load_xml('sign1-in.xml')) def test_verify_case_1(self): self.check_verify(1) def test_verify_case_2(self): self.check_verify(2) def test_verify_case_3(self): self.check_verify(3) def test_verify_case_4(self): self.check_verify(4) def test_verify_case_5(self): self.check_verify(5) def check_verify(self, i): root = self.load_xml(f'sign{i}-out.xml') xmlsec.tree.add_ids(root, ['ID']) sign = xmlsec.tree.find_node(root, consts.NodeSignature) self.assertIsNotNone(sign) self.assertEqual(consts.NodeSignature, sign.tag.partition('}')[2]) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsapub.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsapub.pem' self.assertEqual('rsapub.pem', ctx.key.name) ctx.verify(sign) def test_validate_binary_sign(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.verify_binary(self.load('sign6-in.bin'), consts.TransformRsaSha1, self.load('sign6-out.bin')) def test_validate_binary_sign_fail(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) with self.assertRaises(xmlsec.Error): ctx.verify_binary(self.load('sign6-in.bin'), consts.TransformRsaSha1, b'invalid') def test_enable_reference_transform(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) ctx.enable_reference_transform(consts.TransformRsaSha1) def test_enable_reference_transform_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.enable_reference_transform('') with self.assertRaises(TypeError): ctx.enable_reference_transform(0) with self.assertRaises(TypeError): ctx.enable_reference_transform(consts.KeyDataAes) def test_enable_signature_transform(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) ctx.enable_signature_transform(consts.TransformRsaSha1) def test_enable_signature_transform_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.enable_signature_transform('') with self.assertRaises(TypeError): ctx.enable_signature_transform(0) with self.assertRaises(TypeError): ctx.enable_signature_transform(consts.KeyDataAes) def test_set_enabled_key_data(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) ctx.set_enabled_key_data([consts.KeyDataAes]) def test_set_enabled_key_data_empty(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) ctx.set_enabled_key_data([]) def test_set_enabled_key_data_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaises(TypeError): ctx.set_enabled_key_data(0) def test_set_enabled_key_data_bad_list(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) with self.assertRaisesRegex(TypeError, 'expected list of KeyData constants.'): ctx.set_enabled_key_data('foo') ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1754306735.0 xmlsec-1.3.17/tests/test_enc.py0000644000076500000240000002462115044114257015275 0ustar00aminstaffimport tempfile from lxml import etree import xmlsec from tests import base consts = xmlsec.constants class TestEncryptionContext(base.TestMemoryLeaks): def test_init(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) del ctx def test_init_no_keys_manager(self): ctx = xmlsec.EncryptionContext() del ctx def test_init_bad_args(self): with self.assertRaisesRegex(TypeError, 'KeysManager required'): xmlsec.EncryptionContext(manager='foo') def test_no_key(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) self.assertIsNone(ctx.key) def test_get_key(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) self.assertIsNone(ctx.key) ctx.key = xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem) self.assertIsNotNone(ctx.key) def test_del_key(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem) del ctx.key self.assertIsNone(ctx.key) def test_set_key(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem) self.assertIsNotNone(ctx.key) def test_set_key_bad_type(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) with self.assertRaisesRegex(TypeError, r'instance of \*xmlsec.Key\* expected.'): ctx.key = '' def test_set_invalid_key(self): ctx = xmlsec.EncryptionContext(manager=xmlsec.KeysManager()) with self.assertRaisesRegex(TypeError, 'empty key.'): ctx.key = xmlsec.Key() def test_encrypt_xml(self): root = self.load_xml('enc1-in.xml') enc_data = xmlsec.template.encrypted_data_create(root, consts.TransformAes128Cbc, type=consts.TypeEncElement, ns='xenc') xmlsec.template.encrypted_data_ensure_cipher_value(enc_data) ki = xmlsec.template.encrypted_data_ensure_key_info(enc_data, ns='dsig') ek = xmlsec.template.add_encrypted_key(ki, consts.TransformRsaOaep) xmlsec.template.encrypted_data_ensure_cipher_value(ek) data = root.find('./Data') self.assertIsNotNone(data) manager = xmlsec.KeysManager() manager.add_key(xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem)) ctx = xmlsec.EncryptionContext(manager) ctx.key = xmlsec.Key.generate(consts.KeyDataAes, 128, consts.KeyDataTypeSession) encrypted = ctx.encrypt_xml(enc_data, data) self.assertIsNotNone(encrypted) enc_method = xmlsec.tree.find_child(enc_data, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method) self.assertEqual('http://www.w3.org/2001/04/xmlenc#aes128-cbc', enc_method.get('Algorithm')) ki = xmlsec.tree.find_child(enc_data, consts.NodeKeyInfo, consts.DSigNs) self.assertIsNotNone(ki) enc_method2 = xmlsec.tree.find_node(ki, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method2) self.assertEqual('http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', enc_method2.get('Algorithm')) cipher_value = xmlsec.tree.find_node(ki, consts.NodeCipherValue, consts.EncNs) self.assertIsNotNone(cipher_value) def test_encrypt_xml_bad_args(self): ctx = xmlsec.EncryptionContext() with self.assertRaises(TypeError): ctx.encrypt_xml('', 0) def test_encrypt_xml_bad_template(self): ctx = xmlsec.EncryptionContext() with self.assertRaisesRegex(xmlsec.Error, 'unsupported `Type`, it should be `element` or `content`'): ctx.encrypt_xml(etree.Element('root'), etree.Element('node')) def test_encrypt_xml_bad_template_bad_type_attribute(self): ctx = xmlsec.EncryptionContext() with self.assertRaisesRegex(xmlsec.Error, 'unsupported `Type`, it should be `element` or `content`'): root = etree.Element('root') root.attrib['Type'] = 'foo' ctx.encrypt_xml(root, etree.Element('node')) def test_encrypt_xml_fail(self): ctx = xmlsec.EncryptionContext() with self.assertRaisesRegex(xmlsec.Error, 'failed to encrypt xml'): root = etree.Element('root') root.attrib['Type'] = consts.TypeEncElement ctx.encrypt_xml(root, etree.Element('node')) def test_encrypt_binary(self): root = self.load_xml('enc2-in.xml') enc_data = xmlsec.template.encrypted_data_create( root, consts.TransformAes128Cbc, type=consts.TypeEncContent, ns='xenc', mime_type='binary/octet-stream' ) xmlsec.template.encrypted_data_ensure_cipher_value(enc_data) ki = xmlsec.template.encrypted_data_ensure_key_info(enc_data, ns='dsig') ek = xmlsec.template.add_encrypted_key(ki, consts.TransformRsaOaep) xmlsec.template.encrypted_data_ensure_cipher_value(ek) manager = xmlsec.KeysManager() manager.add_key(xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem)) ctx = xmlsec.EncryptionContext(manager) ctx.key = xmlsec.Key.generate(consts.KeyDataAes, 128, consts.KeyDataTypeSession) encrypted = ctx.encrypt_binary(enc_data, b'test') self.assertIsNotNone(encrypted) self.assertEqual(f'{{{consts.EncNs}}}{consts.NodeEncryptedData}', encrypted.tag) enc_method = xmlsec.tree.find_child(enc_data, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method) self.assertEqual('http://www.w3.org/2001/04/xmlenc#aes128-cbc', enc_method.get('Algorithm')) ki = xmlsec.tree.find_child(enc_data, consts.NodeKeyInfo, consts.DSigNs) self.assertIsNotNone(ki) enc_method2 = xmlsec.tree.find_node(ki, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method2) self.assertEqual('http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', enc_method2.get('Algorithm')) cipher_value = xmlsec.tree.find_node(ki, consts.NodeCipherValue, consts.EncNs) self.assertIsNotNone(cipher_value) def test_encrypt_binary_bad_args(self): ctx = xmlsec.EncryptionContext() with self.assertRaises(TypeError): ctx.encrypt_binary('', 0) def test_encrypt_binary_bad_template(self): ctx = xmlsec.EncryptionContext() with self.assertRaisesRegex(xmlsec.Error, 'failed to encrypt binary'): ctx.encrypt_binary(etree.Element('root'), b'data') def test_encrypt_uri(self): root = self.load_xml('enc2-in.xml') enc_data = xmlsec.template.encrypted_data_create( root, consts.TransformAes128Cbc, type=consts.TypeEncContent, ns='xenc', mime_type='binary/octet-stream' ) xmlsec.template.encrypted_data_ensure_cipher_value(enc_data) ki = xmlsec.template.encrypted_data_ensure_key_info(enc_data, ns='dsig') ek = xmlsec.template.add_encrypted_key(ki, consts.TransformRsaOaep) xmlsec.template.encrypted_data_ensure_cipher_value(ek) manager = xmlsec.KeysManager() manager.add_key(xmlsec.Key.from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatCertPem)) ctx = xmlsec.EncryptionContext(manager) ctx.key = xmlsec.Key.generate(consts.KeyDataAes, 128, consts.KeyDataTypeSession) with tempfile.NamedTemporaryFile(delete=False) as tmpfile: tmpfile.write(b'test') encrypted = ctx.encrypt_binary(enc_data, 'file://' + tmpfile.name) self.assertIsNotNone(encrypted) self.assertEqual(f'{{{consts.EncNs}}}{consts.NodeEncryptedData}', encrypted.tag) enc_method = xmlsec.tree.find_child(enc_data, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method) self.assertEqual('http://www.w3.org/2001/04/xmlenc#aes128-cbc', enc_method.get('Algorithm')) ki = xmlsec.tree.find_child(enc_data, consts.NodeKeyInfo, consts.DSigNs) self.assertIsNotNone(ki) enc_method2 = xmlsec.tree.find_node(ki, consts.NodeEncryptionMethod, consts.EncNs) self.assertIsNotNone(enc_method2) self.assertEqual('http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', enc_method2.get('Algorithm')) cipher_value = xmlsec.tree.find_node(ki, consts.NodeCipherValue, consts.EncNs) self.assertIsNotNone(cipher_value) def test_encrypt_uri_bad_args(self): ctx = xmlsec.EncryptionContext() with self.assertRaises(TypeError): ctx.encrypt_uri('', 0) def test_encrypt_uri_fail(self): ctx = xmlsec.EncryptionContext() with self.assertRaisesRegex(xmlsec.Error, 'failed to encrypt URI'): ctx.encrypt_uri(etree.Element('root'), '') def test_decrypt1(self): self.check_decrypt(1) def test_decrypt2(self): self.check_decrypt(2) def test_decrypt_key(self): root = self.load_xml('enc3-out.xml') enc_key = xmlsec.tree.find_child(root, consts.NodeEncryptedKey, consts.EncNs) self.assertIsNotNone(enc_key) manager = xmlsec.KeysManager() manager.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) ctx = xmlsec.EncryptionContext(manager) keydata = ctx.decrypt(enc_key) ctx.reset() root.remove(enc_key) ctx.key = xmlsec.Key.from_binary_data(consts.KeyDataAes, keydata) enc_data = xmlsec.tree.find_child(root, consts.NodeEncryptedData, consts.EncNs) self.assertIsNotNone(enc_data) decrypted = ctx.decrypt(enc_data) self.assertIsNotNone(decrypted) self.assertEqual(self.load_xml('enc3-in.xml'), decrypted) def check_decrypt(self, i): root = self.load_xml(f'enc{i}-out.xml') enc_data = xmlsec.tree.find_child(root, consts.NodeEncryptedData, consts.EncNs) self.assertIsNotNone(enc_data) manager = xmlsec.KeysManager() manager.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) ctx = xmlsec.EncryptionContext(manager) decrypted = ctx.decrypt(enc_data) self.assertIsNotNone(decrypted) self.assertEqual(self.load_xml(f'enc{i}-in.xml'), root) def test_decrypt_bad_args(self): ctx = xmlsec.EncryptionContext() with self.assertRaises(TypeError): ctx.decrypt('') ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_keys.py0000644000076500000240000002332415035212077015501 0ustar00aminstaffimport copy import tempfile import xmlsec from tests import base consts = xmlsec.constants class TestKeys(base.TestMemoryLeaks): def test_key_from_memory(self): key = xmlsec.Key.from_memory(self.load('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) def test_key_from_memory_with_bad_args(self): with self.assertRaises(TypeError): xmlsec.Key.from_memory(1, format='') def test_key_from_memory_invalid_data(self): with self.assertRaisesRegex(xmlsec.Error, '.*cannot load key.*'): xmlsec.Key.from_memory(b'foo', format=consts.KeyDataFormatPem) def test_key_from_file(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) def test_key_from_file_with_bad_args(self): with self.assertRaises(TypeError): xmlsec.Key.from_file(1, format='') def test_key_from_invalid_file(self): with self.assertRaisesRegex(xmlsec.Error, '.*cannot read key.*'), tempfile.NamedTemporaryFile() as tmpfile: tmpfile.write(b'foo') xmlsec.Key.from_file(tmpfile.name, format=consts.KeyDataFormatPem) def test_key_from_fileobj(self): with open(self.path('rsakey.pem'), 'rb') as fobj: key = xmlsec.Key.from_file(fobj, format=consts.KeyDataFormatPem) self.assertIsNotNone(key) def test_key_from_invalid_fileobj(self): with tempfile.NamedTemporaryFile(delete=False) as tmpfile: tmpfile.write(b'foo') with self.assertRaisesRegex(xmlsec.Error, '.*cannot read key.*'), open(tmpfile.name) as fp: xmlsec.Key.from_file(fp, format=consts.KeyDataFormatPem) def test_generate(self): key = xmlsec.Key.generate(klass=consts.KeyDataAes, size=256, type=consts.KeyDataTypeSession) self.assertIsNotNone(key) def test_generate_with_bad_args(self): with self.assertRaises(TypeError): xmlsec.Key.generate(klass='', size='', type='') def test_generate_invalid_size(self): with self.assertRaisesRegex(xmlsec.Error, '.*cannot generate key.*'): xmlsec.Key.generate(klass=consts.KeyDataAes, size=0, type=consts.KeyDataTypeSession) def test_from_binary_file(self): key = xmlsec.Key.from_binary_file(klass=consts.KeyDataDes, filename=self.path('deskey.bin')) self.assertIsNotNone(key) def test_from_binary_file_with_bad_args(self): with self.assertRaises(TypeError): xmlsec.Key.from_binary_file(klass='', filename=1) def test_from_invalid_binary_file(self): with self.assertRaisesRegex(xmlsec.Error, '.*cannot read key.*'), tempfile.NamedTemporaryFile() as tmpfile: tmpfile.write(b'foo') xmlsec.Key.from_binary_file(klass=consts.KeyDataDes, filename=tmpfile.name) def test_from_binary_data(self): key = xmlsec.Key.from_binary_data(klass=consts.KeyDataDes, data=self.load('deskey.bin')) self.assertIsNotNone(key) def test_from_binary_data_with_bad_args(self): with self.assertRaises(TypeError): xmlsec.Key.from_binary_data(klass='', data=1) def test_from_invalid_binary_data(self): with self.assertRaisesRegex(xmlsec.Error, '.*cannot read key.*'): xmlsec.Key.from_binary_data(klass=consts.KeyDataDes, data=b'') def test_load_cert_from_file(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) key.load_cert_from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatPem) def test_load_cert_from_file_with_bad_args(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with self.assertRaises(TypeError): key.load_cert_from_file(1, format='') def test_load_cert_from_invalid_file(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with self.assertRaisesRegex(xmlsec.Error, '.*cannot load cert.*'), tempfile.NamedTemporaryFile() as tmpfile: tmpfile.write(b'foo') key.load_cert_from_file(tmpfile.name, format=consts.KeyDataFormatPem) def test_load_cert_from_fileobj(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with open(self.path('rsacert.pem'), 'rb') as fobj: key.load_cert_from_file(fobj, format=consts.KeyDataFormatPem) def test_load_cert_from_fileobj_with_bad_args(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with self.assertRaises(TypeError), open(self.path('rsacert.pem'), 'rb') as fobj: key.load_cert_from_file(fobj, format='') def test_load_cert_from_invalid_fileobj(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with tempfile.NamedTemporaryFile(delete=False) as tmpfile: tmpfile.write(b'foo') with self.assertRaisesRegex(xmlsec.Error, '.*cannot load cert.*'), open(tmpfile.name) as fp: key.load_cert_from_file(fp, format=consts.KeyDataFormatPem) def test_load_cert_from_memory(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) key.load_cert_from_memory(self.load('rsacert.pem'), format=consts.KeyDataFormatPem) def test_load_cert_from_memory_with_bad_args(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with self.assertRaises(TypeError): key.load_cert_from_memory(1, format='') def test_load_cert_from_memory_invalid_data(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNotNone(key) with self.assertRaisesRegex(xmlsec.Error, '.*cannot load cert.*'): key.load_cert_from_memory(b'', format=consts.KeyDataFormatPem) def test_get_name(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) self.assertIsNone(key.name) def test_get_name_invalid_key(self): key = xmlsec.Key() with self.assertRaisesRegex(ValueError, 'key is not ready'): key.name # noqa: B018 def test_del_name(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) key.name = 'rsakey' del key.name self.assertIsNone(key.name) def test_set_name(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) key.name = 'rsakey' self.assertEqual('rsakey', key.name) def test_set_name_invalid_key(self): key = xmlsec.Key() with self.assertRaisesRegex(ValueError, 'key is not ready'): key.name = 'foo' def test_copy(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) key2 = copy.copy(key) del key key2.load_cert_from_file(self.path('rsacert.pem'), format=consts.KeyDataFormatPem) class TestKeysManager(base.TestMemoryLeaks): def test_add_key(self): key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) mngr = xmlsec.KeysManager() mngr.add_key(key) def test_add_key_with_bad_args(self): mngr = xmlsec.KeysManager() with self.assertRaises(TypeError): mngr.add_key('') def test_load_cert(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) mngr.load_cert(self.path('rsacert.pem'), format=consts.KeyDataFormatPem, type=consts.KeyDataTypeTrusted) def test_load_cert_with_bad_args(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) with self.assertRaisesRegex(xmlsec.Error, '.*cannot load cert.*'), tempfile.NamedTemporaryFile() as tmpfile: tmpfile.write(b'foo') mngr.load_cert(tmpfile.name, format=consts.KeyDataFormatPem, type=consts.KeyDataTypeTrusted) def test_load_invalid_cert(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) with self.assertRaises(TypeError): mngr.load_cert(1, format='', type='') def test_load_cert_from_memory(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) mngr.load_cert_from_memory(self.load('rsacert.pem'), format=consts.KeyDataFormatPem, type=consts.KeyDataTypeTrusted) def test_load_cert_from_memory_with_bad_args(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) with self.assertRaises(TypeError): mngr.load_cert_from_memory(1, format='', type='') def test_load_cert_from_memory_invalid_data(self): mngr = xmlsec.KeysManager() mngr.add_key(xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem)) with self.assertRaisesRegex(xmlsec.Error, '.*cannot load cert.*'): mngr.load_cert_from_memory(b'', format=consts.KeyDataFormatPem, type=consts.KeyDataTypeTrusted) def test_load_invalid_key(self): mngr = xmlsec.KeysManager() with self.assertRaises(ValueError): mngr.add_key(xmlsec.Key()) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_main.py0000644000076500000240000001304115035212077015445 0ustar00aminstaffimport sys from io import BytesIO from unittest import skipIf import xmlsec from tests import base from xmlsec import constants as consts class TestBase64LineSize(base.TestMemoryLeaks): def tearDown(self): xmlsec.base64_default_line_size(64) super().tearDown() def test_get_base64_default_line_size(self): self.assertEqual(xmlsec.base64_default_line_size(), 64) def test_set_base64_default_line_size_positional_arg(self): xmlsec.base64_default_line_size(0) self.assertEqual(xmlsec.base64_default_line_size(), 0) def test_set_base64_default_line_size_keyword_arg(self): xmlsec.base64_default_line_size(size=0) self.assertEqual(xmlsec.base64_default_line_size(), 0) def test_set_base64_default_line_size_with_bad_args(self): size = xmlsec.base64_default_line_size() for bad_size in (None, '', object()): with self.assertRaises(TypeError): xmlsec.base64_default_line_size(bad_size) self.assertEqual(xmlsec.base64_default_line_size(), size) def test_set_base64_default_line_size_rejects_negative_values(self): size = xmlsec.base64_default_line_size() with self.assertRaises(ValueError): xmlsec.base64_default_line_size(-1) self.assertEqual(xmlsec.base64_default_line_size(), size) class TestCallbacks(base.TestMemoryLeaks): def setUp(self): super().setUp() xmlsec.cleanup_callbacks() def _sign_doc(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) xmlsec.template.add_reference(sign, consts.TransformSha1, uri='cid:123456') ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_file(self.path('rsakey.pem'), format=consts.KeyDataFormatPem) ctx.sign(sign) return sign def _expect_sign_failure(self): with self.assertRaisesRegex(xmlsec.Error, 'failed to sign'): self._sign_doc() def _mismatch_callbacks(self, match_cb=lambda filename: False): return [ match_cb, lambda filename: None, lambda none, buf: 0, lambda none: None, ] def _register_mismatch_callbacks(self, match_cb=lambda filename: False): xmlsec.register_callbacks(*self._mismatch_callbacks(match_cb)) def _register_match_callbacks(self): xmlsec.register_callbacks( lambda filename: filename == b'cid:123456', lambda filename: BytesIO(b''), lambda bio, buf: bio.readinto(buf), lambda bio: bio.close(), ) def _find(self, elem, *tags): try: return elem.xpath( './' + '/'.join(f'xmldsig:{tag}' for tag in tags), namespaces={ 'xmldsig': 'http://www.w3.org/2000/09/xmldsig#', }, )[0] except IndexError as e: raise KeyError(tags) from e def _verify_external_data_signature(self): signature = self._sign_doc() digest = self._find(signature, 'SignedInfo', 'Reference', 'DigestValue').text self.assertEqual(digest, 'VihZwVMGJ48NsNl7ertVHiURXk8=') def test_sign_external_data_no_callbacks_fails(self): self._expect_sign_failure() def test_sign_external_data_default_callbacks_fails(self): xmlsec.register_default_callbacks() self._expect_sign_failure() def test_sign_external_data_no_matching_callbacks_fails(self): self._register_mismatch_callbacks() self._expect_sign_failure() def test_sign_data_from_callbacks(self): self._register_match_callbacks() self._verify_external_data_signature() def test_sign_data_not_first_callback(self): bad_match_calls = 0 def match_cb(filename): nonlocal bad_match_calls bad_match_calls += 1 return False for _ in range(2): self._register_mismatch_callbacks(match_cb) self._register_match_callbacks() for _ in range(2): self._register_mismatch_callbacks() self._verify_external_data_signature() self.assertEqual(bad_match_calls, 0) @skipIf(sys.platform == 'win32', 'unclear behaviour on windows') def test_failed_sign_because_default_callbacks(self): mismatch_calls = 0 def mismatch_cb(filename): nonlocal mismatch_calls mismatch_calls += 1 return False # NB: These first two sets of callbacks should never get called, # because the default callbacks always match beforehand: self._register_match_callbacks() self._register_mismatch_callbacks(mismatch_cb) xmlsec.register_default_callbacks() self._register_mismatch_callbacks(mismatch_cb) self._register_mismatch_callbacks(mismatch_cb) self._expect_sign_failure() self.assertEqual(mismatch_calls, 2) def test_register_non_callables(self): for idx in range(4): cbs = self._mismatch_callbacks() cbs[idx] = None self.assertRaises(TypeError, xmlsec.register_callbacks, *cbs) def test_sign_external_data_fails_on_read_callback_wrong_returns(self): xmlsec.register_callbacks( lambda filename: filename == b'cid:123456', lambda filename: BytesIO(b''), lambda bio, buf: None, lambda bio: bio.close(), ) self._expect_sign_failure() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_pkcs11.py0000644000076500000240000000333115035212077015624 0ustar00aminstaffimport xmlsec from tests import base from xmlsec import constants as consts KEY_URL = 'pkcs11;pkcs11:token=test;object=test;pin-value=secret1' def setUpModule(): from tests import softhsm_setup softhsm_setup.setup() def tearDownModule(): from tests import softhsm_setup softhsm_setup.teardown() class TestKeys(base.TestMemoryLeaks): def test_del_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_engine(KEY_URL) del ctx.key self.assertIsNone(ctx.key) def test_set_key(self): ctx = xmlsec.SignatureContext(manager=xmlsec.KeysManager()) ctx.key = xmlsec.Key.from_engine(KEY_URL) self.assertIsNotNone(ctx.key) def test_sign_bad_args(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_engine(KEY_URL) with self.assertRaises(TypeError): ctx.sign('') def test_sign_fail(self): ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_engine(KEY_URL) with self.assertRaisesRegex(xmlsec.Error, 'failed to sign'): ctx.sign(self.load_xml('sign1-in.xml')) def test_sign_case1(self): """Should sign a pre-constructed template file using a key from a pkcs11 engine.""" root = self.load_xml('sign1-in.xml') sign = xmlsec.tree.find_node(root, consts.NodeSignature) self.assertIsNotNone(sign) ctx = xmlsec.SignatureContext() ctx.key = xmlsec.Key.from_engine(KEY_URL) self.assertIsNotNone(ctx.key) ctx.key.name = 'rsakey.pem' self.assertEqual('rsakey.pem', ctx.key.name) ctx.sign(sign) self.assertEqual(self.load_xml('sign1-out.xml'), root) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1754469800.0 xmlsec-1.3.17/tests/test_templates.py0000644000076500000240000002426315044612650016530 0ustar00aminstaffimport unittest from lxml import etree import xmlsec from tests import base consts = xmlsec.constants class TestTemplates(base.TestMemoryLeaks): def test_create(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create( root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1, id='Id', ns='test' ) self.assertEqual('Id', sign.get('Id')) self.assertEqual('test', sign.prefix) def test_create_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.create('', c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) def test_encrypt_data_create(self): root = self.load_xml('doc.xml') enc = xmlsec.template.encrypted_data_create( root, method=consts.TransformDes3Cbc, id='Id', type='Type', mime_type='MimeType', encoding='Encoding', ns='test' ) for a in ('Id', 'Type', 'MimeType', 'Encoding'): self.assertEqual(a, enc.get(a)) self.assertEqual('test', enc.prefix) def test_ensure_key_info(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign, id='Id') self.assertEqual('Id', ki.get('Id')) def test_ensure_key_info_fail(self): with self.assertRaisesRegex(xmlsec.Error, 'cannot ensure key info.'): xmlsec.template.ensure_key_info(etree.fromstring(b''), id='Id') def test_ensure_key_info_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.ensure_key_info('', id=0) def test_add_encrypted_key(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) ek = xmlsec.template.add_encrypted_key(ki, consts.TransformRsaOaep) self.assertEqual(ek, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeEncryptedKey, consts.EncNs)) ek2 = xmlsec.template.add_encrypted_key(ki, consts.TransformRsaOaep, id='Id', type='Type', recipient='Recipient') for a in ('Id', 'Type', 'Recipient'): self.assertEqual(a, ek2.get(a)) def test_add_key_name(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) kn = xmlsec.template.add_key_name(ki) self.assertEqual(kn, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeKeyName, consts.DSigNs)) kn2 = xmlsec.template.add_key_name(ki, name='name') self.assertEqual('name', kn2.text) def test_add_key_name_none(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) kn2 = xmlsec.template.add_key_name(ki, name=None) self.assertEqual(kn2.text, None) print(etree.tostring(kn2)) def test_add_key_name_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_key_name('') def test_add_reference(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ref = xmlsec.template.add_reference(sign, consts.TransformSha1, id='Id', uri='URI', type='Type') for a in ('Id', 'URI', 'Type'): self.assertEqual(a, ref.get(a)) def test_add_reference_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_reference('', consts.TransformSha1) with self.assertRaises(TypeError): xmlsec.template.add_reference(etree.Element('root'), '') def test_add_reference_fail(self): with self.assertRaisesRegex(xmlsec.Error, 'cannot add reference.'): xmlsec.template.add_reference(etree.Element('root'), consts.TransformSha1) def test_add_transform_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_transform('', consts.TransformSha1) with self.assertRaises(TypeError): xmlsec.template.add_transform(etree.Element('root'), '') def test_add_key_value(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) kv = xmlsec.template.add_key_value(ki) self.assertEqual(kv, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeKeyValue, consts.DSigNs)) def test_add_key_value_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_key_value('') def test_add_x509_data(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) x509 = xmlsec.template.add_x509_data(ki) xmlsec.template.x509_data_add_certificate(x509) xmlsec.template.x509_data_add_crl(x509) issuer = xmlsec.template.x509_data_add_issuer_serial(x509) xmlsec.template.x509_data_add_ski(x509) xmlsec.template.x509_data_add_subject_name(x509) xmlsec.template.x509_issuer_serial_add_issuer_name(issuer) xmlsec.template.x509_issuer_serial_add_serial_number(issuer) self.assertEqual(x509, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeX509Data, consts.DSigNs)) def test_add_x509_data_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_x509_data('') def test_x509_issuer_serial_add_issuer(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ki = xmlsec.template.ensure_key_info(sign) x509 = xmlsec.template.add_x509_data(ki) issuer = xmlsec.template.x509_data_add_issuer_serial(x509) name = xmlsec.template.x509_issuer_serial_add_issuer_name(issuer, name='Name') serial = xmlsec.template.x509_issuer_serial_add_serial_number(issuer, serial='Serial') self.assertEqual('Name', name.text) self.assertEqual('Serial', serial.text) def test_x509_issuer_serial_add_issuer_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_data_add_issuer_serial('') def test_x509_issuer_serial_add_issuer_name_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_issuer_serial_add_issuer_name('') def test_x509_issuer_serial_add_serial_number_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_issuer_serial_add_serial_number('') def test_x509_data_add_subject_name_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_data_add_subject_name('') def test_x509_data_add_ski_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_data_add_ski('') def test_x509_data_add_certificate_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_data_add_certificate('') def test_x509_data_add_crl_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.x509_data_add_crl('') def test_add_encrypted_key_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.add_encrypted_key('', 0) def test_encrypted_data_create_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.encrypted_data_create('', 0) def test_encrypted_data_ensure_cipher_value(self): root = self.load_xml('doc.xml') enc = xmlsec.template.encrypted_data_create(root, method=consts.TransformDes3Cbc) cv = xmlsec.template.encrypted_data_ensure_cipher_value(enc) self.assertEqual(cv, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeCipherValue, consts.EncNs)) def test_encrypted_data_ensure_cipher_value_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.encrypted_data_ensure_cipher_value('') def test_encrypted_data_ensure_key_info(self): root = self.load_xml('doc.xml') enc = xmlsec.template.encrypted_data_create(root, method=consts.TransformDes3Cbc) ki = xmlsec.template.encrypted_data_ensure_key_info(enc) self.assertEqual(ki, xmlsec.tree.find_node(self.load_xml('enc_template.xml'), consts.NodeKeyInfo, consts.DSigNs)) ki2 = xmlsec.template.encrypted_data_ensure_key_info(enc, id='Id', ns='test') self.assertEqual('Id', ki2.get('Id')) self.assertEqual('test', ki2.prefix) def test_encrypted_data_ensure_key_info_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.encrypted_data_ensure_key_info('') @unittest.skipIf(not hasattr(consts, 'TransformXslt'), reason='XSLT transformations not enabled') def test_transform_add_c14n_inclusive_namespaces(self): root = self.load_xml('doc.xml') sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1) ref = xmlsec.template.add_reference(sign, consts.TransformSha1) trans1 = xmlsec.template.add_transform(ref, consts.TransformEnveloped) xmlsec.template.transform_add_c14n_inclusive_namespaces(trans1, 'default') trans2 = xmlsec.template.add_transform(ref, consts.TransformXslt) xmlsec.template.transform_add_c14n_inclusive_namespaces(trans2, ['ns1', 'ns2']) self.assertEqual(ref, xmlsec.tree.find_node(self.load_xml('sign_template.xml'), consts.NodeReference, consts.DSigNs)) def test_transform_add_c14n_inclusive_namespaces_bad_args(self): with self.assertRaises(TypeError): xmlsec.template.transform_add_c14n_inclusive_namespaces('', []) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_tree.py0000644000076500000240000000340315035212077015461 0ustar00aminstaffimport xmlsec from tests import base consts = xmlsec.constants class TestTree(base.TestMemoryLeaks): def test_find_child(self): root = self.load_xml('sign_template.xml') si = xmlsec.tree.find_child(root, consts.NodeSignedInfo, consts.DSigNs) self.assertEqual(consts.NodeSignedInfo, si.tag.partition('}')[2]) self.assertIsNone(xmlsec.tree.find_child(root, consts.NodeReference)) self.assertIsNone(xmlsec.tree.find_child(root, consts.NodeSignedInfo, consts.EncNs)) def test_find_child_bad_args(self): with self.assertRaises(TypeError): xmlsec.tree.find_child('', 0, True) def test_find_parent(self): root = self.load_xml('sign_template.xml') si = xmlsec.tree.find_child(root, consts.NodeSignedInfo, consts.DSigNs) self.assertIs(root, xmlsec.tree.find_parent(si, consts.NodeSignature)) self.assertIsNone(xmlsec.tree.find_parent(root, consts.NodeSignedInfo)) def test_find_parent_bad_args(self): with self.assertRaises(TypeError): xmlsec.tree.find_parent('', 0, True) def test_find_node(self): root = self.load_xml('sign_template.xml') ref = xmlsec.tree.find_node(root, consts.NodeReference) self.assertEqual(consts.NodeReference, ref.tag.partition('}')[2]) self.assertIsNone(xmlsec.tree.find_node(root, consts.NodeReference, consts.EncNs)) def test_find_node_bad_args(self): with self.assertRaises(TypeError): xmlsec.tree.find_node('', 0, True) def test_add_ids(self): root = self.load_xml('sign_template.xml') xmlsec.tree.add_ids(root, ['id1', 'id2', 'id3']) def test_add_ids_bad_args(self): with self.assertRaises(TypeError): xmlsec.tree.add_ids('', []) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_type_stubs.py0000644000076500000240000000362515035212077016731 0ustar00aminstaff"""Test type stubs for correctness where possible.""" import os import pytest import xmlsec black = pytest.importorskip('black') constants_stub_header = """ import sys from typing import NamedTuple if sys.version_info >= (3, 8): from typing import Final else: from typing_extensions import Final class __KeyData(NamedTuple): # __KeyData type href: str name: str class __KeyDataNoHref(NamedTuple): # __KeyData type href: None name: str class __Transform(NamedTuple): # __Transform type href: str name: str usage: int class __TransformNoHref(NamedTuple): # __Transform type href: None name: str usage: int """ def gen_constants_stub(): """Generate contents of the file:`xmlsec/constants.pyi`. Simply load all constants at runtime, generate appropriate type hint for each constant type. """ def process_constant(name): """Generate line in stub file for constant name.""" obj = getattr(xmlsec.constants, name) type_name = type(obj).__name__ if type_name in ('__KeyData', '__Transform') and obj.href is None: type_name += 'NoHref' return f'{name}: Final[{type_name}]' names = list(sorted(name for name in dir(xmlsec.constants) if not name.startswith('__'))) lines = [process_constant(name) for name in names] return constants_stub_header + os.linesep.join(lines) def test_xmlsec_constants_stub(request): """Generate the stub file for :mod:`xmlsec.constants` from existing code. Compare it against the existing stub :file:`xmlsec/constants.pyi`. """ stub = request.config.rootpath / 'src' / 'xmlsec' / 'constants.pyi' mode = black.FileMode(target_versions={black.TargetVersion.PY39}, line_length=130, is_pyi=True, string_normalization=False) formatted = black.format_file_contents(gen_constants_stub(), fast=False, mode=mode) assert formatted == stub.read_text() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1752503359.0 xmlsec-1.3.17/tests/test_xmlsec.py0000644000076500000240000000063515035212077016021 0ustar00aminstaffimport xmlsec from tests import base class TestModule(base.TestMemoryLeaks): def test_reinitialize_module(self): """This test doesn't explicitly verify anything, but will be invoked first in the suite. So if the subsequent tests don't fail, we know that the ``init()``/``shutdown()`` function pair doesn't break anything. """ xmlsec.shutdown() xmlsec.init()