Negotiating a secret for encryption in the global press

Forum rules
This forum is limited to topics relating to the game Diplomacy only. Other posts or topics will be relocated to the correct forum category or deleted. Please be respectful and follow our normal site rules at http://www.webdiplomacy.net/rules.php.

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:points: :-D :eyeroll: :neutral: :nmr: :razz: :raging: :-) ;) :( :sick: :o :? 8-) :x :shock: :lol: :cry: :evil: :?: :smirk: :!:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is OFF
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Expand view Topic review: Negotiating a secret for encryption in the global press

Re: Negotiating a secret for encryption in the global press

by kestasjk » Fri Sep 01, 2023 12:21 am

learnedSloth wrote:
Wed Aug 30, 2023 11:13 am
kestasjk wrote:
Wed Aug 30, 2023 1:57 am
learnedSloth wrote:
Sun Aug 27, 2023 6:59 pm
privacy trumps encryption when the former is available.
Hmm, did you get this the wrong way round? Or am I misunderstanding what you mean by privacy? If you mean "privacy" as guaranteed by a company / law / etc I'd say encryption trumps privacy.
I just compare the private channels in full press to encryption in public press. In the latter other players get some info of your correspondence, like message frequency and approximate message length unless you conceal it.

Of course you would prefer this method even in private press if you don't trust webDip to hide your private channels from other players. ;)
I see I see, you meant in the context of webDip.

Yeah encrypting messages send in a private message in webDip would be pretty paranoid on a few levels.. Our security record is almost perfect, and trust me it's not because we're not a target; the error logs have revealed targeted injection attempts and probes many times, and we've had bounty hunters / ethical hackers report (fairly minor) vulnerabilities which shows the code does get audited.

The only breach was back in the 0.7x ~2006-8 days when we were on shared hosting and the config file with the database passwords had permissions that meant they were exposed to other users on the server, so someone on the same server logged into the DB and set everyone's points to 999999.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Wed Aug 30, 2023 11:13 am

kestasjk wrote:
Wed Aug 30, 2023 1:57 am
learnedSloth wrote:
Sun Aug 27, 2023 6:59 pm
privacy trumps encryption when the former is available.
Hmm, did you get this the wrong way round? Or am I misunderstanding what you mean by privacy? If you mean "privacy" as guaranteed by a company / law / etc I'd say encryption trumps privacy.
I just compare the private channels in full press to encryption in public press. In the latter other players get some info of your correspondence, like message frequency and approximate message length unless you conceal it.

Of course you would prefer this method even in private press if you don't trust webDip to hide your private channels from other players. ;)

Re: Negotiating a secret for encryption in the global press

by kestasjk » Wed Aug 30, 2023 1:57 am

learnedSloth wrote:
Sun Aug 27, 2023 6:59 pm
privacy trumps encryption when the former is available.
Hmm, did you get this the wrong way round? Or am I misunderstanding what you mean by privacy? If you mean "privacy" as guaranteed by a company / law / etc I'd say encryption trumps privacy.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Sun Aug 27, 2023 6:59 pm

kestasjk wrote:
Sat Aug 26, 2023 9:28 am
I definitely agree using this method is equivalent to private press. It's a very neat trick, but it's using cryptography to work around the game rules, and if the rule of the game is "public press" using these techniques violates that and effectively makes it private press, using some very clever cryptographic techniques
This grew from a smirky remark to the challenge put forth in
dkarcher wrote:
Sun May 14, 2023 2:54 pm
Can you too convey secret messages to a target player in a public forum?
However I do believe that cryptography adds a new dimension that just doesn't exist in private press, because privacy trumps encryption when the former is available.

Knowing that the peer could just reveal the discussion to the enemy probably makes you more careful, and possibly also affects the choices you make in the game. Seeing the encrypted correspondence of other players might also suggest that they are plotting against you. Someone could even find a way to carry out rubber-hose cryptanalysis on the board.

Re: Negotiating a secret for encryption in the global press

by kestasjk » Sat Aug 26, 2023 9:28 am

