Cryptic messages and intrigue

Advertise new games you are hosting, look for new games to join, or find other players to join your invitation-only games here.
Forum rules
This area is meant for advertising your new games or for finding new games to join with other players on the forum. Please do not make multiple threads for your game or spam existing threads. Please be civil, respect other members, and follow all of the webDiplomacy Forum Rules.
Post Reply
Message
Author
dkarcher
Posts: 9
Joined: Fri Nov 25, 2022 11:10 pm
Contact:

Cryptic messages and intrigue

#1 Post by dkarcher » Sun May 14, 2023 2:54 pm

The new game “Global press but coded messaging encouraged” is looking for a 7th player, in order to get things started.

Can you too convey secret messages to a target player in a public forum?

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#2 Post by learnedSloth » Sun May 14, 2023 3:55 pm

dkarcher wrote:
Sun May 14, 2023 2:54 pm
Can you too convey secret messages to a target player in a public forum?
Public key cryptography springs to mind. :smirk:
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

User avatar
JECE
Posts: 1478
Joined: Sun Dec 31, 2017 4:35 pm
Karma: 393
Contact:

Re: Cryptic messages and intrigue

#3 Post by JECE » Sun May 14, 2023 5:00 pm

learnedSloth wrote:
Sun May 14, 2023 3:55 pm
dkarcher wrote:
Sun May 14, 2023 2:54 pm
Can you too convey secret messages to a target player in a public forum?
Public key cryptography springs to mind. :smirk:
PKCS to MIND

PKS to MID

PKS to Mid-Atlantic Ocean

I conclude that dkarcher is playing France and that the French Republic will refer to Fleet Brest as 'PKS', or Prime Kentucky Shortrib, for the reminder of the game, or until that fleet gets disbanded.
See my full Profile:
http://www.webdiplomacy.net/profile.php?userID=17421

dkarcher
Posts: 9
Joined: Fri Nov 25, 2022 11:10 pm
Contact:

Re: Cryptic messages and intrigue

#4 Post by dkarcher » Sun May 14, 2023 5:24 pm

Indeed, I believe that kind of idea, i.e. using Public key cryptography, would/could work except maybe for the dilemma of making the system work fast enough within the parameters of messages exchanged only via the WebDiplomacy interface. In theory the setup is certainly feasible, but in practice, hmm, well, perhaps some player(s) will try it and we will see.

Thanks for contributing the idea!

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#5 Post by learnedSloth » Sun May 14, 2023 6:31 pm

Public key cryptography is indeed rather slow, but it is really only needed for trading symmetric encryption keys and you can generate your keys in advance.
Base64 encoding is commonly used for sending binary data over a text channel so that is going to be the easiest part.

Cryptography will undoubtedly give significant advantage to players that use it, so I anticipate that it will be either ubiquitous or banned. :smirk:
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

PRINCE WILLIAM
Posts: 908
Joined: Sun Dec 31, 2017 11:17 am
Karma: 1040
Contact:

Re: Cryptic messages and intrigue

#6 Post by PRINCE WILLIAM » Sun May 14, 2023 7:18 pm

This will be a variant for computer experts. To ordinary mortals sounds like Greek.

dkarcher
Posts: 9
Joined: Fri Nov 25, 2022 11:10 pm
Contact:

Re: Cryptic messages and intrigue

#7 Post by dkarcher » Sun May 14, 2023 9:27 pm

And I suspect that factor will be significant in the game (if played). Code systems too hard to easily implement or comprehend will fail, because a player will simply be too frustrated to use them.

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#8 Post by learnedSloth » Mon May 15, 2023 7:16 pm

It surely requires ability to use some tools with instructions, but that's far from expertise. The experts design these tools.

All the tools aren't necessarily readily present on every system, but you can try this on JSLinux. The x86 console suffices.

Let's make a directory to work in so we don't get confused by random files:

Code: Select all

localhost:~# mkdir diplomacy
localhost:~# cd diplomacy/
The first and the slowest step is to generate the private key:

Code: Select all

