Cryptography is a field looking at techniques for encoding and verifying things securely. It tends to focus on the following issues:
encryption of data so that an unauthorized third party cannot read it without a key of some sort;
authentication and validation (or certification);
computer protocols for using the previous two techniques correctly and in a way that allows all parties to know how they’re being used (e.g. the TLS protocol allows a client to connect to a server over the Internet without the two machines previously knowing things such as session key or even preferred encryption method, maximum key length, etc).
Symmetric-key encryption in Java
This is the case where the same key is used to both encrypt and decrypt. It is sometimes called secret-key encryption, single-key encryption or simply symmetric encryption.
Asymmetric encryption, also known as public key encryption or public key cryptography, refers to a cryptographic algorithm which requires two separate keys, one of which is secret (or private) and one of which is public:
the public key is used to encrypt;
the private key is used to decrypt.
A common paradigm in a centralized client-server system is that a private key is held securely on the server, while the corresponding public key is distributed to all clients.