在macOS上使用xmlsec1时出现”KEY-NOT-FOUND”错误。

huangapple go评论119阅读模式
英文:

Getting "KEY-NOT-FOUND" with xmlsec1 on macos

问题

我的尝试在MacOS上使用xmlsec1对一个简单的XML文档进行签名失败,原因如下:

$ xmlsec1 --sign --output doc-signed.xml --privkey-pem keysncerts/userkey.pem doc.xml
Enter password for "keysncerts/userkey.pem" 文件:
Signature status: FAILED
Failure reason: KEY-NOT-FOUND
Error: failed to sign file "doc.xml"

这个示例密钥和XML文档直接来自于这个教程。这个示例在RedHat Linux和Windows上可以工作,但在MacOS上失败。我尝试过在Big Sur/x86和Ventura/M1上都尝试过这个问题。

我使用brew安装了xmlsec:

brew install xmlsec1

尽管出现错误消息,但我相信密钥已经找到,因为在其他平台上可以成功签名相同的密钥/XML,并且因为提示输入密钥文件的密码。我还尝试过在本地使用brew安装的openssl生成公钥/私钥对,但签名仍然由于相同的原因失败。

英文:

My attempt to sign a simple XML document with xmlsec1 is failing on MacOS due to:

$ xmlsec1 --sign --output doc-signed.xml --privkey-pem keysncerts/userkey.pem doc.xml
Enter password for "keysncerts/userkey.pem" file:
Signature status: FAILED
Failure reason: KEY-NOT-FOUND
Error: failed to sign file "doc.xml"

The example key and xml document are taken directory from this Tutorial. This example works on RedHat Linux and Windows, but fails on MacOS. I have tried this with both Big Sur/x86 and Ventura/M1.

I used brew to install xmlsec:

brew install xmlsec1

Despite the error message, I am confident the key is found because same key/xml are signed successfully on other platforms, and because of the prompt for password on the key file. I have also tried locally generating a public/private key pair with a brew installed version of openssl, but signing still fails for the same reason.

答案1

得分: 1

我找到了一个与最近对libxmlsec的更新有关的解决方案,该更新影响了macos上的pip安装。这个python-xmlsec问题有不同的症状。但解决方案是使用之前已知可工作的libxmlsec版本1.2.37进行brew安装。

我按照他们提供的解决方法进行了操作。现在运行命令'xmlsec1 --sign --output doc-signed.xml --privkey-pem keysncerts/userkey.pem doc.xml'已成功完成。此外,来自Python的xmlsec调用也正常工作。

一旦修复部署完成,我建议再次重新安装最新的brew版本。

英文:

I found a solution related to a recent update to libxmlsec that impacted pip installations on macos. This python-xmlsec issue has different symptoms. But the solution is a brew install with the previous known working libxmlsec version 1.2.37.

I followed the work around instructions they provided. Now running the command 'xmlsec1 --sign --output doc-signed.xml --privkey-pem keysncerts/userkey.pem doc.xml' completes successfully. Additional, xmlsec calls from python are working as well.

Once the fix is deployed, I'd recommend reinstalling the latest brew version again.

huangapple
  • 本文由 发表于 2023年7月31日 23:42:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76805174.html
  • xmlsec1
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定