暗号化および署名されたメッセージを署名済みPGPメッセージに変換する

暗号化および署名されたメッセージを署名済みPGPメッセージに変換する

BobがAliceから自分の公開鍵で暗号化され、秘密鍵で署名されたメッセージを受け取ったとしましょう。今、彼はチャーリーから同じメッセージを受け取ったことをチャーリーに証明したいと思います。このメッセージはを介して生成されましたgpg --sign --encrypt

私の考えは、彼がメッセージを解読し、メッセージと署名をどこかに保存できることです。ただし、これを達成する方法が見つかりません。しかし、GPGはメッセージに署名して暗号化するので、これは少なくとも理論的には可能です。

今彼はどのようにしていますか?それとも別のアイデアがありますか? BobはCharlieにメッセージが本当であることをどのように証明しますか?

限界:

  • Charlie Bobに秘密鍵を提供することは(明らかに)オプションではありません。
  • コミュニケーションは電子メールでのみ可能です。
  • Aliceに連絡できなくなったため、メッセージが再送信されたり、CharlieとAliceが互いに通信できなくなります。ご飯は自分が持っているもので働かなければなりませんでした。

ベストアンサー1

これは見つけるのが難しいです。ローカルではありませんman gpg

注文する:

gpg -vi    --unwrap  msg1.gpg 

-v冗長で-iインタラクティブで、ファイルを上書きしないことを意味します。)

警告:時には出力を解凍する必要があります(?)。

文書: https://gnupg.org/documentation/manuals/gnupg.pdf

--unwrap This command is similar to ‘--decrypt’ with the difference that the output
is not the usual plaintext but the original message with the encryption layer
removed. Thus the output will be an OpenPGP data structure which often
means a signed OpenPGP message. Note that this option may or may not
remove a compression layer which is often found beneath the encryption layer.

テスト済み(Ubuntuで、2023年8月に更新)

### Alice(=testS) signed a message and encrypted it
### using Bobs(=test) public key. -r means --recipient

[0] $ echo A message to be signed a sent > message
[0] $ gpg  -u testS  -r test    --sign --encrypt  message 

 ## Alice sent  message.gpg  to Bob

[0] $ gpg -vi    --unwrap  message.gpg    # --output ...
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: public key is 3DF37C69945F312D
gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4
gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4
gpg: encrypted with 3072-bit RSA key, ID 3DF37C69945F312D, created 2023-08-29
      "TEST TE <[email protected]>"
gpg: AES256 encrypted data
File 'message' exists. Overwrite? (y/N) n
Enter new filename: message-only-singed.gpg

## Bob sends "unwrapped" (=deciphered) file   message-only-signed.php
## to Charlie
 
[0] $ gpg -d  message-only-singed.gpg      
A message to be signed a sent               <---- The message
gpg: Signature made Tue 29 Aug 2023 22:55:11 CEST
gpg:                using RSA key 6646102A06EC96A49AE8828FCDF0F02D337492DD
gpg:                issuer "[email protected]"
gpg: Good signature from "tests <[email protected]>" [ultimate]   <---- the sig

### Charlie sees that  Alice=testS    signed the message
 

(最後のコマンドはと一緒に使用できます--output file。)

おすすめ記事