From the course: Learn Java Cryptography

Cryptography basics - Java Tutorial

From the course: Learn Java Cryptography

Cryptography basics

- [Instructor] In order to most effectively communicate throughout this course, we need to start our journey by level setting on some basic information and definitions. As such, let's start with understanding what cryptography is. Cryptography, as previously mentioned, is the study of secrets. Most of cryptography entails very advanced mathematical functions that are used to secure data. As such, it is important to discuss the first rule of cryptography for developers, and that is to never roll your own crypto. Now I don't say this as an insult. You may be brilliant mathematician and cryptography specialist, but as a general rule of thumb, you should rely on libraries that have been vetted and adequately tested and maintained. The sole purpose of these algorithms is to hide data, sometimes in plain sight, from a would-be attacker. As such, the two most common algorithm classes used are encryption and hashing. We will go into these functions in much more depth later. Let's talk about a few key terms you will need to know for this course. The first is cipher text. This is the output of an encryption operation given a key and plain text. It is also the data that is fed to a decryption function. The key is either a single piece of data or a correlated pair of data that, when input into an encryption function with plain text, will yield the cipher text output. The key is the piece of data that must be secured, as often the actual algorithm is publicly available. The plain text is the data that must be hidden from view through the use of a cryptographic encryption operation. This is often considered sensitive data in the real world that we don't want unauthorized people from viewing. The final term we will discuss is salt. A salt is a random piece of data that, when added to a hashing function, provides even more entropy in the output, making certain attacks less likely. A good cryptographic hash should always use a salt. There are similar values for encryption that we will discuss when we get there. Now let's discuss the definitions of a few of the main operations you will encounter in this course. The first is digital signature. A digital signature is an asymmetric key function that verifies the authenticity of a message coming from a remote party. By signing the message with the private key, using the public key to decrypt the message confirms that the sender is who they say they are. The next is encryption. Encryption in any form is a way of taking plain text and converting it to a cipher text, which, with the correct pieces of data, can be converted back into plain text at a later point. Encryption can be accomplished using a single shared key or an asymmetric key pair. The final function we will discuss is hashing, and by hashing we are specifically referring to cryptographic hashing. Hashing allows you to map an arbitrary-sized set of bytes into a finite-size of relatively unique set of bytes. These three classes for mathematical algorithms are where we will focus most of our time in this course.

Contents