localhost:~/diplomacy# openssl genrsa
Generating RSA private key, 2048 bit long modulus (2 primes)
..........................+++++
.....+++++
e is 65537 (0x010001)
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAuRkDICokE8nzYjSNyrJheAV5oSfuoSeyzciqs2LwhWsDvRYu
st9Q/VE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Mo6InmlgZYmy0k0Arb4qpBGBuEZd1G
O+CM796nEyl4pUwcdPlAyz3sTI50jaZrLZWk1CrDj1NNTFmVCYxqLZzyHCjYsUAr
R318v24ibJ2qEqpgmStkTIUCgYEAhZ9Um74NzvSbWAScsJAfieA2bZRTMTi72hXp
lDsfe2PYReFfIsGQMVnIifW6FJt68r9DO3IxnRAc9eQDvh/qu8XYFNYPLmMXnRoq
1uwuDmKkErSdy5ObBasX56+8gB6O1D7Aoi72l3be/h9yxh2YdU31pbAMlvhKtXzb
nhn8YxkCgYB4TBEjUI+xtGgmcRQOknU+XaHe/AuJI2ErcAqzhpIExzld1cAV/KFY
FTPFcVYC9pOlFpOBowrh5eCl5ffXIbBgfUtDAIsVJwAffsBotBN4gGYRrPamVqBu
Mw/qIzspobq2NUpEp+Tnk7jEzxiBBaEUgxOBc0lsZ54AbbERrpLfqw==
-----END RSA PRIVATE KEY-----
Your communications aren't safer than the key used, so keep it to yourself.

In retrospect redirecting the output to a file and deleting the lines above header would have been easier than copying that to a file, which I named id_rsa.pem. I recommend that you run this instead:

Code: Select all

openssl genrsa > id_rsa.pem
chmod 0600 id_rsa.pem
The other command ensures that permissions are right for computing the public key:

Code: Select all

ssh-keygen -f id_rsa.pem -y > id_rsa.pub
ssh-keygen -f id_rsa.pub -e -m PKCS8 > id_rsa.pem.pub
Now the public key can be used to encrypt short messages that can be decrypted with the private key. Key length determines maximum message length; 2048 bits gives about 250 bytes. You can try it now:

Code: Select all

localhost:~/diplomacy# openssl rsautl -encrypt -pubin -inkey id_rsa.pem.pub -ssl
 > encrypted
Actually I prefer gunboat diplomacy.
Press ^D on empty line to end the message. You can verify that you can't read it in encrypted form with hexdump:

Code: Select all