I definitely agree using this method is equivalent to private press. It's a very neat trick, but it's using cryptography to work around the game rules, and if the rule of the game is "public press" using these techniques violates that and effectively makes it private press, using some very clever cryptographic techniques
Hominidae wrote:
Mon Aug 21, 2023 3:58 pm
I'm confused: how does one message some players but not other players using this method?
That's the magic of public key crytography: It's as if you have a padlock that can be copied and pasted, that you can share with anyone, and only you have the key to that padlock. You can share the padlock with whoever you want, and anyone can use that padlock to write a message, put it in a box, and use the padlock to lock it, and only you have the private key that unlocks the padlock

Re: Negotiating a secret for encryption in the global press

by Hominidae » Mon Aug 21, 2023 3:58 pm

I'm confused: how does one message some players but not other players using this method?

Re: Negotiating a secret for encryption in the global press

by gimix » Mon Aug 21, 2023 3:37 pm

captainmeme wrote:
Fri Aug 18, 2023 10:35 pm
Going to say here, from a kinda-mod perspective, this is a cool thought experiment but if you do it in a public press game (assuming I'm understanding this correctly), you are essentially communicating privately. If you join a PPO variant game everyone is going in expecting to play a variant in which private communication is banned - if you want to communicate privately, please just join a game where it's allowed instead of trying to introduce it in a variant where it's explicitly not permitted!

I like it as a thought experiment, and hell it could be fun to mess around with in a full press game just for amusement, but please don't do this in a public press only game.
I would go a bit further than @Captain: if you do it in a public press game someone will alert the mod team, you will be asked to stop, and if you don't stop you will be sanctioned and in the end probaly banned from the site.

I remember a Wilsonian game in which another player and me joked a bit with some obfuscated Perl code (Perl guys: we were making some JAPH's): we didn't exchange anything useful, just the name of the game or something like that, but the other players went understandably crazy about it and we had to explain a good deal to convince them we weren't cheating

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Mon Aug 21, 2023 2:08 am

jamesa7171 wrote:
Sun Aug 20, 2023 10:54 pm
learnedSloth wrote:
Sat Aug 19, 2023 8:38 pm
In normal full press you don't see when other players write messages to private press. Nor can you expose your private press to a 3rd player. You can copy/paste the discussion, but you could have copied it from anywhere.
Ok, fair enough, it's a game that is almost identical to a normal full press game, with lots of extra steps. Either way, it's nowhere near the current experience of a public press game.
The current experience of a public press game is different, because apparently no player thought that agreeing to a strong secret in the public press would be possible. :smirk:
Also, doesn't that second distinction mean people would be using this in full press games too (for at least some of their messages)? If you send a "normal" private message you can't expose it to a 3rd player, but if you send a "global" private message then you can, which is strictly better except in the case where you don't want people to know that you've sent anything at all.
An alliance of more than 2 might prefer a common encryption method over private press to help keep all members updated. It however won't stop a member from plotting against the alliance in private press.

You seem to forget the possibility of betraying trust by revealing your encrypted discussion to a 3rd player without telling the peer.

Re: Negotiating a secret for encryption in the global press

by jamesa7171 » Sun Aug 20, 2023 10:54 pm

learnedSloth wrote:
Sat Aug 19, 2023 8:38 pm
jamesa7171 wrote:
Sat Aug 19, 2023 8:14 pm
b) every player is using this technique, in which case you are just playing a normal full press game with lots of extra steps
In normal full press you don't see when other players write messages to private press. Nor can you expose your private press to a 3rd player. You can copy/paste the discussion, but you could have copied it from anywhere.
Ok, fair enough, it's a game that is almost identical to a normal full press game, with lots of extra steps. Either way, it's nowhere near the current experience of a public press game.

Also, doesn't that second distinction mean people would be using this in full press games too (for at least some of their messages)? If you send a "normal" private message you can't expose it to a 3rd player, but if you send a "global" private message then you can, which is strictly better except in the case where you don't want people to know that you've sent anything at all.

That one seems much less important, but at the same time it could eventually mean no escaping this in any press game of any kind.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Sat Aug 19, 2023 8:38 pm

jamesa7171 wrote:
Sat Aug 19, 2023 8:14 pm
b) every player is using this technique, in which case you are just playing a normal full press game with lots of extra steps
In normal full press you don't see when other players write messages to private press. Nor can you expose your private press to a 3rd player. You can copy/paste the discussion, but you could have copied it from anywhere.

Re: Negotiating a secret for encryption in the global press

