XMLSEC error: "failed to load certificate"

XMLSEC error: "failed to load certificate"

我正在尝试在我的项目中使用 python-saml 工具包(或其中的部分代码),但我遇到了一些问题,我将尝试在这个问题中解决。在我的本地机器 (ubuntu 18.04) 中,我把所有东西都准备好了,运行 但是当我在 centOS 机器上安装它时,我遇到了几个问题。我正在使用(必须使用)的版本是 CentOS 6.8。我构建了我需要的所有 rpm 包(依赖项)并安装了它们。在 python-saml 代码的以下行中,我得到了错误 "failed to load certificate":

sign_key.loadCert(file_cert.name, xmlsec.KeyDataFormatCertPem)

此 loadCert 函数是 dm.xmlsec.binding 包的一部分。所以我检查了这个功能,就是这样:

def loadCert(self, char *filename, xmlSecKeyDataFormat key_data_format):
    """load certificate of *key_data_format* from *filename*."""
    cdef int rv
    with nogil:
        rv = xmlSecCryptoAppKeyCertLoad(self.key, filename, key_data_format)
    if rv < 0:
       raise Error("failed to load certificate", filename, rv)

嗯,我猜问题只能在"xmlSecCryptoAppKeyCertLoad",所以我检查了这个属于XMLSEC库的函数,定义为:

int xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
    if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad == NULL)) {
        xmlSecNotImplementedError("cryptoAppKeyCertLoad");
        return(-1);
    }

    return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad(key, filename, format));

}

函数 "loadCert" 的参数是正确的,正确的证书文件名和正确的格式。我在命令行中手动尝试了它,但我得到了同样的错误(仅在 centOS 机器中,在我的 Ubuntu 中一切正常)。

知道问题出在哪里吗?我将不得不以某种方式了解正在发生的事情,但如果有人能提供帮助那就太好了。

提前致谢!

对这个问题不重要,但以防万一对其他人有帮助,我在 red hat 机器上安装 dm.xmlsec.binding 时遇到问题,我通过按照 [=13] 中描述的构建包来解决它=],这意味着更新 /usr/bin/xmlsec1-config 文件以在“--cflags”中包含“-DXMLSEC_NO_SIZE_T”。

我通过从内存加载证书而不是从文件加载来解决它。不过,真的不知道为什么从文件加载在 centOS 6.8 中不起作用(或者对我不起作用)