如何以程序方式解密PGP自解密存档? [英] How can I decrypt a PGP Self Decrypting Archive programatically?

查看:1054
本文介绍了如何以程序方式解密PGP自解密存档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每天我收到我有密码短语的SDA文件。解密是通过运行文件并手动在弹出的程序窗口中输入密码来完成的。我想避免这个手动步骤,并将其变成自动化过程的一个步骤。



这种方式的工作方式如下:
As很快,当我的守护进程检测到一个新文件已经到达我的收件箱,我的程序将下载,解密和保存它。我知道如何用代码做所有这些,除了解密部分。



而不是运行.exe文件,并手动输入密码,我想读它的内容,并用密码短语解密其中包含的数据,其格式如下:

  4d5a 9000 0300 0000 0400 0000 ffff 0000 
b800 0000 0000 0000 4000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 f000 0000
0e1f ba0e 00b4 09cd 21b8 014c cd21 5468
... etc

我目前使用的语言是PHP,

解决方案

任何语言的实现都会有帮助。



< > PGP自解密存档是这个文件里面的EXE stub + PGP消息。您应该解析EXE头,并找到存储此数据的位置,解压缩,然后使用GnuPG或任何其他PGP库解密。


Everyday I receive SDA files for whom I have the passphrase. The decryption is done by running the file and manually entering a passphrase in the program window that pops up. I'd like to avoid this manual step, and turn it into a step of an automated process.

The way this would work is the following: As soon as my daemon detects that a new file has arrived to my inbox, my program would download, decrypt and save it. I know how to do all these with code, except the decryption part.

Instead of running the .exe file, and manually entering the passphrase, I want to read it's contents, and with the passphrase, decrypt the data contained within it, which looks like this:

4d5a 9000 0300 0000 0400 0000 ffff 0000
b800 0000 0000 0000 4000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 f000 0000
0e1f ba0e 00b4 09cd 21b8 014c cd21 5468
...etc

The language I'm currently using is PHP, but taking a look at an implementation in any language will help.

Any ideas?

解决方案

PGP self-decrypting archives is just EXE stub + PGP message inside of this file. You should parse EXE headers, and found where this data is stored, extract it, and decrypt using GnuPG or any other PGP library.

这篇关于如何以程序方式解密PGP自解密存档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