by jamesa7171 » Sat Aug 19, 2023 8:14 pm

If some players are using this technique in a public press game, then either

a) some other players are not using this technique, in which case those players will be at a significant disadvantage

b) every player is using this technique, in which case you are just playing a normal full press game with lots of extra steps

Either way it becomes impossible to have a public press game that is fair for all players. Therefore, no matter how cool this is on a technical level (and believe me it is very cool), it should be forbidden for use in games.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Sat Aug 19, 2023 11:56 am

captainmeme wrote:
Fri Aug 18, 2023 10:35 pm
Going to say here, from a kinda-mod perspective, this is a cool thought experiment but if you do it in a public press game (assuming I'm understanding this correctly), you are essentially communicating privately.
The messages are only encrypted, not hidden. Either player could easily prove their content to a 3rd player by revealing the key.
If you join a PPO variant game everyone is going in expecting to play a variant in which private communication is banned - if you want to communicate privately, please just join a game where it's allowed instead of trying to introduce it in a variant where it's explicitly not permitted!

I like it as a thought experiment, and hell it could be fun to mess around with in a full press game just for amusement, but please don't do this in a public press only game.
Sounds like fulfillment of
learnedSloth wrote:
Sun May 14, 2023 6:31 pm
Cryptography will undoubtedly give significant advantage to players that use it, so I anticipate that it will be either ubiquitous or banned. :smirk:
8-)

Re: Negotiating a secret for encryption in the global press

by JECE » Sat Aug 19, 2023 1:07 am

