Alright. You ask a really broad question. And broad is the field of its study.
Any crypto algorithm can be segregated into two primitive types:
What's the use of these two things, you might ask?
Well, symmetric ciphers are really secure, and all that, however, they need a dependant transport channel for the passage of the symmetric key. The reason here is rather simple: if I can intercept your key, I can send something different to your recipient.
The solution? Using asymmetric ciphers. You can publicly go about blabbering of your public key, and still your system will be as strong as it ever has been. However, there exists a problem. With asymmetric ciphers (RSA), you can't encrypt data of any arbitrary size; i.e., data which is more than the size of the key. So, you can't encrypt a 1 GB file with a 4096-bit (or a 8192-bit) key.
Here, we use something called a hybrid cryptosystem: you encrypt the symmetric encryption key with the Public key, and transmit that; the recipient decrypts the key with his/her private key, and then decrypts the message.
I wouldn't really go into the gory details of how it all works. Integer rings, S-Box ciphers, key vectors, and what not. However, I can offer you some tailor-made advice for your specific application, should you wish. :)
I hope this helps!