【发布时间】:2016-11-16 17:21:36
【问题描述】:
我正在尝试使用多个公钥加密一个文件,并使用文档中的相同语法,但它会引发以下错误。
错误信息
gpg : 用法:gpg [选项] --encrypt [文件名] 在行:10 字符:1 + gpg --encrypt \ --recipient "Sree" \ --recipient "Matam" \ "C:Reports\ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (用法: gpg [opt...rypt [filename]:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError
P.S:此加密是作为 powershell 脚本的一部分完成的
当我使用单个密钥加密时,它工作正常。有人能指出我做错了什么吗?
gpg --encrypt \ --recipient "Sree" \ --recipient "Matam" \ "C:\Reports\test_encryption.xlsx"
我用这个帖子来指导我,但看起来我错过了什么
【问题讨论】:
-
什么“低于错误”?
-
这两个用户将如何访问文件,您会提供自定义解密代码吗?
-
我可能不清楚。我很抱歉。我想用 2 个不同用户的公钥加密文件,以便每个人都可以用他/她自己的私钥解密它。通过 Kleopatra 可以实现,我们正在尝试通过 powershell 自动执行此手动任务。
-
试试:
gpg -r "Sree" -r "Matam" --encrypt C:\Reports\test_encryption.xlsx。这 1)places the options (-r/--recipient) before the command 和它 2)删除在 powershell 中不起作用的斜线 -
差不多了。谢谢你。终于可以使用这段代码
code$BeforeEncryptfilePathGPG = "C:\Reports\Test_Encryption.xlsx" $SignedOrEncryptedLoc = "C:\Reports\Test_Encryption.xlsx.gpg" gpg --output $SignedOrEncryptedLoc --always -trust --encrypt --recipient "Sreekar" --recipient "Matam" $BeforeEncryptfilePathGPGcode
标签: powershell encryption public-key-encryption gnupg encryption-asymmetric