Base64 Encryption Java

Base64 Encryption Java

Java 8 included Base64 encoder in util package to achieve encoing. Base64 class implements encoder for encoding byte data using Base64 encoding scheme as specified in RFC 4648 and RFC 2045.
Thes instances of the Base64.Encoder class is safe if you are using multiple concurrent threads. Important point to note that if you pass pass null argument to method of this class it will throw NullPointerException exception. Below is sample class to encrypt and decrypt string value:

  • Base64Encryption.java:

  • Output:

Base64 Encryption Java

Leave a Reply

Your email address will not be published. Required fields are marked *