xmlsec 1.3.16__tar.gz → 1.3.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. xmlsec-1.3.17/.pre-commit-config.yaml +42 -0
  2. xmlsec-1.3.17/PKG-INFO +247 -0
  3. xmlsec-1.3.17/README.md +198 -0
  4. xmlsec-1.3.17/build_support/build_ext.py +86 -0
  5. xmlsec-1.3.17/build_support/network.py +29 -0
  6. xmlsec-1.3.17/build_support/releases.py +77 -0
  7. xmlsec-1.3.17/build_support/static_build.py +453 -0
  8. xmlsec-1.3.17/pyproject.toml +131 -0
  9. xmlsec-1.3.17/setup.cfg +18 -0
  10. xmlsec-1.3.17/setup.py +61 -0
  11. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec/constants.pyi +1 -6
  12. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec/template.pyi +1 -1
  13. xmlsec-1.3.17/src/xmlsec.egg-info/PKG-INFO +247 -0
  14. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.egg-info/SOURCES.txt +6 -1
  15. xmlsec-1.3.17/tests/__init__.py +0 -0
  16. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/base.py +15 -17
  17. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/conftest.py +1 -2
  18. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/softhsm_setup.py +12 -16
  19. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_constants.py +4 -4
  20. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_doc_examples.py +3 -11
  21. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_ds.py +55 -55
  22. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_enc.py +25 -25
  23. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_keys.py +58 -62
  24. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_main.py +6 -6
  25. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_pkcs11.py +4 -4
  26. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_templates.py +44 -44
  27. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_tree.py +5 -5
  28. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_type_stubs.py +3 -5
  29. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/test_xmlsec.py +1 -2
  30. xmlsec-1.3.16/.pre-commit-config.yaml +0 -48
  31. xmlsec-1.3.16/PKG-INFO +0 -278
  32. xmlsec-1.3.16/README.rst +0 -229
  33. xmlsec-1.3.16/pyproject.toml +0 -88
  34. xmlsec-1.3.16/setup.cfg +0 -30
  35. xmlsec-1.3.16/setup.py +0 -635
  36. xmlsec-1.3.16/src/xmlsec.egg-info/PKG-INFO +0 -278
  37. {xmlsec-1.3.16 → xmlsec-1.3.17}/.readthedocs.yaml +0 -0
  38. {xmlsec-1.3.16 → xmlsec-1.3.17}/LICENSE +0 -0
  39. {xmlsec-1.3.16 → xmlsec-1.3.17}/MANIFEST.in +0 -0
  40. {xmlsec-1.3.16/tests → xmlsec-1.3.17/build_support}/__init__.py +0 -0
  41. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/common.h +0 -0
  42. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/constants.c +0 -0
  43. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/constants.h +0 -0
  44. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/debug.h +0 -0
  45. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/ds.c +0 -0
  46. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/enc.c +0 -0
  47. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/exception.c +0 -0
  48. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/exception.h +0 -0
  49. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/keys.c +0 -0
  50. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/keys.h +0 -0
  51. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/lxml.c +0 -0
  52. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/lxml.h +0 -0
  53. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/main.c +0 -0
  54. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/platform.h +0 -0
  55. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/PKG-INFO +0 -0
  56. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/SOURCES.txt +0 -0
  57. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/dependency_links.txt +0 -0
  58. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/not-zip-safe +0 -0
  59. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/requires.txt +0 -0
  60. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/python_xmlsec1.egg-info/top_level.txt +0 -0
  61. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/PKG-INFO +0 -0
  62. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/SOURCES.txt +0 -0
  63. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/dependency_links.txt +0 -0
  64. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/not-zip-safe +0 -0
  65. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/requires.txt +0 -0
  66. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/pyxmlsec.egg-info/top_level.txt +0 -0
  67. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/template.c +0 -0
  68. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/tree.c +0 -0
  69. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/utils.c +0 -0
  70. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/utils.h +0 -0
  71. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec/__init__.pyi +0 -0
  72. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec/py.typed +0 -0
  73. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec/tree.pyi +0 -0
  74. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.cpython-39-darwin.so +0 -0
  75. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.egg-info/dependency_links.txt +0 -0
  76. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.egg-info/not-zip-safe +0 -0
  77. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.egg-info/requires.txt +0 -0
  78. {xmlsec-1.3.16 → xmlsec-1.3.17}/src/xmlsec.egg-info/top_level.txt +0 -0
  79. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/deskey.bin +0 -0
  80. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/doc.xml +0 -0
  81. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/dsacert.der +0 -0
  82. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/dsakey.der +0 -0
  83. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc1-in.xml +0 -0
  84. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc1-out.xml +0 -0
  85. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc2-in.xml +0 -0
  86. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc2-out.xml +0 -0
  87. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc3-in.xml +0 -0
  88. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc3-out.xml +0 -0
  89. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/enc_template.xml +0 -0
  90. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/rsacert.pem +0 -0
  91. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/rsakey.pem +0 -0
  92. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/rsapub.pem +0 -0
  93. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign1-in.xml +0 -0
  94. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign1-out.xml +0 -0
  95. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign2-in.xml +0 -0
  96. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign2-out.xml +0 -0
  97. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign3-in.xml +0 -0
  98. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign3-out.xml +0 -0
  99. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign4-in.xml +0 -0
  100. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign4-out.xml +0 -0
  101. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign5-in.xml +0 -0
  102. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign5-out-xmlsec_1_2_36_to_37.xml +0 -0
  103. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign5-out.xml +0 -0
  104. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign6-in.bin +0 -0
  105. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign6-out.bin +0 -0
  106. {xmlsec-1.3.16 → xmlsec-1.3.17}/tests/data/sign_template.xml +0 -0
