This post originated from an RSS feed registered with Java Buzz
by Javin Paul.
Original Post: How to encode decode String in Java base64 Encryption
Feed Title: Javarevisited Blog
Feed URL: http://javarevisited.blogspot.com/feeds/posts/default?alt=rss
Feed Description: Blog on Java, Unix, Linux, FIX Protocol technology. I share my experience as tutorial, article, interview questions, programming, design etc.
Encoding and Decoding of String in Java using base64 is extremely easy if you are using apache commons code open
source library. it provides convenient static utility method Base64.encodeBase64(byte[]) and Base64.decodeBase64(byte [])for converting binary data into base64 encoded binary Stream and than decoding back from encoded data in base64encryption mechanism. Many times we need to encode sensitive data be it binary String transferring over socket or transferringor storing data in xml files. Though there are other open source library available which provides support toencode any String into base64 e.g. MimeUtil from javax.mail package but Apache commons codec package is reallyhandy and doesn't add lot of extra stuff. its API is also very neat and clean. In this article we will see how to encode and decode String into base64 encryption.