【问题标题】:gpg encrypted files are not listed in the directorygpg 加密文件不在目录中
【发布时间】:2021-02-03 18:29:30
【问题描述】:

我有一个用 VB.net 编写的 Windows 服务,该服务将读取一些 XML 文件并创建 gpg 加密文件。下面是实现它的代码

 Dim OutputFileWithPath As String = outputFolder + "\" + xmlFile.Name + ".gpg"

                            Dim gpgExecutable As String = getAppSetting("GnuPGLocation") + "gpg"
                            Dim gpgOptions As String = " --recipient " +
                                getAppSetting("Recipient") + " --output """ +
                                OutputFileWithPath + """" + " --encrypt """ +
                                inputFolder + "\" + xmlFile.Name + """"
                           

                            Dim pInfo As ProcessStartInfo = New ProcessStartInfo(gpgExecutable, gpgOptions)
                            pInfo.CreateNoWindow = True
                            pInfo.UseShellExecute = False
                            pInfo.WindowStyle = ProcessWindowStyle.Hidden
                            _processObject = Process.Start(pInfo)
                            _processObject.WaitForExit()
                           
                           

程序执行后,当我尝试查看输出文件夹时,我什么也看不到。但是当我运行相同的命令时,它会询问文件已经存在是否要覆盖。当我执行与控制台应用程序相同的代码时,它工作正常。但是当我将它作为 Windows 服务运行时,我遇到了这个问题。但是相同的命令适用于 D: 驱动器作为输出文件夹。文件夹的权限会不会有问题?

【问题讨论】:

  • 你确定outputFolder的值是你想要的吗?运行该服务的用户帐户是否对该目录具有写入权限?

标签: vb.net process gnupg


【解决方案1】:

问题是因为用于运行WindowsService的用户帐户,如果我们使用配置了私钥和公钥的用户ID运行它,它就可以工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-17
    • 1970-01-01
    相关资源
    最近更新 更多