hexdump -C encrypted
00000000  9c dd bf 91 1a 33 a5 3e  66 07 bd e4 ca e1 83 8c  |.....3.>f.......|
00000010  74 fa af f4 ba 8b 26 a1  dd 15 3d da 67 27 1e 68  |t.....&...=.g'.h|
00000020  3b 63 bd 9f fe 1c 6d 2f  60 34 06 74 a8 3f f3 93  |;c....m/`4.t.?..|
00000030  ea 7e 90 98 dd 39 d6 3c  97 42 61 53 66 a3 4d c9  |.~...9.<.BaSf.M.|
00000040  33 7e 12 50 13 ee 45 5d  15 ca 8e 0f e5 ca a4 d7  |3~.P..E]........|
00000050  29 05 ea ef be 98 e6 f2  98 9c 7e 55 02 00 6a a2  |).........~U..j.|
00000060  d7 07 c7 e0 80 6a c9 90  27 64 68 78 91 65 a3 88  |.....j..'dhx.e..|
00000070  32 3b 4a c9 6b 02 d4 a9  52 45 39 ff 95 2b 13 fd  |2;J.k...RE9..+..|
00000080  b8 f7 d9 43 f9 9c 32 79  ae 3a 08 64 60 9a 38 1f  |...C..2y.:.d`.8.|
00000090  e8 59 04 d7 ea 8d cb e3  6f e2 14 9e 72 fd 40 c6  |.Y......o...r.@.|
000000a0  1a 26 64 d9 66 9a 2c 2b  bb 45 94 71 d4 79 8f e6  |.&d.f.,+.E.q.y..|
000000b0  43 f1 e5 b4 37 09 b7 da  89 e9 07 24 42 d2 ef 51  |C...7......$B..Q|
000000c0  53 29 26 d3 60 9f 72 ed  76 a4 34 f0 cf 53 c1 e9  |S)&.`.r.v.4..S..|
000000d0  e7 49 ea a4 8f 43 1f 59  fb ac 75 5c ee 59 fc 17  |.I...C.Y..u\.Y..|
000000e0  8d 6c 50 cf b9 b5 83 ef  e0 4f d1 a0 06 4b 37 b0  |.lP......O...K7.|
000000f0  27 c8 1a b8 a6 c3 24 20  37 72 5d ca ab b8 7a 95  |'.....$ 7r]...z.|
00000100
Decrypt with private key:

Code: Select all

localhost:~/diplomacy# openssl rsautl -decrypt -inkey id_rsa.pem -in encrypted
Actually I prefer gunboat diplomacy.
Of course encrypted is binary data that can't be directly copied as text, but it can be converted to base64:

Code: Select all

localhost:~/diplomacy# base64 encrypted
nN2/kRozpT5mB73kyuGDjHT6r/S6iyah3RU92mcnHmg7Y72f/hxtL2A0BnSoP/OT6n6QmN051jyX
QmFTZqNNyTN+ElAT7kVdFcqOD+XKpNcpBervvpjm8picflUCAGqi1wfH4IBqyZAnZGh4kWWjiDI7
SslrAtSpUkU5/5UrE/2499lD+Zwyea46CGRgmjgf6FkE1+qNy+Nv4hSecv1AxhomZNlmmiwru0WU
cdR5j+ZD8eW0Nwm32onpByRC0u9RUykm02Cfcu12pDTwz1PB6edJ6qSPQx9Z+6x1XO5Z/BeNbFDP
ubWD7+BP0aAGSzewJ8gauKbDJCA3cl3Kq7h6lQ==
Use base64 -d to convert back to binary.

Now that you can send short encrypted messages you can negotiate a more practical symmetric encryption scheme.
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

User avatar
JECE
Posts: 1478
Joined: Sun Dec 31, 2017 4:35 pm
Karma: 393
Contact:

Re: Cryptic messages and intrigue

#9 Post by JECE » Mon May 15, 2023 9:31 pm

This seems like an awful lot of work for a public press game. When you share the key, wouldn't all the great powers + anyone on the internet be able to decrypt your message? It just seems like it would lightly penalize players who might be limited to accessing the website via their phones or work computers for much of the day (only because their ability to read and send messages would be delayed).
See my full Profile:
http://www.webdiplomacy.net/profile.php?userID=17421

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#10 Post by learnedSloth » Mon May 15, 2023 11:14 pm

JECE wrote:
Mon May 15, 2023 9:31 pm
This seems like an awful lot of work for a public press game.
I guess it looks like more than it is a because it's a guide and I included command outputs. Only 4 or 5 commands are really necessary to generate the encryption keys, and encrypting and decrypting are just one command + base64 conversion.
I now realize that they could all be put in 3 shell scripts for ease of use, but as I'm doing this just for the joy thereof, I think I try to at least get some sleep first.
When you share the key, wouldn't all the great powers + anyone on the internet be able to decrypt your message?
The very point of public key encryption is to have secure communications over an insecure channel: https://ssd.eff.org/module/deep-dive-en ... stems-work

You keep the private key to yourself and share the public key with everyone that should be able to send messages only you can read. Deriving the private key from the public key is infeasible in unclassified literature.
It just seems like it would lightly penalize players who might be limited to accessing the website via their phones or work computers for much of the day (only because their ability to read and send messages would be delayed).
If you have a browser, you can probably emulate a minimal Linux system in it, which usually ships with the necessary tools. You just need to upload the keys to it.
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

User avatar
JECE
Posts: 1478
Joined: Sun Dec 31, 2017 4:35 pm
Karma: 393
Contact:

Re: Cryptic messages and intrigue

#11 Post by JECE » Tue May 16, 2023 12:58 am

OK, but you understand what I'm saying, right? It wouldn't allow private messaging if all of the players can see everything that gets posted.
See my full Profile:
http://www.webdiplomacy.net/profile.php?userID=17421

User avatar
JECE
Posts: 1478
Joined: Sun Dec 31, 2017 4:35 pm
Karma: 393
Contact:

Re: Cryptic messages and intrigue

#12 Post by JECE » Tue May 16, 2023 1:09 am

Ah, I see how it works. Thanks for the link. The 'key' only lets other people message the sender.
See my full Profile:
http://www.webdiplomacy.net/profile.php?userID=17421

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#13 Post by learnedSloth » Thu May 18, 2023 9:48 pm

Earlier I wrote that the commands I provided could be put to 3 scripts for ease of use. I developed that idea further and now I have a 1 file, but uploading it here seems to fail without helpful error message :?.
Its name shall be makefile, and the contents are here:

Code: Select all

.PHONY: all

all: public_key encrypt.sh decrypt.sh

private_key:
	openssl genrsa -out private_key
	chmod 0400 private_key

public_key: private_key
	ssh-keygen -f private_key -y > temporary_name_that_works_at_last
	ssh-keygen -f temporary_name_that_works_at_last -em PKCS8 > public_key
	rm temporary_name_that_works_at_last
	chmod 0644 public_key

decrypt.sh: private_key
	echo '#!/bin/bash' > decrypt.sh
	echo 'base64 -d $$1 | openssl rsautl -decrypt -inkey private_key' >> decrypt.sh
	chmod 0700 decrypt.sh

encrypt.sh:
	echo '#!/bin/bash' > encrypt.sh
	echo 'openssl rsautl -encrypt -pubin -inkey $$1 -ssl | base64' >> encrypt.sh
	chmod 0755 encrypt.sh

I would have preferred just uploading it here, as that would have ensured that the contents remain intact and that the name is right. To create the makefile, you can use cat like this:

Code: Select all

localhost:~/diplomacy# cat > makefile
Now whatever you write to it becomes the content of the makefile, so paste the the contents above and press ^D on empty line to signal end of transmission. The next command is easy:

Code: Select all

localhost:~/diplomacy# make
It generates the private key (aptly named private_key), the respective public key and scripts for decryption and encryption that also perform the base64 conversions for you. Moreover, if you happen to mar any file that make creates, save the private key, you can just rm it and invoke make again.

For easy sharing of the public key, use cat like this (Note: No angle bracket!):

Code: Select all

localhost:~/diplomacy# cat public_key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnSmVNhMYscy4dyzlija4
mSwnbby4qTnRsqRTIb2urkk6KAdKlo3i+rGJ8x43INYNSAAc8mmn3hXwGSx+lluv
DXlK45E9k02RrT0wk5G8Amqah4oFD1CrbPB2NTeAjnRDYRNVjoYzljYxiYTHw4Ph
lywjTK3QaMAs2welkXoppu+Ee1AbGQPa8L1VZCuhVs8UEim0Jz8CQU+qSsRQvMLb
uAsZm616EuUkrvdaLb0QpU4uVyjauX9FHX+YVBvt5FQUUI0VL7nAt0Dvui+Yo5KQ
EdQADB0FO9UKgSUyJcKhpJPVFGrWZK8MdrAosWmMhq1PIXamgOf1UPCatd3gZz7U
8wIDAQAB
-----END PUBLIC KEY-----
So it can be pasted to the chat, and another player can paste it to file with cat:

Code: Select all

localhost:~/diplomacy# cat > public_key_of_another_player
./encrypt.sh must be given the public key to use:

Code: Select all

localhost:~/diplomacy# ./encrypt.sh public_key_of_another_player
Here's another example message.
MHslTxrqjbZ8jHI+LK/yvWqnjyo+5pjxwZEIuyAYnt2z2GfhAtGrizaIAy2aGteJn6qXTzDzO5ER
eL9rOwxGAJEZYip5iaGGTzvSZVrooyIpdUvjdiEYM0FlOkxr4k0KDE7IuJrGJIMQdUtLKd3CQkjs
LNSlOr2pmz7fyx9ZOJNFQ++yI9aZo3bkTstZ0CRLJEmYXLBuCW/PsSCrfz5FVXPF+9CApH1HtYq4
jvDG1ahZ9P/mqGG741g1GYHBeU0PbUVvsBcHMWwp3K281d7GxrQyRhJV/EwVxi49iiSun9kY4tg9
1xqI/DkMQik4jgnL6R5y/Z71ehla+CIof6GIaA==
As you see it now just prints the encrypted message in base64 so it can be copied. You can just paste it to ./decrypt.sh:

Code: Select all

localhost:~/diplomacy# ./decrypt.sh
MHslTxrqjbZ8jHI+LK/yvWqnjyo+5pjxwZEIuyAYnt2z2GfhAtGrizaIAy2aGteJn6qXTzDzO5ER
eL9rOwxGAJEZYip5iaGGTzvSZVrooyIpdUvjdiEYM0FlOkxr4k0KDE7IuJrGJIMQdUtLKd3CQkjs
LNSlOr2pmz7fyx9ZOJNFQ++yI9aZo3bkTstZ0CRLJEmYXLBuCW/PsSCrfz5FVXPF+9CApH1HtYq4
jvDG1ahZ9P/mqGG741g1GYHBeU0PbUVvsBcHMWwp3K281d7GxrQyRhJV/EwVxi49iiSun9kY4tg9
1xqI/DkMQik4jgnL6R5y/Z71ehla+CIof6GIaA==
Here's another example message.
Now it may look like that encryption just restores the private discussion to global press games, but there's one big difference: the discussion is only encrypted, not hidden. The other player can prove to a 3rd player what you just wrote by leaking enough info for verification. In case of public key encryption the exact message suffices, as he can just encrypt it for comparison.
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

BrianBaru
Posts: 102
Joined: Wed Dec 21, 2022 1:15 am
Karma: 54
Contact:

Re: Cryptic messages and intrigue

#14 Post by BrianBaru » Sat May 27, 2023 9:29 pm

Games with only public press or no messaging should only use the game chat for communication. Does this thread violate the rules?
1

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#15 Post by learnedSloth » Sun May 28, 2023 9:08 am

BrianBaru wrote:
Sat May 27, 2023 9:29 pm
Games with only public press or no messaging should only use the game chat for communication. Does this thread violate the rules?
The players are anonymous so we don't even know if one has posted to it. :eyeroll:
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

dkarcher
Posts: 9
Joined: Fri Nov 25, 2022 11:10 pm
Contact:

Re: Cryptic messages and intrigue

#16 Post by dkarcher » Sat Jul 08, 2023 2:26 pm

A follow-up on this topic:

1. The game referenced atop this thread has completed.

2. Early in the game encoding of messages did indeed play some role in diplomacy, but after alliances later shifted, encoding was abandoned. Since we each used, at most, only primitive encoding methods, I should have anticipated that behavior. (A change in alliance results in your ex-partner, now possibly an enemy, knowing how to interpret messages.)

3. There was one “encoding” method introduced by a different player that I figured out after some initial difficulty, but I liked its simplicity and effectiveness, so I later used it briefly myself. And I may well do so again in the future, with a minor adjustment. ( I wish to eliminate the factor that allowed me to figure the code out.).

4. There was a couple of instances whereby player 1 wrote something “encoded” for player 2, but it was unclear whether player 2 in fact understood the messages. The situation creates a new dynamic whereby others wonder: Is player 2 bluffing when he responds that he understands and will act accordingly?

5. Separately, I agree completely that a strategy of using public/private keys would likely be the most secure technique. I just don’t think it could, from a practical standpoint, be utilized within the available interface of WebDiplomacy—at least not without the other players venting their frustrations out on you over all the “garbage” posts.

learnedSloth
Posts: 127
Joined: Mon Sep 12, 2022 10:20 pm
Karma: 71
Contact:

Re: Cryptic messages and intrigue

#17 Post by learnedSloth » Sat Jul 08, 2023 6:04 pm

dkarcher wrote:
Sat Jul 08, 2023 2:26 pm
5. Separately, I agree completely that a strategy of using public/private keys would likely be the most secure technique. I just don’t think it could, from a practical standpoint, be utilized within the available interface of WebDiplomacy—at least not without the other players venting their frustrations out on you over all the “garbage” posts.
Public key cryptography is really only needed for agreeing to a more practical cryptosystem securely. Use of a standard codebook could probably be dictated in 1 message, so that's just 1 wall of ciphertext for each secure channel in addition to the public keys.
¶ Keep thy heart with all diligence; for out of it are the issues of life.
-- Proverbs of Solomon, chapter 4, verse 23

Post Reply

Who is online

Users browsing this forum: Napple and 12 guests