Posts

Showing posts with the label Encrypt Spring Datasource Password

Spring : Encrypt Spring Datasource Password Credentials

Encrypt Spring Datasource Password Credentials (1)  EncryptedDataSource.java I have written a wrapper class EncryptedDataSource for org.springframework.jdbc. datasource. DriverManagerDataSource and overridden getPassword() method. EncryptedDataSource class is injected in spring datasource configuration xml file. Which calls the overriden getPassword() method of data-source at the time of database connection. getPassword() method decode the encrypted password into actual password. To decrypt or encrypt password we used "BASE64Decoder" algorithm.   import  java.io.IOException;   import  org.springframework.jdbc. datasource. DriverManagerDataSource;   import  sun.misc.BASE64Decoder;   import  sun.misc.BASE64Encoder;   public   class  EncryptedDataSource  extends  DriverManagerDataSource{                     @Override            public...