From the course: Learn Java Cryptography

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Generating a symmetric key

Generating a symmetric key - Java Tutorial

From the course: Learn Java Cryptography

Generating a symmetric key

- [Narrator] We're gonna start our encryption operations with symmetric encryption. And in order to do that, we need to create a shared key. Let's jump into our IVE and open up the crypto utilities project. And in here, in source main Java, I want to create a new package. And the package that we're gonna create is going to be com.frankmoley.crypto.symmetric. Now, in that package, we're going to create a new Java class file, and we're gonna call that symmetric.encryption.utils. Now, to this class, we're gonna create a few data points here. The first thing we're gonna do is private static final string, and we will call that string AES, and we will set its value to simply AES. Now, I do this because I don't like magic strings in my code, and really, that's just good programming practice. Now let's create a method to actually create our secret key. So public static SecretKey create AES key. Now this is gonna throw an…

Contents