Encrypt Sensitive Configuration Data with Java
I have a new article available on devx.com that shows you how to use the Java Cryptography Extension to encrypt a password in a flat text file. It is a pretty simple thing to do, but I have reused the code that I provide in the article several times and have found it to be very useful.
Here is an excerpt:
“When application developers are developing, parameters are often hard-coded in the source code. These hard-coded parameters are often pulled out of the source code and put into property files or configuration files. System and network security policies may force a developer to address security concerns over the data that is stored in external files. So, how do you make sure that your sensitive external parameters are safe?
One way to solve this problem is to encrypt the data before it is written to the external file, then read and decrypt the data before using it in your application. The Java Cryptography Extension (JCE) provides an API that will let you do this.
Symmetric or “single key” encryption is a good choice for solving this type of problem. Single key encryption uses the same key to encrypt and decrypt data. DES and DESede are two single key encryption schemes. I will show you how to solve this problem using either of these encryption schemes with the JCE.”









Hello, thanks very much for sharing what is the licence on this code as I would like to use it for the purpose of signing OAuth authentication tokens.
Anybody is free to use it however they’d like. Attribution would be nice, but is not required.
Leave your response!
Follow me on Twitter
Pages
Archives
Categories
Blogroll
Useful Websites
Tags
agile annotations apache build copyright design email etiquette farsi fit houston java javaranch jboss jbossinaction just-in-time kids language maven music myspace performance persian planning process quality recruiting refactoring response time scope screencast small teams smells startups startup weekend taxonomy tdd technical debt testing throughput universal velocity wiki xml xp