xmlsec 1.3.18__cp315-cp315-win_amd64.whl
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.
- xmlsec/__init__.pyi +81 -0
- xmlsec/constants.pyi +154 -0
- xmlsec/py.typed +1 -0
- xmlsec/template.pyi +38 -0
- xmlsec/tree.pyi +18 -0
- xmlsec-1.3.18.dist-info/METADATA +281 -0
- xmlsec-1.3.18.dist-info/RECORD +11 -0
- xmlsec-1.3.18.dist-info/WHEEL +5 -0
- xmlsec-1.3.18.dist-info/licenses/LICENSE +21 -0
- xmlsec-1.3.18.dist-info/top_level.txt +1 -0
- xmlsec.cp315-win_amd64.pyd +0 -0
xmlsec/__init__.pyi
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from collections.abc import Callable, Iterable
|
|
2
|
+
from typing import IO, Any, AnyStr, TypeVar, overload
|
|
3
|
+
|
|
4
|
+
from _typeshed import GenericPath, Self, StrOrBytesPath
|
|
5
|
+
from lxml.etree import _Element
|
|
6
|
+
|
|
7
|
+
from xmlsec import constants as constants
|
|
8
|
+
from xmlsec import template as template
|
|
9
|
+
from xmlsec import tree as tree
|
|
10
|
+
from xmlsec.constants import __KeyData as KeyData
|
|
11
|
+
from xmlsec.constants import __Transform as Transform
|
|
12
|
+
|
|
13
|
+
_E = TypeVar('_E', bound=_Element)
|
|
14
|
+
|
|
15
|
+
def enable_debug_trace(enabled: bool = ...) -> None: ...
|
|
16
|
+
def get_libxml_version() -> tuple[int, int, int]: ...
|
|
17
|
+
def get_libxml_compiled_version() -> tuple[int, int, int]: ...
|
|
18
|
+
def init() -> None: ...
|
|
19
|
+
def shutdown() -> None: ...
|
|
20
|
+
def cleanup_callbacks() -> None: ...
|
|
21
|
+
def register_default_callbacks() -> None: ...
|
|
22
|
+
def register_callbacks(
|
|
23
|
+
input_match_callback: Callable[[bytes], bool],
|
|
24
|
+
input_open_callback: Callable[[bytes], Any],
|
|
25
|
+
input_read_callback: Callable[[Any, memoryview], int],
|
|
26
|
+
input_close_callback: Callable[[Any], None],
|
|
27
|
+
) -> None: ...
|
|
28
|
+
@overload
|
|
29
|
+
def base64_default_line_size() -> int: ...
|
|
30
|
+
@overload
|
|
31
|
+
def base64_default_line_size(size: int) -> None: ...
|
|
32
|
+
|
|
33
|
+
class EncryptionContext:
|
|
34
|
+
key: Key | None
|
|
35
|
+
def __init__(self, manager: KeysManager | None = ...) -> None: ...
|
|
36
|
+
def decrypt(self, node: _Element) -> _Element: ...
|
|
37
|
+
def encrypt_binary(self, template: _E, data: bytes) -> _E: ...
|
|
38
|
+
def encrypt_uri(self, template: _E, uri: str) -> _E: ...
|
|
39
|
+
def encrypt_xml(self, template: _E, node: _Element) -> _E: ...
|
|
40
|
+
def reset(self) -> None: ...
|
|
41
|
+
|
|
42
|
+
class Error(Exception): ...
|
|
43
|
+
class InternalError(Error): ...
|
|
44
|
+
|
|
45
|
+
class Key:
|
|
46
|
+
name: str
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_binary_data(cls: type[Self], klass: KeyData, data: AnyStr) -> Self: ...
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_binary_file(cls: type[Self], klass: KeyData, filename: StrOrBytesPath) -> Self: ...
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_file(cls: type[Self], file: GenericPath[AnyStr] | IO[AnyStr], format: int, password: str | None = ...) -> Self: ...
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_engine(cls: type[Self], engine_and_key_id: AnyStr) -> Self: ...
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_memory(cls: type[Self], data: AnyStr, format: int, password: str | None = ...) -> Self: ...
|
|
57
|
+
@classmethod
|
|
58
|
+
def generate(cls: type[Self], klass: KeyData, size: int, type: int) -> Self: ...
|
|
59
|
+
def load_cert_from_file(self, file: GenericPath[AnyStr] | IO[AnyStr], format: int) -> None: ...
|
|
60
|
+
def load_cert_from_memory(self, data: AnyStr, format: int) -> None: ...
|
|
61
|
+
def __copy__(self: Self) -> Self: ...
|
|
62
|
+
def __deepcopy__(self: Self) -> Self: ...
|
|
63
|
+
|
|
64
|
+
class KeysManager:
|
|
65
|
+
def add_key(self, key: Key) -> None: ...
|
|
66
|
+
def load_cert(self, filename: StrOrBytesPath, format: int, type: int) -> None: ...
|
|
67
|
+
def load_cert_from_memory(self, data: AnyStr, format: int, type: int) -> None: ...
|
|
68
|
+
|
|
69
|
+
class SignatureContext:
|
|
70
|
+
key: Key | None
|
|
71
|
+
enabled_reference_uris: int
|
|
72
|
+
def enable_reference_transform(self, transform: Transform) -> None: ...
|
|
73
|
+
def enable_signature_transform(self, transform: Transform) -> None: ...
|
|
74
|
+
def register_id(self, node: _Element, id_attr: str = ..., id_ns: str | None = ...) -> None: ...
|
|
75
|
+
def set_enabled_key_data(self, keydata_list: Iterable[KeyData]) -> None: ...
|
|
76
|
+
def sign(self, node: _Element) -> None: ...
|
|
77
|
+
def sign_binary(self, bytes: bytes, transform: Transform) -> bytes: ...
|
|
78
|
+
def verify(self, node: _Element) -> None: ...
|
|
79
|
+
def verify_binary(self, bytes: bytes, transform: Transform, signature: bytes) -> None: ...
|
|
80
|
+
|
|
81
|
+
class VerificationError(Error): ...
|
xmlsec/constants.pyi
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import Final, NamedTuple
|
|
3
|
+
|
|
4
|
+
class __KeyData(NamedTuple): # __KeyData type
|
|
5
|
+
href: str
|
|
6
|
+
name: str
|
|
7
|
+
|
|
8
|
+
class __KeyDataNoHref(NamedTuple): # __KeyData type
|
|
9
|
+
href: None
|
|
10
|
+
name: str
|
|
11
|
+
|
|
12
|
+
class __Transform(NamedTuple): # __Transform type
|
|
13
|
+
href: str
|
|
14
|
+
name: str
|
|
15
|
+
usage: int
|
|
16
|
+
|
|
17
|
+
class __TransformNoHref(NamedTuple): # __Transform type
|
|
18
|
+
href: None
|
|
19
|
+
name: str
|
|
20
|
+
usage: int
|
|
21
|
+
|
|
22
|
+
DSigNs: Final[str]
|
|
23
|
+
EncNs: Final[str]
|
|
24
|
+
KeyDataAes: Final[__KeyData]
|
|
25
|
+
KeyDataDes: Final[__KeyData]
|
|
26
|
+
KeyDataDsa: Final[__KeyData]
|
|
27
|
+
KeyDataEc: Final[__KeyData]
|
|
28
|
+
KeyDataEcdsa: Final[__KeyData]
|
|
29
|
+
KeyDataEncryptedKey: Final[__KeyData]
|
|
30
|
+
KeyDataFormatBinary: Final[int]
|
|
31
|
+
KeyDataFormatCertDer: Final[int]
|
|
32
|
+
KeyDataFormatCertPem: Final[int]
|
|
33
|
+
KeyDataFormatDer: Final[int]
|
|
34
|
+
KeyDataFormatPem: Final[int]
|
|
35
|
+
KeyDataFormatPkcs12: Final[int]
|
|
36
|
+
KeyDataFormatPkcs8Der: Final[int]
|
|
37
|
+
KeyDataFormatPkcs8Pem: Final[int]
|
|
38
|
+
KeyDataFormatUnknown: Final[int]
|
|
39
|
+
KeyDataHmac: Final[__KeyData]
|
|
40
|
+
KeyDataName: Final[__KeyDataNoHref]
|
|
41
|
+
KeyDataRawX509Cert: Final[__KeyData]
|
|
42
|
+
KeyDataRetrievalMethod: Final[__KeyDataNoHref]
|
|
43
|
+
KeyDataRsa: Final[__KeyData]
|
|
44
|
+
KeyDataTypeAny: Final[int]
|
|
45
|
+
KeyDataTypeNone: Final[int]
|
|
46
|
+
KeyDataTypePermanent: Final[int]
|
|
47
|
+
KeyDataTypePrivate: Final[int]
|
|
48
|
+
KeyDataTypePublic: Final[int]
|
|
49
|
+
KeyDataTypeSession: Final[int]
|
|
50
|
+
KeyDataTypeSymmetric: Final[int]
|
|
51
|
+
KeyDataTypeTrusted: Final[int]
|
|
52
|
+
KeyDataTypeUnknown: Final[int]
|
|
53
|
+
KeyDataValue: Final[__KeyDataNoHref]
|
|
54
|
+
KeyDataX509: Final[__KeyData]
|
|
55
|
+
NodeCanonicalizationMethod: Final[str]
|
|
56
|
+
NodeCipherData: Final[str]
|
|
57
|
+
NodeCipherReference: Final[str]
|
|
58
|
+
NodeCipherValue: Final[str]
|
|
59
|
+
NodeDataReference: Final[str]
|
|
60
|
+
NodeDigestMethod: Final[str]
|
|
61
|
+
NodeDigestValue: Final[str]
|
|
62
|
+
NodeEncryptedData: Final[str]
|
|
63
|
+
NodeEncryptedKey: Final[str]
|
|
64
|
+
NodeEncryptionMethod: Final[str]
|
|
65
|
+
NodeEncryptionProperties: Final[str]
|
|
66
|
+
NodeEncryptionProperty: Final[str]
|
|
67
|
+
NodeKeyInfo: Final[str]
|
|
68
|
+
NodeKeyName: Final[str]
|
|
69
|
+
NodeKeyReference: Final[str]
|
|
70
|
+
NodeKeyValue: Final[str]
|
|
71
|
+
NodeManifest: Final[str]
|
|
72
|
+
NodeObject: Final[str]
|
|
73
|
+
NodeReference: Final[str]
|
|
74
|
+
NodeReferenceList: Final[str]
|
|
75
|
+
NodeSignature: Final[str]
|
|
76
|
+
NodeSignatureMethod: Final[str]
|
|
77
|
+
NodeSignatureProperties: Final[str]
|
|
78
|
+
NodeSignatureValue: Final[str]
|
|
79
|
+
NodeSignedInfo: Final[str]
|
|
80
|
+
NodeX509Data: Final[str]
|
|
81
|
+
Ns: Final[str]
|
|
82
|
+
NsExcC14N: Final[str]
|
|
83
|
+
NsExcC14NWithComments: Final[str]
|
|
84
|
+
TransformAes128Cbc: Final[__Transform]
|
|
85
|
+
TransformAes128Gcm: Final[__Transform]
|
|
86
|
+
TransformAes192Cbc: Final[__Transform]
|
|
87
|
+
TransformAes192Gcm: Final[__Transform]
|
|
88
|
+
TransformAes256Cbc: Final[__Transform]
|
|
89
|
+
TransformAes256Gcm: Final[__Transform]
|
|
90
|
+
TransformDes3Cbc: Final[__Transform]
|
|
91
|
+
TransformDsaSha1: Final[__Transform]
|
|
92
|
+
TransformEcdsaSha1: Final[__Transform]
|
|
93
|
+
TransformEcdsaSha224: Final[__Transform]
|
|
94
|
+
TransformEcdsaSha256: Final[__Transform]
|
|
95
|
+
TransformEcdsaSha384: Final[__Transform]
|
|
96
|
+
TransformEcdsaSha512: Final[__Transform]
|
|
97
|
+
TransformEnveloped: Final[__Transform]
|
|
98
|
+
TransformExclC14N: Final[__Transform]
|
|
99
|
+
TransformExclC14NWithComments: Final[__Transform]
|
|
100
|
+
TransformHmacMd5: Final[__Transform]
|
|
101
|
+
TransformHmacRipemd160: Final[__Transform]
|
|
102
|
+
TransformHmacSha1: Final[__Transform]
|
|
103
|
+
TransformHmacSha224: Final[__Transform]
|
|
104
|
+
TransformHmacSha256: Final[__Transform]
|
|
105
|
+
TransformHmacSha384: Final[__Transform]
|
|
106
|
+
TransformHmacSha512: Final[__Transform]
|
|
107
|
+
TransformInclC14N: Final[__Transform]
|
|
108
|
+
TransformInclC14N11: Final[__Transform]
|
|
109
|
+
TransformInclC14N11WithComments: Final[__Transform]
|
|
110
|
+
TransformInclC14NWithComments: Final[__Transform]
|
|
111
|
+
TransformKWAes128: Final[__Transform]
|
|
112
|
+
TransformKWAes192: Final[__Transform]
|
|
113
|
+
TransformKWAes256: Final[__Transform]
|
|
114
|
+
TransformKWDes3: Final[__Transform]
|
|
115
|
+
TransformMd5: Final[__Transform]
|
|
116
|
+
TransformRemoveXmlTagsC14N: Final[__TransformNoHref]
|
|
117
|
+
TransformRipemd160: Final[__Transform]
|
|
118
|
+
TransformRsaMd5: Final[__Transform]
|
|
119
|
+
TransformRsaOaep: Final[__Transform]
|
|
120
|
+
TransformRsaPkcs1: Final[__Transform]
|
|
121
|
+
TransformRsaRipemd160: Final[__Transform]
|
|
122
|
+
TransformRsaSha1: Final[__Transform]
|
|
123
|
+
TransformRsaSha224: Final[__Transform]
|
|
124
|
+
TransformRsaSha256: Final[__Transform]
|
|
125
|
+
TransformRsaSha384: Final[__Transform]
|
|
126
|
+
TransformRsaSha512: Final[__Transform]
|
|
127
|
+
TransformSha1: Final[__Transform]
|
|
128
|
+
TransformSha224: Final[__Transform]
|
|
129
|
+
TransformSha256: Final[__Transform]
|
|
130
|
+
TransformSha384: Final[__Transform]
|
|
131
|
+
TransformSha512: Final[__Transform]
|
|
132
|
+
TransformUriTypeAny: Final[int]
|
|
133
|
+
TransformUriTypeEmpty: Final[int]
|
|
134
|
+
TransformUriTypeLocal: Final[int]
|
|
135
|
+
TransformUriTypeNone: Final[int]
|
|
136
|
+
TransformUriTypeRemote: Final[int]
|
|
137
|
+
TransformUriTypeSameDocument: Final[int]
|
|
138
|
+
TransformUsageAny: Final[int]
|
|
139
|
+
TransformUsageC14NMethod: Final[int]
|
|
140
|
+
TransformUsageDSigTransform: Final[int]
|
|
141
|
+
TransformUsageDigestMethod: Final[int]
|
|
142
|
+
TransformUsageEncryptionMethod: Final[int]
|
|
143
|
+
TransformUsageSignatureMethod: Final[int]
|
|
144
|
+
TransformUsageUnknown: Final[int]
|
|
145
|
+
TransformVisa3DHack: Final[__TransformNoHref]
|
|
146
|
+
TransformXPath: Final[__Transform]
|
|
147
|
+
TransformXPath2: Final[__Transform]
|
|
148
|
+
TransformXPointer: Final[__Transform]
|
|
149
|
+
TransformXslt: Final[__Transform]
|
|
150
|
+
TypeEncContent: Final[str]
|
|
151
|
+
TypeEncElement: Final[str]
|
|
152
|
+
XPath2Ns: Final[str]
|
|
153
|
+
XPathNs: Final[str]
|
|
154
|
+
XPointerNs: Final[str]
|
xmlsec/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Marker file for PEP 561. The xmlsec package uses stub files.
|
xmlsec/template.pyi
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from lxml.etree import _Element
|
|
5
|
+
|
|
6
|
+
from xmlsec.constants import __Transform as Transform
|
|
7
|
+
|
|
8
|
+
def add_encrypted_key(
|
|
9
|
+
node: _Element, method: Transform, id: str | None = ..., type: str | None = ..., recipient: str | None = ...
|
|
10
|
+
) -> _Element: ...
|
|
11
|
+
def add_key_name(node: _Element, name: str | None = ...) -> _Element: ...
|
|
12
|
+
def add_key_value(node: _Element) -> _Element: ...
|
|
13
|
+
def add_reference(
|
|
14
|
+
node: _Element, digest_method: Transform, id: str | None = ..., uri: str | None = ..., type: str | None = ...
|
|
15
|
+
) -> _Element: ...
|
|
16
|
+
def add_transform(node: _Element, transform: Transform) -> Any: ...
|
|
17
|
+
def add_x509_data(node: _Element) -> _Element: ...
|
|
18
|
+
def create(node: _Element, c14n_method: Transform, sign_method: Transform, id: str | None = ..., ns: str | None = ...) -> _Element: ...
|
|
19
|
+
def encrypted_data_create(
|
|
20
|
+
node: _Element,
|
|
21
|
+
method: Transform,
|
|
22
|
+
id: str | None = ...,
|
|
23
|
+
type: str | None = ...,
|
|
24
|
+
mime_type: str | None = ...,
|
|
25
|
+
encoding: str | None = ...,
|
|
26
|
+
ns: str | None = ...,
|
|
27
|
+
) -> _Element: ...
|
|
28
|
+
def encrypted_data_ensure_cipher_value(node: _Element) -> _Element: ...
|
|
29
|
+
def encrypted_data_ensure_key_info(node: _Element, id: str | None = ..., ns: str | None = ...) -> _Element: ...
|
|
30
|
+
def ensure_key_info(node: _Element, id: str | None = ...) -> _Element: ...
|
|
31
|
+
def transform_add_c14n_inclusive_namespaces(node: _Element, prefixes: str | Sequence[str]) -> None: ...
|
|
32
|
+
def x509_data_add_certificate(node: _Element) -> _Element: ...
|
|
33
|
+
def x509_data_add_crl(node: _Element) -> _Element: ...
|
|
34
|
+
def x509_data_add_issuer_serial(node: _Element) -> _Element: ...
|
|
35
|
+
def x509_data_add_ski(node: _Element) -> _Element: ...
|
|
36
|
+
def x509_data_add_subject_name(node: _Element) -> _Element: ...
|
|
37
|
+
def x509_issuer_serial_add_issuer_name(node: _Element, name: str | None = ...) -> _Element: ...
|
|
38
|
+
def x509_issuer_serial_add_serial_number(node: _Element, serial: str | None = ...) -> _Element: ...
|
xmlsec/tree.pyi
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from typing import overload
|
|
3
|
+
|
|
4
|
+
from lxml.etree import _Element
|
|
5
|
+
|
|
6
|
+
def add_ids(node: _Element, ids: Sequence[str]) -> None: ...
|
|
7
|
+
@overload
|
|
8
|
+
def find_child(parent: _Element, name: str) -> _Element | None: ...
|
|
9
|
+
@overload
|
|
10
|
+
def find_child(parent: _Element, name: str, namespace: str = ...) -> _Element | None: ...
|
|
11
|
+
@overload
|
|
12
|
+
def find_node(node: _Element, name: str) -> _Element | None: ...
|
|
13
|
+
@overload
|
|
14
|
+
def find_node(node: _Element, name: str, namespace: str = ...) -> _Element | None: ...
|
|
15
|
+
@overload
|
|
16
|
+
def find_parent(node: _Element, name: str) -> _Element | None: ...
|
|
17
|
+
@overload
|
|
18
|
+
def find_parent(node: _Element, name: str, namespace: str = ...) -> _Element | None: ...
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xmlsec
|
|
3
|
+
Version: 1.3.18
|
|
4
|
+
Summary: Python bindings for the XML Security Library
|
|
5
|
+
Author-email: Bulat Gaifullin <support@mehcode.com>
|
|
6
|
+
Maintainer-email: Oleg Hoefling <oleg.hoefling@gmail.com>, Amin Solhizadeh <amin.solhizadeh@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Documentation, https://xmlsec.readthedocs.io
|
|
9
|
+
Project-URL: Source, https://github.com/xmlsec/python-xmlsec
|
|
10
|
+
Project-URL: Changelog, https://github.com/xmlsec/python-xmlsec/releases
|
|
11
|
+
Keywords: xmlsec
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: C
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
24
|
+
Classifier: Topic :: Text Processing :: Markup :: XML
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: lxml>=3.8
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# python-xmlsec
|
|
33
|
+
|
|
34
|
+
[](https://pypi.python.org/pypi/xmlsec)
|
|
35
|
+
[](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master)
|
|
36
|
+
[](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml)
|
|
37
|
+
[](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml)
|
|
38
|
+
[](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml)
|
|
39
|
+
[](https://codecov.io/gh/xmlsec/python-xmlsec)
|
|
40
|
+
[](https://xmlsec.readthedocs.io/en/latest/?badge=latest)
|
|
41
|
+
|
|
42
|
+
Python bindings for the [XML Security
|
|
43
|
+
Library](https://www.aleksey.com/xmlsec/).
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
Documentation for `xmlsec` can be found at
|
|
48
|
+
[xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/).
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Check the
|
|
53
|
+
[examples](https://xmlsec.readthedocs.io/en/latest/examples.html)
|
|
54
|
+
section in the documentation to see various examples of signing and
|
|
55
|
+
verifying using the library.
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- `libxml2 >= 2.9.1`
|
|
60
|
+
- `libxmlsec1 >= 1.2.33`
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
`xmlsec` is available on PyPI:
|
|
65
|
+
|
|
66
|
+
``` bash
|
|
67
|
+
pip install xmlsec
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Depending on your OS, you may need to install the required native
|
|
71
|
+
libraries first:
|
|
72
|
+
|
|
73
|
+
### Linux (Debian)
|
|
74
|
+
|
|
75
|
+
``` bash
|
|
76
|
+
apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Note: There is no required version of LibXML2 for Ubuntu Precise, so you
|
|
80
|
+
need to download and install it manually.
|
|
81
|
+
|
|
82
|
+
``` bash
|
|
83
|
+
wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
|
|
84
|
+
tar -xvf libxml2-2.9.1.tar.gz
|
|
85
|
+
cd libxml2-2.9.1
|
|
86
|
+
./configure && make && make install
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Linux (CentOS)
|
|
90
|
+
|
|
91
|
+
``` bash
|
|
92
|
+
yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Linux (Fedora)
|
|
96
|
+
|
|
97
|
+
``` bash
|
|
98
|
+
dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Mac
|
|
102
|
+
|
|
103
|
+
``` bash
|
|
104
|
+
brew install libxml2 libxmlsec1 pkg-config
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
or
|
|
108
|
+
|
|
109
|
+
``` bash
|
|
110
|
+
port install libxml2 xmlsec pkgconfig
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Alpine
|
|
114
|
+
|
|
115
|
+
``` bash
|
|
116
|
+
apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Troubleshooting
|
|
120
|
+
|
|
121
|
+
### `lxml & xmlsec libxml2 library version mismatch`
|
|
122
|
+
|
|
123
|
+
`xmlsec` passes `lxml` XML nodes to the underlying `xmlsec1` library. Both
|
|
124
|
+
libraries use `libxml2`, so they must use compatible `libxml2` versions at
|
|
125
|
+
runtime. If `lxml` is installed from a wheel that bundles one `libxml2`
|
|
126
|
+
version while `xmlsec` is built against another system `libxml2`, importing
|
|
127
|
+
or using `xmlsec` can fail with:
|
|
128
|
+
|
|
129
|
+
``` text
|
|
130
|
+
xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The most reliable fixes are:
|
|
134
|
+
|
|
135
|
+
- Use prebuilt wheels for both `lxml` and `xmlsec` when wheels are available
|
|
136
|
+
for your platform:
|
|
137
|
+
|
|
138
|
+
``` bash
|
|
139
|
+
pip install --only-binary=lxml,xmlsec lxml xmlsec
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- If you need to build from source, build both packages against the same
|
|
143
|
+
locally installed `libxml2`:
|
|
144
|
+
|
|
145
|
+
``` bash
|
|
146
|
+
pip install --no-binary=lxml,xmlsec lxml xmlsec
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Do not mix a wheel-built `lxml` with a locally built `xmlsec`, or the other
|
|
150
|
+
way around, unless you know they use the same `libxml2` version.
|
|
151
|
+
|
|
152
|
+
An `lxml` release upgrade does not by itself mean `xmlsec` is incompatible;
|
|
153
|
+
this error is about the `libxml2` libraries loaded in that environment.
|
|
154
|
+
|
|
155
|
+
If the error appears only under uWSGI, uWSGI may have loaded the system
|
|
156
|
+
`libxml2` before Python imports `lxml` or `xmlsec`. In that case, make sure
|
|
157
|
+
uWSGI and the Python packages resolve to the same `libxml2`, or rebuild the
|
|
158
|
+
Python packages from source in that environment. If you use `uv`, clear any
|
|
159
|
+
cached mixed builds before reinstalling. For example, to reinstall from
|
|
160
|
+
wheels:
|
|
161
|
+
|
|
162
|
+
``` bash
|
|
163
|
+
uv pip uninstall lxml xmlsec
|
|
164
|
+
uv cache clean
|
|
165
|
+
uv pip install --only-binary lxml --only-binary xmlsec lxml xmlsec
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
For background, see
|
|
169
|
+
[issue #356](https://github.com/xmlsec/python-xmlsec/issues/356) and the
|
|
170
|
+
uWSGI edge case in
|
|
171
|
+
[issue #415](https://github.com/xmlsec/python-xmlsec/issues/415).
|
|
172
|
+
|
|
173
|
+
### Mac
|
|
174
|
+
|
|
175
|
+
If you get any fatal errors about missing `.h` files, update your
|
|
176
|
+
`C_INCLUDE_PATH` environment variable to include the appropriate files
|
|
177
|
+
from the `libxml2` and `libxmlsec1` libraries.
|
|
178
|
+
|
|
179
|
+
### Windows
|
|
180
|
+
|
|
181
|
+
Starting with 1.3.7, prebuilt wheels are available for Windows, so
|
|
182
|
+
running `pip install xmlsec` should suffice. If you want to build from
|
|
183
|
+
source:
|
|
184
|
+
|
|
185
|
+
1. Configure build environment, see
|
|
186
|
+
[wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for
|
|
187
|
+
more details.
|
|
188
|
+
|
|
189
|
+
2. Install from source dist:
|
|
190
|
+
|
|
191
|
+
``` bash
|
|
192
|
+
pip install xmlsec --no-binary=xmlsec
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Building from source
|
|
196
|
+
|
|
197
|
+
1. Clone the `xmlsec` source code repository to your local computer.
|
|
198
|
+
|
|
199
|
+
``` bash
|
|
200
|
+
git clone https://github.com/xmlsec/python-xmlsec.git
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
2. Change into the `python-xmlsec` root directory.
|
|
204
|
+
|
|
205
|
+
``` bash
|
|
206
|
+
cd /path/to/xmlsec
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
3. Install the project and all its dependencies using `pip`.
|
|
210
|
+
|
|
211
|
+
``` bash
|
|
212
|
+
pip install .
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Contributing
|
|
216
|
+
|
|
217
|
+
### Setting up your environment
|
|
218
|
+
|
|
219
|
+
1. Follow steps 1 and 2 of the [manual installation
|
|
220
|
+
instructions](#building-from-source).
|
|
221
|
+
|
|
222
|
+
2. Initialize a virtual environment to develop in. This is done so as
|
|
223
|
+
to ensure every contributor is working with close-to-identical
|
|
224
|
+
versions of packages.
|
|
225
|
+
|
|
226
|
+
``` bash
|
|
227
|
+
mkvirtualenv xmlsec
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The `mkvirtualenv` command is available from `virtualenvwrapper`
|
|
231
|
+
package which can be installed by following
|
|
232
|
+
[link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation).
|
|
233
|
+
|
|
234
|
+
3. Activate the created virtual environment:
|
|
235
|
+
|
|
236
|
+
``` bash
|
|
237
|
+
workon xmlsec
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
4. Install `xmlsec` in development mode with testing enabled. This will
|
|
241
|
+
download all dependencies required for running the unit tests.
|
|
242
|
+
|
|
243
|
+
``` bash
|
|
244
|
+
pip install -r requirements-test.txt
|
|
245
|
+
pip install -e "."
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Running the test suite
|
|
249
|
+
|
|
250
|
+
1. [Set up your environment](#setting-up-your-environment).
|
|
251
|
+
|
|
252
|
+
2. Run the unit tests.
|
|
253
|
+
|
|
254
|
+
``` bash
|
|
255
|
+
pytest tests
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
3. Tests configuration
|
|
259
|
+
|
|
260
|
+
Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test
|
|
261
|
+
iterations to detect memory leaks.
|
|
262
|
+
|
|
263
|
+
### Reporting an issue
|
|
264
|
+
|
|
265
|
+
Please attach the output of following information:
|
|
266
|
+
|
|
267
|
+
- version of `xmlsec`
|
|
268
|
+
- version of `libxmlsec1`
|
|
269
|
+
- version of `libxml2`
|
|
270
|
+
- output from the command
|
|
271
|
+
|
|
272
|
+
``` bash
|
|
273
|
+
pkg-config --cflags xmlsec1
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
Unless otherwise noted, all files contained within this project are
|
|
279
|
+
licensed under the MIT open source license. See the included `LICENSE`
|
|
280
|
+
file or visit [opensource.org](http://opensource.org/licenses/MIT) for
|
|
281
|
+
more information.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
xmlsec.cp315-win_amd64.pyd,sha256=l8DCoDs-PKmvVSpRHjRtKVSW0Z9Qy-LfDnJXxDxZUGk,5685248
|
|
2
|
+
xmlsec/__init__.pyi,sha256=6jz1xjqMiVMzkvfiq8An8wxOHYUgx4EIINaac63yuo4,3585
|
|
3
|
+
xmlsec/constants.pyi,sha256=TG1YhrnFaRwpdXfbPsUILS_8oNPer9gjDLAjDExNjYk,5097
|
|
4
|
+
xmlsec/py.typed,sha256=Bxa3A5IphUe3lrTfAq7zA9VqzyOpddaq32o-mnAQ0sA,64
|
|
5
|
+
xmlsec/template.pyi,sha256=tvlKhWjh-1qftl65omCWNwwSp4ItP5raAPghIj1AYFU,1969
|
|
6
|
+
xmlsec/tree.pyi,sha256=KTwWoFnf-XQjqlyBAmut5WEyjZd2P3Cs6Tvsw8A7DuA,704
|
|
7
|
+
xmlsec-1.3.18.dist-info/licenses/LICENSE,sha256=ff8PS7Wwne5bFvri6AEOsb42IEKWpnmQWCTPZVaLnwY,1099
|
|
8
|
+
xmlsec-1.3.18.dist-info/METADATA,sha256=U4vQz5CQBZWwIy14q10XOWwZMugUuoxRenLfLCNUJPY,8518
|
|
9
|
+
xmlsec-1.3.18.dist-info/WHEEL,sha256=0gLwYZa0C2fhgCxWR2c8HahwUiopqonVCV0wVwEg6fE,101
|
|
10
|
+
xmlsec-1.3.18.dist-info/top_level.txt,sha256=wMJ_ZeZ8UpcV61weMTdYG9hzzYWfyJ2Nf3fmZ4VNqwQ,7
|
|
11
|
+
xmlsec-1.3.18.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Ryan Leckey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is furnished
|
|
10
|
+
to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xmlsec
|
|
Binary file
|