当前位置: 首页>>代码示例>>Python>>正文


Python xmlsec.cryptoAppShutdown函数代码示例

本文整理汇总了Python中xmlsec.cryptoAppShutdown函数的典型用法代码示例。如果您正苦于以下问题:Python cryptoAppShutdown函数的具体用法?Python cryptoAppShutdown怎么用?Python cryptoAppShutdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cryptoAppShutdown函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: received

def received(self, context):
    self.poruka_odgovor = context.reply
 
    libxml2.initParser()
    libxml2.substituteEntitiesDefault(1)
 
    xmlsec.init()
    xmlsec.cryptoAppInit(None)
    xmlsec.cryptoInit()
 
    mngr = xmlsec.KeysMngr()
    xmlsec.cryptoAppDefaultKeysMngrInit(mngr)
    #mngr.certLoad(verifyCertFile, xmlsec.KeyDataFormatPem, xmlsec.KeyDataTypeTrusted)
    mngr.certLoad(certFile, xmlsec.KeyDataFormatPem, xmlsec.KeyDataTypeTrusted)
  
    doc = libxml2.parseDoc(context.reply)
    xmlsec.addIDs(doc, doc.getRootElement(), ['Id'])
    node = xmlsec.findNode(doc.getRootElement(), xmlsec.NodeSignature, xmlsec.DSigNs)
    dsig_ctx = xmlsec.DSigCtx(mngr)
    dsig_ctx.verify(node)
    if(dsig_ctx.status == xmlsec.DSigStatusSucceeded): self.valid_signature = 1
 
    xmlsec.cryptoShutdown()
    xmlsec.cryptoAppShutdown()
    xmlsec.shutdown()
    libxml2.cleanupParser()
    return context
开发者ID:jerko,项目名称:fiskal_v70,代码行数:27,代码来源:fiskal.py

示例2: cleanup

 def cleanup():
     # Shutdown xmlsec-crypto library
     xmlsec.cryptoShutdown()
     # Shutdown crypto library
     xmlsec.cryptoAppShutdown()
     # Shutdown xmlsec library
     xmlsec.shutdown()
     # Shutdown LibXML2
     libxml2.cleanupParser()
开发者ID:jotaylor,项目名称:cos_monitoring,代码行数:9,代码来源:SignStsciRequest.py

示例3: main

def main():
    assert(sys.argv)
    if len(sys.argv) < 3:
        print "Error: wrong number of arguments."
        print "Usage: %s <xml-file> <key-file1> [<key-file2> [...]]" % sys.argv[0]
        return sys.exit(1)
    
    # Init libxml library
    libxml2.initParser()
    libxml2.substituteEntitiesDefault(1)

    # Init xmlsec library
    if xmlsec.init() < 0:
        print "Error: xmlsec initialization failed."
        return sys.exit(-1)
    
    # Check loaded library version
    if xmlsec.checkVersion() != 1:
	print "Error: loaded xmlsec library version is not compatible.\n"
	sys.exit(-1)

    # Init crypto library
    if xmlsec.cryptoAppInit(None) < 0:
        print "Error: crypto initialization failed."
    
    # Init xmlsec-crypto library
    if xmlsec.cryptoInit() < 0:
        print "Error: xmlsec-crypto initialization failed."

    # Create keys manager and load keys
    mngr = load_keys(sys.argv[2:], len(sys.argv) - 2)

    res = 0
    # Verify file
    if mngr is not None:
        res = verify_file(mngr, sys.argv[1])
        # Destroy keys manager
        mngr.destroy()
    
    # Shutdown xmlsec-crypto library
    xmlsec.cryptoShutdown()

    # Shutdown crypto library
    xmlsec.cryptoAppShutdown()

    # Shutdown xmlsec library
    xmlsec.shutdown()

    # Shutdown LibXML2
    libxml2.cleanupParser()

    sys.exit(res)
开发者ID:artur-kacen,项目名称:pyxmlsec,代码行数:52,代码来源:verify2.py

示例4: close

 def close(self):
     self.logging.debug("Shuttind crypto engine down")
     # Shutdown xmlsec-crypto library
     xmlsec.cryptoShutdown()
     
     # Shutdown crypto library
     xmlsec.cryptoAppShutdown()
     
     # Shutdown xmlsec library
     xmlsec.shutdown()
     
     # Shutdown LibXML2
     libxml2.cleanupParser()
开发者ID:nesl,项目名称:esp,代码行数:13,代码来源:espsec.py

示例5: main

def main():
    assert(sys.argv)
    if len(sys.argv) != 2:
        print "Error: wrong number of arguments."
        print "Usage: %s <enc-file>" % sys.argv[0]
        return sys.exit(1)
    
    res = 0
    # Init libxml library
    libxml2.initParser()
    libxml2.substituteEntitiesDefault(1)

    # Init xmlsec library
    if xmlsec.init() < 0:
        print "Error: xmlsec initialization failed."
        return sys.exit(-1)
    
    # Check loaded library version
    if xmlsec.checkVersion() != 1:
	print "Error: loaded xmlsec library version is not compatible."
	sys.exit(-1)

    # Init crypto library
    if xmlsec.cryptoAppInit(None) < 0:
        print "Error: crypto initialization failed."
    
    # Init xmlsec-crypto library
    if xmlsec.cryptoInit() < 0:
        print "Error: xmlsec-crypto initialization failed."

    # Create keys manager and load keys */
    mngr = create_files_keys_mngr()

    if mngr is not None:
        res = decrypt_file(mngr, sys.argv[1])

    # Shutdown xmlsec-crypto library
    xmlsec.cryptoShutdown()

    # Shutdown crypto library
    xmlsec.cryptoAppShutdown()

    # Shutdown xmlsec library
    xmlsec.shutdown()

    # Shutdown LibXML2
    libxml2.cleanupParser()

    sys.exit(res)