@@ -0,0 +1,42 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/astral-sh/ruff-pre-commit
5
+ rev: v0.14.4
6
+ hooks:
7
+ - id: ruff
8
+ args: ["--fix"]
9
+ types: [python]
10
+ - id: ruff-format
11
+ types: [python]
12
+
13
+ - repo: https://github.com/pre-commit/pre-commit-hooks
14
+ rev: v6.0.0
15
+ hooks:
16
+ - id: no-commit-to-branch
17
+ - id: trailing-whitespace
18
+ - id: end-of-file-fixer
19
+ - id: check-yaml
20
+ - id: check-added-large-files
21
+ - id: check-ast
22
+ - id: check-merge-conflict
23
+ - id: check-json
24
+ - id: detect-private-key
25
+ exclude: ^.*/rsakey.pem$
26
+ - id: mixed-line-ending
27
+ - id: pretty-format-json
28
+ args: [--autofix]
29
+
30
+ - repo: https://github.com/pre-commit/mirrors-mypy
31
+ rev: v1.18.2
32
+ hooks:
33
+ - id: mypy
34
+ exclude: (setup.py|tests|build_support/.*.py|doc/.*)
35
+ types: []
36
+ files: ^.*.pyi?$
37
+ additional_dependencies: [lxml-stubs, types-docutils]
38
+
39
+ - repo: https://github.com/pre-commit/pygrep-hooks
40
+ rev: v1.10.0
41
+ hooks:
42
+ - id: rst-backticks
xmlsec-1.3.17/PKG-INFO ADDED
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: xmlsec
3
+ Version: 1.3.17
4
+ Summary: Python bindings for the XML Security Library
5
+ Home-page: https://github.com/mehcode/python-xmlsec
6
+ Author: Bulat Gaifullin
7
+ Author-email: support@mehcode.com
8
+ Maintainer: Oleg Hoefling
9
+ Maintainer-email: oleg.hoefling@gmail.com
10
+ License: MIT
11
+ Project-URL: Documentation, https://xmlsec.readthedocs.io
12
+ Project-URL: Source, https://github.com/mehcode/python-xmlsec
13
+ Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases
14
+ Keywords: xmlsec
15
+ Classifier: Development Status :: 5 - Production/Stable
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: System Administrators
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: C
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Topic :: Text Processing :: Markup :: XML
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.9
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: lxml>=3.8
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: keywords
41
+ Dynamic: license
42
+ Dynamic: license-file
43
+ Dynamic: maintainer
44
+ Dynamic: maintainer-email
45
+ Dynamic: project-url
46
+ Dynamic: requires-dist
47
+ Dynamic: requires-python
48
+ Dynamic: summary
49
+
50
+ # python-xmlsec
51
+
52
+ [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec)
53
+ [![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)
54
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml)
55
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml)
56
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml)
57
+ [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec)
58
+ [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest)
59
+
60
+ Python bindings for the [XML Security
61
+ Library](https://www.aleksey.com/xmlsec/).
62
+
63
+ ## Documentation
64
+
65
+ Documentation for `xmlsec` can be found at
66
+ [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/).
67
+
68
+ ## Usage
69
+
70
+ Check the
71
+ [examples](https://xmlsec.readthedocs.io/en/latest/examples.html)
72
+ section in the documentation to see various examples of signing and
73
+ verifying using the library.
74
+
75
+ ## Requirements
76
+
77
+ - `libxml2 >= 2.9.1`
78
+ - `libxmlsec1 >= 1.2.33`
79
+
80
+ ## Install
81
+
82
+ `xmlsec` is available on PyPI:
83
+
84
+ ``` bash
85
+ pip install xmlsec
86
+ ```
87
+
88
+ Depending on your OS, you may need to install the required native
89
+ libraries first:
90
+
91
+ ### Linux (Debian)
92
+
93
+ ``` bash
94
+ apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
95
+ ```
96
+
97
+ Note: There is no required version of LibXML2 for Ubuntu Precise, so you
98
+ need to download and install it manually.
99
+
100
+ ``` bash
101
+ wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
102
+ tar -xvf libxml2-2.9.1.tar.gz
103
+ cd libxml2-2.9.1
104
+ ./configure && make && make install
105
+ ```
106
+
107
+ ### Linux (CentOS)
108
+
109
+ ``` bash
110
+ yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
111
+ ```
112
+
113
+ ### Linux (Fedora)
114
+
115
+ ``` bash
116
+ dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
117
+ ```
118
+
119
+ ### Mac
120
+
121
+ ``` bash
122
+ brew install libxml2 libxmlsec1 pkg-config
123
+ ```
124
+
125
+ or
126
+
127
+ ``` bash
128
+ port install libxml2 xmlsec pkgconfig
129
+ ```
130
+
131
+ ### Alpine
132
+
133
+ ``` bash
134
+ apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
135
+ ```
136
+
137
+ ## Troubleshooting
138
+
139
+ ### Mac
140
+
141
+ If you get any fatal errors about missing `.h` files, update your
142
+ `C_INCLUDE_PATH` environment variable to include the appropriate files
143
+ from the `libxml2` and `libxmlsec1` libraries.
144
+
145
+ ### Windows
146
+
147
+ Starting with 1.3.7, prebuilt wheels are available for Windows, so
148
+ running `pip install xmlsec` should suffice. If you want to build from
149
+ source:
150
+
151
+ 1. Configure build environment, see
152
+ [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for
153
+ more details.
154
+
155
+ 2. Install from source dist:
156
+
157
+ ``` bash
158
+ pip install xmlsec --no-binary=xmlsec
159
+ ```
160
+
161
+ ## Building from source
162
+
163
+ 1. Clone the `xmlsec` source code repository to your local computer.
164
+
165
+ ``` bash
166
+ git clone https://github.com/xmlsec/python-xmlsec.git
167
+ ```
168
+
169
+ 2. Change into the `python-xmlsec` root directory.
170
+
171
+ ``` bash
172
+ cd /path/to/xmlsec
173
+ ```
174
+
175
+ 3. Install the project and all its dependencies using `pip`.
176
+
177
+ ``` bash
178
+ pip install .
179
+ ```
180
+
181
+ ## Contributing
182
+
183
+ ### Setting up your environment
184
+
185
+ 1. Follow steps 1 and 2 of the [manual installation
186
+ instructions](#building-from-source).
187
+
188
+ 2. Initialize a virtual environment to develop in. This is done so as
189
+ to ensure every contributor is working with close-to-identical
190
+ versions of packages.
191
+
192
+ ``` bash
193
+ mkvirtualenv xmlsec
194
+ ```
195
+
196
+ The `mkvirtualenv` command is available from `virtualenvwrapper`
197
+ package which can be installed by following
198
+ [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation).
199
+
200
+ 3. Activate the created virtual environment:
201
+
202
+ ``` bash
203
+ workon xmlsec
204
+ ```
205
+
206
+ 4. Install `xmlsec` in development mode with testing enabled. This will
207
+ download all dependencies required for running the unit tests.
208
+
209
+ ``` bash
210
+ pip install -r requirements-test.txt
211
+ pip install -e "."
212
+ ```
213
+
214
+ ### Running the test suite
215
+
216
+ 1. [Set up your environment](#setting-up-your-environment).
217
+
218
+ 2. Run the unit tests.
219
+
220
+ ``` bash
221
+ pytest tests
222
+ ```
223
+
224
+ 3. Tests configuration
225
+
226
+ Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test
227
+ iterations to detect memory leaks.
228
+
229
+ ### Reporting an issue
230
+
231
+ Please attach the output of following information:
232
+
233
+ - version of `xmlsec`
234
+ - version of `libxmlsec1`
235
+ - version of `libxml2`
236
+ - output from the command
237
+
238
+ ``` bash
239
+ pkg-config --cflags xmlsec1
240
+ ```
241
+
242
+ ## License
243
+
244
+ Unless otherwise noted, all files contained within this project are
245
+ licensed under the MIT open source license. See the included `LICENSE`
246
+ file or visit [opensource.org](http://opensource.org/licenses/MIT) for
247
+ more information.
@@ -0,0 +1,198 @@
1
+ # python-xmlsec
2
+
3
+ [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec)
4
+ [![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)
5
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml)
6
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml)
7
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml)
8
+ [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec)
9
+ [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest)
10
+
11
+ Python bindings for the [XML Security
12
+ Library](https://www.aleksey.com/xmlsec/).
13
+
14
+ ## Documentation
15
+
16
+ Documentation for `xmlsec` can be found at
17
+ [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/).
18
+
19
+ ## Usage
20
+
21
+ Check the
22
+ [examples](https://xmlsec.readthedocs.io/en/latest/examples.html)
23
+ section in the documentation to see various examples of signing and
24
+ verifying using the library.
25
+
26
+ ## Requirements
27
+
28
+ - `libxml2 >= 2.9.1`
29
+ - `libxmlsec1 >= 1.2.33`
30
+
31
+ ## Install
32
+
33
+ `xmlsec` is available on PyPI:
34
+
35
+ ``` bash
36
+ pip install xmlsec
37
+ ```
38
+
39
+ Depending on your OS, you may need to install the required native
40
+ libraries first:
41
+
42
+ ### Linux (Debian)
43
+
44
+ ``` bash
45
+ apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
46
+ ```
47
+
48
+ Note: There is no required version of LibXML2 for Ubuntu Precise, so you
49
+ need to download and install it manually.
50
+
51
+ ``` bash
52
+ wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
53
+ tar -xvf libxml2-2.9.1.tar.gz
54
+ cd libxml2-2.9.1
55
+ ./configure && make && make install
56
+ ```
57
+
58
+ ### Linux (CentOS)
59
+
60
+ ``` bash
61
+ yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
62
+ ```
63
+
64
+ ### Linux (Fedora)
65
+
66
+ ``` bash
67
+ dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
68
+ ```
69
+
70
+ ### Mac
71
+
72
+ ``` bash
73
+ brew install libxml2 libxmlsec1 pkg-config
74
+ ```
75
+
76
+ or
77
+
78
+ ``` bash
79
+ port install libxml2 xmlsec pkgconfig
80
+ ```
81
+
82
+ ### Alpine
83
+
84
+ ``` bash
85
+ apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
86
+ ```
87
+
88
+ ## Troubleshooting
89
+
90
+ ### Mac
91
+
92
+ If you get any fatal errors about missing `.h` files, update your
93
+ `C_INCLUDE_PATH` environment variable to include the appropriate files
94
+ from the `libxml2` and `libxmlsec1` libraries.
95
+
96
+ ### Windows
97
+
98
+ Starting with 1.3.7, prebuilt wheels are available for Windows, so
99
+ running `pip install xmlsec` should suffice. If you want to build from
100
+ source:
101
+
102
+ 1. Configure build environment, see
103
+ [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for
104
+ more details.
105
+
106
+ 2. Install from source dist:
107
+
108
+ ``` bash
109
+ pip install xmlsec --no-binary=xmlsec
110
+ ```
111
+
112
+ ## Building from source
113
+
114
+ 1. Clone the `xmlsec` source code repository to your local computer.
115
+
116
+ ``` bash
117
+ git clone https://github.com/xmlsec/python-xmlsec.git
118
+ ```
119
+
120
+ 2. Change into the `python-xmlsec` root directory.
121
+
122
+ ``` bash
123
+ cd /path/to/xmlsec
124
+ ```
125
+
126
+ 3. Install the project and all its dependencies using `pip`.
127
+
128
+ ``` bash
129
+ pip install .
130
+ ```
131
+
132
+ ## Contributing
133
+
134
+ ### Setting up your environment
135
+
136
+ 1. Follow steps 1 and 2 of the [manual installation
137
+ instructions](#building-from-source).
138
+
139
+ 2. Initialize a virtual environment to develop in. This is done so as
140
+ to ensure every contributor is working with close-to-identical
141
+ versions of packages.
142
+
143
+ ``` bash
144
+ mkvirtualenv xmlsec
145
+ ```
146
+
147
+ The `mkvirtualenv` command is available from `virtualenvwrapper`
148
+ package which can be installed by following
149
+ [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation).
150
+
151
+ 3. Activate the created virtual environment:
152
+
153
+ ``` bash
154
+ workon xmlsec
155
+ ```
156
+
157
+ 4. Install `xmlsec` in development mode with testing enabled. This will
158
+ download all dependencies required for running the unit tests.
159
+
160
+ ``` bash
161
+ pip install -r requirements-test.txt
162
+ pip install -e "."
163
+ ```
164
+
165
+ ### Running the test suite
166
+
167
+ 1. [Set up your environment](#setting-up-your-environment).
168
+
169
+ 2. Run the unit tests.
170
+
171
+ ``` bash
172
+ pytest tests
173
+ ```
174
+
175
+ 3. Tests configuration
176
+
177
+ Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test
178
+ iterations to detect memory leaks.
179
+
180
+ ### Reporting an issue
181
+
182
+ Please attach the output of following information:
183
+
184
+ - version of `xmlsec`
185
+ - version of `libxmlsec1`
186
+ - version of `libxml2`
187
+ - output from the command
188
+
189
+ ``` bash
190
+ pkg-config --cflags xmlsec1
191
+ ```
192
+
193
+ ## License
194
+
195
+ Unless otherwise noted, all files contained within this project are
196
+ licensed under the MIT open source license. See the included `LICENSE`
197
+ file or visit [opensource.org](http://opensource.org/licenses/MIT) for
198
+ more information.
@@ -0,0 +1,86 @@
1
+ import os
2
+ import sys
3
+ from distutils import log
4
+ from distutils.errors import DistutilsError
5
+
6
+ from setuptools.command.build_ext import build_ext as build_ext_orig
7
+
8
+ from .static_build import CrossCompileInfo, StaticBuildHelper
9
+
10
+
11
+ class build_ext(build_ext_orig):
12
+ def info(self, message):
13
+ self.announce(message, level=log.INFO)
14
+
15
+ def run(self):
16
+ ext = self.ext_map['xmlsec']
17
+ self.debug = os.environ.get('PYXMLSEC_ENABLE_DEBUG', False)
18
+ self.static = os.environ.get('PYXMLSEC_STATIC_DEPS', False)
19
+ self.size_opt = os.environ.get('PYXMLSEC_OPTIMIZE_SIZE', True)
20
+
21
+ if self.static or sys.platform == 'win32':
22
+ helper = StaticBuildHelper(self)
23
+ helper.prepare(sys.platform)
24
+ else:
25
+ import pkgconfig
26
+
27
+ try:
28
+ config = pkgconfig.parse('xmlsec1')
29
+ except OSError as error:
30
+ raise DistutilsError('Unable to invoke pkg-config.') from error
31
+ except pkgconfig.PackageNotFoundError as error:
32
+ raise DistutilsError('xmlsec1 is not installed or not in path.') from error
33
+
34
+ if config is None or not config.get('libraries'):
35
+ raise DistutilsError('Bad or incomplete result returned from pkg-config.')
36
+
37
+ ext.define_macros.extend(config['define_macros'])
38
+ ext.include_dirs.extend(config['include_dirs'])
39
+ ext.library_dirs.extend(config['library_dirs'])
40
+ ext.libraries.extend(config['libraries'])
41
+
42
+ import lxml
43
+
44
+ ext.include_dirs.extend(lxml.get_include())
45
+
46
+ ext.define_macros.extend(
47
+ [('MODULE_NAME', self.distribution.metadata.name), ('MODULE_VERSION', self.distribution.metadata.version)]
48
+ )
49
+ for key, value in ext.define_macros:
50
+ if key == 'XMLSEC_CRYPTO' and not (value.startswith('"') and value.endswith('"')):
51
+ ext.define_macros.remove((key, value))
52
+ ext.define_macros.append((key, f'"{value}"'))
53
+ break
54
+
55
+ if sys.platform == 'win32':
56
+ ext.extra_compile_args.append('/Zi')
57
+ else:
58
+ ext.extra_compile_args.extend(
59
+ [
60
+ '-g',
61
+ '-std=c99',
62
+ '-fPIC',
63
+ '-fno-strict-aliasing',
64
+ '-Wno-error=declaration-after-statement',
65
+ '-Werror=implicit-function-declaration',
66
+ ]
67
+ )
68
+
69
+ if self.debug:
70
+ ext.define_macros.append(('PYXMLSEC_ENABLE_DEBUG', '1'))
71
+ if sys.platform == 'win32':
72
+ ext.extra_compile_args.append('/Od')
73
+ else:
74
+ ext.extra_compile_args.append('-Wall')
75
+ ext.extra_compile_args.append('-O0')
76
+ else:
77
+ if self.size_opt:
78
+ if sys.platform == 'win32':
79
+ ext.extra_compile_args.append('/Os')
80
+ else:
81
+ ext.extra_compile_args.append('-Os')
82
+
83
+ super().run()
84
+
85
+
86
+ __all__ = ('CrossCompileInfo', 'build_ext')
@@ -0,0 +1,29 @@
1
+ import contextlib
2
+ import json
3
+ from urllib.request import Request, urlopen
4
+
5
+ DEFAULT_USER_AGENT = 'https://github.com/xmlsec/python-xmlsec'
6
+ DOWNLOAD_USER_AGENT = 'python-xmlsec build'
7
+
8
+
9
+ def make_request(url, github_token=None, json_response=False):
10
+ headers = {'User-Agent': DEFAULT_USER_AGENT}
11
+ if github_token:
12
+ headers['authorization'] = 'Bearer ' + github_token
13
+ request = Request(url, headers=headers)
14
+ with contextlib.closing(urlopen(request)) as response:
15
+ charset = response.headers.get_content_charset() or 'utf-8'
16
+ content = response.read().decode(charset)
17
+ if json_response:
18
+ return json.loads(content)
19
+ return content
20
+
21
+
22
+ def download_lib(url, filename):
23
+ request = Request(url, headers={'User-Agent': DOWNLOAD_USER_AGENT})
24
+ with urlopen(request) as response, open(filename, 'wb') as target:
25
+ while True:
26
+ chunk = response.read(8192)
27
+ if not chunk:
28
+ break
29
+ target.write(chunk)
@@ -0,0 +1,77 @@
1
+ import html.parser
2
+ import os
3
+ import re
4
+ from distutils import log
5
+ from distutils.version import StrictVersion as Version
6
+
7
+ from .network import make_request
8
+
9
+
10
+ class HrefCollector(html.parser.HTMLParser):
11
+ def __init__(self, *args, **kwargs):
12
+ super().__init__(*args, **kwargs)
13
+ self.hrefs = []
14
+
15
+ def handle_starttag(self, tag, attrs):
16
+ if tag == 'a':
17
+ for name, value in attrs:
18
+ if name == 'href':
19
+ self.hrefs.append(value)
20
+
21
+
22
+ def latest_release_from_html(url, matcher):
23
+ content = make_request(url)
24
+ collector = HrefCollector()
25
+ collector.feed(content)
26
+ hrefs = collector.hrefs
27
+
28
+ def comp(text):
29
+ try:
30
+ return Version(matcher.match(text).groupdict()['version'])
31
+ except (AttributeError, ValueError):
32
+ return Version('0.0')
33
+
34
+ latest = max(hrefs, key=comp)
35
+ return f'{url}/{latest}'
36
+
37
+
38
+ def latest_release_from_gnome_org_cache(url, lib_name):
39
+ cache_url = f'{url}/cache.json'
40
+ cache = make_request(cache_url, json_response=True)
41
+ latest_version = cache[2][lib_name][-1]
42
+ latest_source = cache[1][lib_name][latest_version]['tar.xz']
43
+ return f'{url}/{latest_source}'
44
+
45
+
46
+ def latest_release_json_from_github_api(repo):
47
+ api_url = f'https://api.github.com/repos/{repo}/releases/latest'
48
+ token = os.environ.get('GH_TOKEN')
49
+ if token:
50
+ log.info('Using GitHub token to avoid rate limiting')
51
+ return make_request(api_url, token, json_response=True)
52
+
53
+
54
+ def latest_openssl_release():
55
+ return latest_release_json_from_github_api('openssl/openssl')['tarball_url']
56
+
57
+
58
+ def latest_zlib_release():
59
+ return latest_release_from_html('https://zlib.net/fossils', re.compile('zlib-(?P<version>.*).tar.gz'))
60
+
61
+
62
+ def latest_libiconv_release():
63
+ return latest_release_from_html('https://ftpmirror.gnu.org/libiconv', re.compile('libiconv-(?P<version>.*).tar.gz'))
64
+
65
+
66
+ def latest_libxml2_release():
67
+ return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxml2', 'libxml2')
68
+
69
+
70
+ def latest_libxslt_release():
71
+ return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxslt', 'libxslt')
72
+
73
+
74
+ def latest_xmlsec_release():
75
+ assets = latest_release_json_from_github_api('lsh123/xmlsec')['assets']
76
+ (tar_gz,) = [asset for asset in assets if asset['name'].endswith('.tar.gz')]
77
+ return tar_gz['browser_download_url']