forked from xmlsec/python-xmlsec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.pyx
More file actions
53 lines (38 loc) · 1.04 KB
/
utils.pyx
File metadata and controls
53 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
from .utils cimport *
__all__ = [
'init',
'shutdown',
'enable_debug_trace'
]
def init():
"""Initialize the library for general operation.
This is called upon library import and does not need to be called
again (unless @ref _shutdown is called explicitly).
"""
r = xmlSecInit()
if r != 0:
return False
r = xmlSecCryptoInit()
if r != 0:
return False
r = xmlSecCryptoAppInit(NULL)
if r != 0:
return False
return True
def shutdown():
"""Shutdown the library and cleanup any leftover resources.
This is called automatically upon interpreter termination and
should not need to be called explicitly.
"""
r = xmlSecCryptoAppShutdown()
if r != 0:
return False
r = xmlSecCryptoShutdown()
if r != 0:
return False
r = xmlSecShutdown()
return r == 0
def enable_debug_trace(flag):
xmlSecErrorsDefaultCallbackEnableOutput(<int>flag)