xml - 尝试在命令行中使用 XmlSec 对 XML 进行签名,不断收到“丢失文件错误”?
问题描述
无论我使用哪种命令顺序,我都会不断收到类似的错误消息:
和
xmlsec --sign --output signedfile.xml --pkcs FISKAL.p12 --pwd Password --trusted-pem root_ca.pem --id-attr:Id file.xml
我明白了
Error: ⟨file⟩ parameter is required for this command
如果我尝试
xmlsec --sign --id-attr:Id --pkcs FISKAL.p12 --pwd Password --trusted-pem root_ca.pem --output signedfile.xml file.xml
我明白了
Error: filename is expected instead of parameter "--pwd".
Error: invalid parameters
在这种情况下
xmlsec --sign --output signedfile.xml --id-attr:Id --trusted-pem root_ca.pem --pkcs FISKAL.p12 --pwd Password file.xml
它是相似的:
Error: filename is expected instead of parameter "--pkcs12".
Error: invalid parameters
每条错误消息下方是一行:Usage: xmlsec ⟨command⟩ [⟨options⟩] [⟨files⟩]
为什么 xmlsec 一直认为我缺少文件?我究竟做错了什么?
解决方案
您的--id-attr:Id
参数不完整。要么删除它,要么你需要像这样指定它:
--id-attr[:<attr-name>] [<node-namespace-uri>:]<node-name>
adds attributes <attr-name> (default value "id") from all nodes
with<node-name> and namespace <node-namespace-uri> to the list
of known ID attributes; this is a hack and if you can use DTD or
schema to declare ID attributes instead (see "--dtd-file"
option), I don't know what else might be broken in your applica‐
tion when you use this hack
node-name
您需要指定,因为它不是可选的。您确实指定attr-name
了,但它是可选的。这可能不是你想要的。
推荐阅读
- c++ - 来自三个 XYZ 向量的 vtkStructuredGrid 的 VTK C++ 设置点
- react-router - 如何在反应路由器中加载进入下一个路由之前避免闪烁?
- python - Python:检查最后一个字符串的函数
- android - Android ClassCastException同时在另一个片段中实现TimePickerDialog.OnTimeSetListener接口的onTimeSet方法
- javascript - 如何在javascript函数中为参数的特定默认值设置值
- mysql - minikube部署mysql失败...镜像拉取失败..ubuntu环境
- azure-functions - 如何独立使用存储帐户名称和容器名称环境
- c# - 统一生成一个空的tilemap
- unit-testing - Clojure.spec:基于生成器中其他字段的字段存在
- javascript - 之前检查的未定义值的 TypeScript 错误