2013-02-17 153 views
1

我正在爲我的計算機安全類實驗室工作,並且有一個步驟給我帶來了問題。 Here is the assignment.And here is all the work I've done up until step 11.這是第11步,我有麻煩。使用gpg對加密密鑰進行數字簽名

11. Use gpg and your own private RSA key to digitally sign aes.key.asc. 
Digital signature must be appendedto cipher and stored in 
key_signed.txt 

的問題是,當我做下面的命令

gpg --sign -o key_signed.txt -a aes.key.asc 

預期輸出(通過分配):

Example output

我的輸出,而不是像這樣:

[email protected]:~/lab2# cat key_signed.txt 
-----BEGIN PGP MESSAGE----- 
Version: GnuPG v1.4.10 (GNU/Linux) 

owFl0l2I2wQAwPFe9+Vy3Hanc2woszsO3cy8Num37IZpkyZpk7Rp2iatTEibz/ba 
pvlo0p4OPEFxgpuCHPOEMbhDkfPpThHFKQhyE5FxB3ObIuhAwSETwcncPcgGPvl/ 
/D//zo5t8/lH4PXKpjC8NDHygX+zPirK1nRLHkyLVoM9PD7x1L1SGE4ygQJeCNAY 
xyE4dv8CFdm09G7n6QDecQp4oA9NR6ahUOAIzpSDlN5xvKMAoLEYjUQwgjW8Dl63 
2girgLSjiyasQSEQUnSGBHNEYqBKBJ5xgyittmIxMdEX23aCK5YloNVqZgwiVnXp 
nleudpOFrKOS4VmIAbNxvu+CTFQcGGXHLcj1aDHJtsR62KONBKVGzY6DWgYwSFCR 
uqJ4kmIQ5CxPihZkcbJcEKJIsiLhrWK3LIAVZ5bvcnCiojIFOS/YkZQDd6l0xaiF 
AJPCa5moZTWUVh9EaDetxtksbVJOJIFDZFvkbQKuZodSpFHKMPVKFgqlzSZKpXXZ 
hijdsoEUVBOdODzMDVuxZqqDgVXdrYZ4zgkyTtMjI/WiiQsuR9swGs6jVC1YcglW 
iIN2123CBaoKDHGP08iYgqkVXO0FkyBaqeFVsdELSyZLx3FKJfJ2wyCwZK6PyIZc 
6pNefRaV0STSaAvlPpAv6kok35cLhBbSLTyL5aSEW7ZKDlwqixk8Ey+FwJzsdvRY 
z2W6GI9ZEgGl9W4KroXUeNYBOnqeSGQHHDvweIblgskcj1JlIYkh6aHhSEKe0ayB 
Ggl3zKGRSGl9WshRIS9sRxOOqeUlDUhKStNCLC3DGgOpQbZcNzhsm66d4mu2WeUb 
sbYiK4UQBUVdEu1JmIDnpbAdVqP5ZtGtZcKAKkV4LRuuVsoUJzAQnCNls+jOzAAz 
PbeiAvdFYgz6f6Wvjjy63Tfi9+3c4b8H2gfsHv9PPLZ3192drXNfn159e+fa+cdO 
oSs/TI59863/l5W1z5bPPOfLH/yyCh64sfsvjZDetc+uDVen9p67dmHsqruAXXy/ 
5d9YKl7fton8+NF+y395Abk7svLV+WOfcovro0tHkat7tr7nrh8XPpw7+Ru0n89d 
GEy99dON5uLnD792wtq6CF+7/Ypve+DI7BP2k7fihQcu828i1M2lE3Ppv/Hl9V2/ 
v+A486t3rpxS3qBPxzKPHN/x5+O+Q/b8sfk2v3HTe+ZSe9+tZw+vPr+nKLz8xZVD 
L0rguL61oB+gJhdHT05MDt+5/c/PzYD2qzX+EsPpZ6b8370+t5x+sM7MPPTenU82 
Ph4N7ftj/OBCBP0X 
=ZfM8 
-----END PGP MESSAGE----- 

我想我只需要使用>>流重定向操作符,簽名附加到我曾嘗試不會導致一些與

-----BEGIN PGP SIGNATURE----- 

開始怎樣做才能得到預期的輸出加密,但一切?

回答

2

看着你的預期輸出,儘可能接近我可以告訴任務是要求你「清除簽名」的加密文件。因此,嘗試這個命令:

gpg --clearsign -o key_signed.txt aes.key.asc 

我發現this pretty good reference可能會有所幫助。如果您進行網絡搜索,還有許多其他功能可用。

+0

謝謝你這麼多 – 2013-02-17 23:16:04

+1

哦,只要意識到你幾秒更快。 :)'-a'不是必需的,'--clearsign'總是給ascii輸出。 – 2013-02-17 23:19:37

+0

@JensErat很好。另一個我的「剪切粘貼」鬆散的案例。我會修改。 – BellevueBob 2013-02-17 23:21:50

2

看看GnuPG的--clearsign標誌。從手冊頁:

--clearsign 
      Make a clear text signature. The content in a clear text signature is read- 
      able without any special software. OpenPGP software is only needed to verify 
      the signature. Clear text signatures may modify end-of-line whitespace for 
      platform independence and are not intended to be reversible. The key to be 
      used for signing is chosen by default or can be set with the --local-user 
      and --default-key options. 

用它來獲得期望的輸出命令:

gpg --clearsign -o key_signed.txt aes.key.asc 
相關問題