captainmeme wrote:
Fri Aug 18, 2023 10:35 pm
Going to say here, from a kinda-mod perspective, this is a cool thought experiment but if you do it in a public press game (assuming I'm understanding this correctly), you are essentially communicating privately. If you join a PPO variant game everyone is going in expecting to play a variant in which private communication is banned - if you want to communicate privately, please just join a game where it's allowed instead of trying to introduce it in a variant where it's explicitly not permitted!

I like it as a thought experiment, and hell it could be fun to mess around with in a full press game just for amusement, but please don't do this in a public press only game.
I think that the intent was to set up a private public press game where this was allowed.

Re: Negotiating a secret for encryption in the global press

by captainmeme » Fri Aug 18, 2023 10:35 pm

Going to say here, from a kinda-mod perspective, this is a cool thought experiment but if you do it in a public press game (assuming I'm understanding this correctly), you are essentially communicating privately. If you join a PPO variant game everyone is going in expecting to play a variant in which private communication is banned - if you want to communicate privately, please just join a game where it's allowed instead of trying to introduce it in a variant where it's explicitly not permitted!

I like it as a thought experiment, and hell it could be fun to mess around with in a full press game just for amusement, but please don't do this in a public press only game.

Re: Negotiating a secret for encryption in the global press

by Yigg » Fri Aug 18, 2023 6:46 pm

Image

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Thu Aug 17, 2023 7:59 pm

Attaching the makefile still fails, but you can cat > makefile and paste the contents below:

Code: Select all

my_confounded: my_secret
	openssl pkey -in $< -pubout -out $@
	cat $@ # Below this line

my_secret:
	openssl genpkey -algorithm X25519 -out $@

common_with_%: % my_secret
	openssl pkeyutl -derive -inkey my_secret -peerkey $< -out $@

key_with_%: common_with_%
	openssl dgst -sha256 -binary -out $@ $<

message_to_%: key_with_% this_forces_make_to_always_oblige
	openssl enc -aes-256-cbc -salt -pass file:$< | openssl base64 -out $@
	cat $@ # Below this line

message_from_%: key_with_% this_forces_make_to_always_oblige
	openssl base64 -d | openssl enc -d -aes-256-cbc -salt -pass file:$< -out $@ 
	cat $@ # Below this line

.SECONDARY: $(common_with_%) $(key_with_%)

.PHONY: this_forces_make_to_always_oblige
Note that the indents must be tabs. As this is now more than a demo, I write usage instructions.

You want to use a different secret in every anonymous game. The easiest way to avoid mixing them is to make a new directory for each game. You just need to copy the makefile to each game directory. Then you can generate your personal secret and the confounded version by just invoking make:

Code: Select all

make
You must paste the confounded version to the public press. When another country has pasted his, you can copy it to a file, that you want to name after him, to permit multiple peers.

Code: Select all

cat > kestas
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAlzaB5x9nLBv47jZ66s0EClFsf2oRqjk+AeIOV5JbtjI=
-----END PUBLIC KEY-----
Message processing commands compute the common secret and the respective encryption key on first run. If you write your message to plain_message, you can encrypt it like this:

Code: Select all

make message_to_kestas < plain_message
The base64-encoded encrypted message will be written to message_to_kestas and displayed. Decryption is quite similar:

Code: Select all

make message_from_kestas < base64_encoded_encrypted_message
The message will be written to message_from_kestas and displayed.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Mon Aug 14, 2023 12:07 pm

kestasjk wrote:
Fri Aug 11, 2023 4:17 pm
Hey it works! Nifty..
> As with a lot of this stuff, very neat, but a bit impractical
< I think more practical and definitely more secure than what was used in that game that inspired this guide. :)

It'd be good if there was decent software that allowed this kind of thing more easily. We use this sort of stuff every day in our web browsers and it's the norm, but between individuals only .. tech enthusiasts.. are going to go to these lengths if it needs these openssl commands and saving binary files etc.
The fact that those commands "just" produce files suggests using make. Actually a makefile is in my head as I write this. :razz: Attaching a makefile just didn't work last time, but copying it shouldn't be too difficult.

Re: Negotiating a secret for encryption in the global press

by kestasjk » Fri Aug 11, 2023 4:17 pm

learnedSloth wrote:
Fri Aug 11, 2023 3:46 pm
kestasjk wrote:
Fri Aug 11, 2023 2:15 pm

Eeenteresting.. So here's my confounded contribution:

Code: Select all

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAlzaB5x9nLBv47jZ66s0EClFsf2oRqjk+AeIOV5JbtjI=
-----END PUBLIC KEY-----
I now have a common secret with you.. so I guess I can use those 256 raw bits to encrypt something only you can read?

If I generate an AES key from our common secret, then use that to encrypt some text, and base64 encode it, with a little help from chatgpt:

Code: Select all

openssl dgst -sha256 -binary -out derived_key.bin common_secret
echo "[redacted, super interesting message]" > message.txt
openssl enc -aes-256-cbc -salt -in message.txt -out encrypted_message.bin -pass file:derived_key.bin
openssl base64 -in encrypted_message.bin -out encrypted_message_base64.txt
You and only you should be able to decrypt this super interesting message: (?)

Code: Select all

U2FsdGVkX18uQxnaYjc0xc2NfrEMIYcOtHnDtOgA48iVG7VXpvobCqPoYHue1qZK
zK3FDt6drOV1B/bYcVK+qtMb5aA3ASygEQcIvapxZQw=
I can see this catching on :P
Luckily I still had the contribution I used lying around. :-D Here's my super sensitive response:

Code: Select all

U2FsdGVkX1+LVOdAuYvHGZ2zDUIU8hLwozJyZFir0VYfqX4TWXEkZPX+ULmCPY8U
wPjdQpWhsfd9P9yM1r0wtZu0ZXP/BCM1UnRUAYe5J9f7FezRrMaUTl9wGz1YQM3c
vxHQhZJdnzgiF1QHfj8HgEZCJnAvwPTopfmGs1iyiBk=
edit: Where does the common paint come from though? Or is that common for everyone?
From the contribution generation algorithm (X25519) I think. Idk if it can be changed. OpenSSL seems to embed some metadata (our "public keys" start identically), but it could be just for sanity checks or something like that.
Hey it works! Nifty..
> As with a lot of this stuff, very neat, but a bit impractical
< I think more practical and definitely more secure than what was used in that game that inspired this guide. :)

It'd be good if there was decent software that allowed this kind of thing more easily. We use this sort of stuff every day in our web browsers and it's the norm, but between individuals only .. tech enthusiasts.. are going to go to these lengths if it needs these openssl commands and saving binary files etc.

Re: Negotiating a secret for encryption in the global press

by learnedSloth » Fri Aug 11, 2023 3:46 pm

kestasjk wrote:
Fri Aug 11, 2023 2:15 pm

Eeenteresting.. So here's my confounded contribution:

