# Encrypt/Decrypt username and password in keycloak source code

**URL:** <https://forum.keycloak.org/t/encrypt-decrypt-username-and-password-in-keycloak-source-code/21502>\
**Category:** Getting advice\
**Created:** [April 14, 2023, 7:01pm UTC](https://forum.keycloak.org/t/encrypt-decrypt-username-and-password-in-keycloak-source-code/21502 "2023-04-14T19:01:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sorojas](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sorojas](https://forum.keycloak.org/u/sorojas)\
**Post date:** [April 14, 2023, 7:01pm UTC](https://forum.keycloak.org/t/encrypt-decrypt-username-and-password-in-keycloak-source-code/21502/1 "2023-04-14T19:01:34Z")

</div>

Hi there,

Could you help me or guide me what are the classes in your source code that I have to change to implement my own encryption/decryption methods to get my username and password from keycloak.conf?

I am trying to find a solution to avoid setting clear username/password in a production environment configuration file. I checked your code and I found a lot of places where you use db-username and db-password. If you have other solution that I can use I will be very grateful of your suggestions.

In addition I would like to mention that we have a standalone architecture to implement keycloak, and that our client doesn’t accept the idea to set those values as environment variables.

Regards  
Sonia Rojas
