Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, keysMngr=None, _obj=None):
"""
Creates element processing context. The caller is
responsible for destroying returned object by calling destroy method.
keysMngr : the keys manager.
Returns : newly context object or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.dsigCtxCreate(keysMngr)
if self._o is None: raise Error('xmlSecDSigCtxCreate() failed')
def __isprivate(self, name):
def findKey(self, name, key_info_ctx):
"""
Lookups key in the keys store.
name : the desired key name.
keyInfoCtx : the node processing context.
Returns : a key or None if key is not found or an error occurs.
"""
_obj = xmlsecmod.keyStoreFindKey(self, name, key_info_ctx)
if _obj is None: raise Error('xmlSecKeyStoreFindKey() failed')
return Key(_obj=_obj)
def __init__(self, _obj=None):
"""
Creates new keys manager. Caller is responsible for freeing it with
destroy method.
Returns : the newly keys manager or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.keysMngrCreate()
if self._o is None: raise Error('xmlSecKeysMngrCreate() failed')
def __isprivate(self, name):
def __init__(self, size=None, _obj=None):
"""
Creates and initalizes new memory buffer with given size. Caller is
responsible for calling destroy method to free the buffer.
size : the initial buffer size.
Returns : the buffer or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.bufferCreate(size)
if self._o is None: raise Error('xmlSecBufferCreate() failed')
def __isprivate(self, name):
def __init__(self, _obj=None):
"""
Creates new transform of the id klass. The caller is responsible for
destroying returned tansform using destroy method.
id : the transform id to create.
Returns : newly created transform or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.transformCreate()
if self._o is None: raise Error('xmlSecTransformCreate() failed')
def destroy(self):
def addKeyName(self, name=None):
"""
Adds node to the node.
name : the key name (optional).
Returns : the newly created node or None
if an error occurs.
"""
_obj = xmlsecmod.tmplKeyInfoAddKeyName(self, name)
if _obj is None:
raise Error('xmlSecTmplKeyInfoAddKeyName() failed')
return libxml2.xmlNode(_obj=_obj)
def addKeyValue(self):
def __init__(self, dsigCtx=None, origin=None, _obj=None):
"""
Creates new element processing context. Caller is
responsible for destroying the returned context by calling destroy
method.
dsigCtx : the parent node processing context.
origin : the reference origin ( or node).
Returns : newly created context or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.dsigReferenceCtxCreate(dsigCtx, origin)
if self._o is None: raise Error('xmlSecDSigReferenceCtxCreate() failed')
def __isprivate(self, name):
def cryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx):
"""
Reads key and all associated certificates from the PKCS12 file.
For uniformity, call cryptoAppKeyLoad instead of this function.
Pass in format=xmlsec.KeyDataFormatPkcs12.
filename : the PKCS12 key filename.
pwd : the PKCS12 file password.
pwdCallback : the password callback.
pwdCallbackCtx : the user context for password callback.
Returns : the key or None if an error occurs.
"""
ret = xmlsecmod.cryptoAppPkcs12Load(filename, pwd,
pwdCallback, pwdCallbackCtx)
if ret is None: raise Error('xmlSecCryptoAppKeyLoad() failed')
return Key(_obj=ret)
def cryptoAppKeyCertLoad(key, filename, format):
def getSignMethodNode(self):
"""
Gets child of node.
Returns : node or None if an error occurs.
"""
_obj = xmlsecmod.tmplSignatureGetSignMethodNode(self)
if _obj is None:
raise Error('xmlSecTmplSignatureGetSignMethodNode() failed')
return libxml2.xmlNode(_obj=_obj)
def getC14NMethodNode(self):
def __init__(self, _obj=None):
"""
Creates transforms chain processing context. The caller is responsible
for destroying returned object by calling destroy method.
Returns : newly context object or None if an error occurs.
"""
if _obj != None:
self._o = _obj
return
self._o = xmlsecmod.transformCtxCreate()
if self._o is None: raise Error('xmlSecTransformCtxCreate() failed')
def destroy(self):