I could use a hand in identifying the encryption scheme used in this scenario. (Its from source code known to work)
There is a client connecting to a server such that:
client_private_key = rand p = 131 # known prime client_public_key = ((client_private_key ** p) % known_server_public_key)
Client shares its client_public_key to the server, and encrypts and decrypts using its client_private_key which is totally random.
Now, I have a hard time identifying the encryption scheme here and how the server generates its shared key to decrypt/encrypt messages to and from the client knowing that the client uses its private random key. Which to me means the server must be able to recreate this exact secret random key from what is known.
I can see the client_public_key is calculated equivalent to a DSA signing key, but I always though with my limited knowledge that this only could be used for verifying and not decryption.
I am used to the idea that client and servers generate mutual shared keys. This seems outside the realm of Diffie Hellman, and probably more into some DSA branch I do not know about. But it may very well be that its a branch of DH that I do not know about as well. Or even something similar to Clifford Cocks non-secret encryption.
Any nudge in the right direction appreciated, and a readable solution with how the keys are made even more appreciated. Hoping to solve this and learn how to use this method.