尝试在命令行中使用 XmlSec 对 XML 进行签名,不断得到"missing file errors"?



无论我使用哪个命令顺序,我总是得到类似的错误消息:

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,但它是可选的。这可能不是你想要的。

最新更新