O'Reilly logo

Security with Go by John Daniel Leon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

AES

This program will encrypt and decrypt a file using a key, which is basically a 32-byte (256-bit) password.

When generating a key, encrypting, or decrypting, the output is sent to STDOUT or the Terminal typically. You can easily redirect the output to a file or another program using the > operator. Refer to the usage patterns for examples. If you need to store the key or the encrypted data as an ASCII encoded string, use base64 encoding.

At some point in this example, you will see the message being split into two pieces, the IV, and the cipher text. The initialization vector, or IV, is a random value that gets prepended to the actual encrypted message. Every time a message is encrypted with AES, a random value is generated and used as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required