I'm creating a WebSocket Server in Ruby, and I would like to encrypt the string messages between the server and the client. I can't afford a certificate, so I was thinking that I would create an encryption algorithm using modulo.
I need to generate large prime numbers for this algorithm. I know that Ruby has a built in function for Primes, but I'm not sure if it can generate 50 to 60 digit numbers. Is the built in function for Primes good for this?
If anyone can offer a better way of encrypting my WS messages for free (and decrypt on the other side) I would also accept that :)
A self-signed certificate will work unless this is a public-facing project. Real certificates only matter if your client needs a way to trust the server it's connecting to.
Alternately, the Crypt gem has lots of Ruby implementations of cryptographic functions. Here's an example of encrypting and decrypting a string using Rijndael:
If you can share a key between your client/server, you shouldn't have any trouble doing this.