Code: Select all

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAlzaB5x9nLBv47jZ66s0EClFsf2oRqjk+AeIOV5JbtjI=
-----END PUBLIC KEY-----
I now have a common secret with you.. so I guess I can use those 256 raw bits to encrypt something only you can read?

If I generate an AES key from our common secret, then use that to encrypt some text, and base64 encode it, with a little help from chatgpt:

Code: Select all

openssl dgst -sha256 -binary -out derived_key.bin common_secret
echo "[redacted, super interesting message]" > message.txt
openssl enc -aes-256-cbc -salt -in message.txt -out encrypted_message.bin -pass file:derived_key.bin
openssl base64 -in encrypted_message.bin -out encrypted_message_base64.txt
You and only you should be able to decrypt this super interesting message: (?)

Code: Select all

U2FsdGVkX18uQxnaYjc0xc2NfrEMIYcOtHnDtOgA48iVG7VXpvobCqPoYHue1qZK
zK3FDt6drOV1B/bYcVK+qtMb5aA3ASygEQcIvapxZQw=
I can see this catching on :P
Luckily I still had the contribution I used lying around. :-D Here's my super sensitive response:

Code: Select all

U2FsdGVkX1+LVOdAuYvHGZ2zDUIU8hLwozJyZFir0VYfqX4TWXEkZPX+ULmCPY8U
wPjdQpWhsfd9P9yM1r0wtZu0ZXP/BCM1UnRUAYe5J9f7FezRrMaUTl9wGz1YQM3c
vxHQhZJdnzgiF1QHfj8HgEZCJnAvwPTopfmGs1iyiBk=
edit: Where does the common paint come from though? Or is that common for everyone?
From the contribution generation algorithm (X25519) I think. Idk if it can be changed. OpenSSL seems to embed some metadata (our "public keys" start identically), but it could be just for sanity checks or something like that.

Re: Negotiating a secret for encryption in the global press

by kestasjk » Fri Aug 11, 2023 2:15 pm

learnedSloth wrote:
Mon Aug 07, 2023 11:42 am
It can be done with significantly shorter cipher than I assumed in Cryptic messages and intrigue, as encrypting arbitrary messages isn't necessary.
Both players must contribute to the secret and a confounding factor is required to exchange the contributions without revealing them.

Commanding OpenSSL to do the hard work

First your secret contribution:

Code: Select all

openssl genpkey -algorithm X25519 -out contribution
Keep it safe, for computing the secret with it is fast, but too slow without it.
Now the confounded version for sharing:

Code: Select all

openssl pkey -in contribution -pubout -out confounded
It looks like this:

Code: Select all

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAIA2nOyv2LtvlcLqEHQz6owx9dBQ7Ie74U+B7qmXnqEk=
-----END PUBLIC KEY-----
If other players can be trusted to reproduce the header and footer by hand, you need to paste just that 1 line of cipher, which is shorter than some gibberish used in the game linked above!

When 2 players have pasted their confounded contributions, they can compute their common secret:

Code: Select all

openssl pkeyutl -derive -inkey contribution -peerkey another_confounded -out common_secret
It's 256 raw bits, so you may have to convert it depending on how you plan to use it.
Eeenteresting.. So here's my confounded contribution:

Code: Select all

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAlzaB5x9nLBv47jZ66s0EClFsf2oRqjk+AeIOV5JbtjI=
-----END PUBLIC KEY-----
I now have a common secret with you.. so I guess I can use those 256 raw bits to encrypt something only you can read?

If I generate an AES key from our common secret, then use that to encrypt some text, and base64 encode it, with a little help from chatgpt:

Code: Select all

openssl dgst -sha256 -binary -out derived_key.bin common_secret
echo "[redacted, super interesting message]" > message.txt
openssl enc -aes-256-cbc -salt -in message.txt -out encrypted_message.bin -pass file:derived_key.bin
openssl base64 -in encrypted_message.bin -out encrypted_message_base64.txt
You and only you should be able to decrypt this super interesting message: (?)

Code: Select all

U2FsdGVkX18uQxnaYjc0xc2NfrEMIYcOtHnDtOgA48iVG7VXpvobCqPoYHue1qZK
zK3FDt6drOV1B/bYcVK+qtMb5aA3ASygEQcIvapxZQw=
I can see this catching on :P

edit: Where does the common paint come from though? Or is that common for everyone?

Top