开发者ID:dnet,项目名称:pyxmlsec,代码行数:49,代码来源:decrypt3.py

示例6: shutdown_xmlsec

    def shutdown_xmlsec(self):
        
        if not self._init_xmlsec:
            return 

        # Shutdown xmlsec-crypto library
        xmlsec.cryptoShutdown()

        # Shutdown crypto library
        xmlsec.cryptoAppShutdown()

        # Shutdown xmlsec library
        xmlsec.shutdown()

        # Shutdown LibXML2
        libxml2.cleanupParser()
开发者ID:galacticsurfer,项目名称:pyAadhaarAuth,代码行数:16,代码来源:signature.py

示例7: _desativar_funcoes_criptograficas

 def _desativar_funcoes_criptograficas(self):
     ''' Desativa as funções criptográficas e de análise XML
     As funções devem ser chamadas aproximadamente na ordem inversa da ativação
     '''
     
     # Shutdown xmlsec-crypto library
     xmlsec.cryptoShutdown()
     
     # Shutdown crypto library
     xmlsec.cryptoAppShutdown()
     
     # Shutdown xmlsec library
     xmlsec.shutdown()
     
     # Shutdown LibXML2 FIXME: descobrir forma de evitar o uso do libxml2 neste processo
     libxml2.cleanupParser()
开发者ID:danielgoncalves,项目名称:PyNFe,代码行数:16,代码来源:assinatura.py

示例8: main

def main():
    secret_data = "Big secret"

    assert(sys.argv)
    if len(sys.argv) < 3:
        print "Error: wrong number of arguments."
        print "Usage: %s <xml-tmpl> <des-key-file>" % sys.argv[0]
        return sys.exit(1)
    
    # Init libxml library
    libxml2.initParser()
    libxml2.substituteEntitiesDefault(1)

    # Init xmlsec library
    if xmlsec.init() < 0:
        print "Error: xmlsec initialization failed."
        return sys.exit(-1)
    
    # Check loaded library version
    if xmlsec.checkVersion() != 1:
	print "Error: loaded xmlsec library version is not compatible.\n"
	sys.exit(-1)

    # Init crypto library
    if xmlsec.cryptoAppInit(None) < 0:
        print "Error: crypto initialization failed."
    
    # Init xmlsec-crypto library
    if xmlsec.cryptoInit() < 0:
        print "Error: xmlsec-crypto initialization failed."

    res = encrypt_file(sys.argv[1], sys.argv[2], secret_data, len(secret_data))

    # Shutdown xmlsec-crypto library
    xmlsec.cryptoShutdown()

    # Shutdown crypto library
    xmlsec.cryptoAppShutdown()

    # Shutdown xmlsec library
    xmlsec.shutdown()

    # Shutdown LibXML2
    libxml2.cleanupParser()

    sys.exit(res)
开发者ID:artur-kacen,项目名称:pyxmlsec,代码行数:46,代码来源:encrypt1.py

示例9: _finalizar_cripto

    def _finalizar_cripto(self):
        xmlsec.cryptoShutdown()
        xmlsec.cryptoAppShutdown()
        xmlsec.shutdown()

        libxml2.cleanupParser()
开发者ID:danimaribeiro,项目名称:PyTrustNFe,代码行数:6,代码来源:assinatura.py

示例10:

from __future__ import division, print_function, unicode_literals

import libxml2
import xmlsec
import os

DIRNAME = os.path.dirname(__file__)


if __name__ == u'__main__':
    certificados = os.listdir(DIRNAME + 'certificados')
    certificados.sort()  # ?????

    # Ativa as funções da API de criptografia
    xmlsec.init()
    xmlsec.cryptoAppInit(None)
    xmlsec.cryptoInit()

    #
    # Prepara o gerenciador dos certificados confiáveis
    #
    certificados_confiaveis = xmlsec.KeysMngr()
    xmlsec.cryptoAppDefaultKeysMngrInit(certificados_confiaveis)

    for certificado in certificados:
        certificados_confiaveis.certLoad(filename=str(DIRNAME + 'certificados/' + certificado), format=xmlsec.KeyDataFormatPem, type=xmlsec.KeyDataTypeTrusted)

    xmlsec.cryptoShutdown()
    xmlsec.cryptoAppShutdown()
    xmlsec.shutdown()
开发者ID:crsilveira,项目名称:PySPED-Tools,代码行数:30,代码来源:testa-carga-certificados.py

示例11: deinit_xmlsec

def deinit_xmlsec():
    xmlsec.cryptoShutdown()
    xmlsec.cryptoAppShutdown()
    xmlsec.shutdown()
    libxml2.cleanupParser()
开发者ID:Se7ge,项目名称:SudsSigner,代码行数:5,代码来源:xmlsec_wrapper.py


注:本文中的xmlsec.cryptoAppShutdown函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。