process to encrypt neo-datasource.xml
hi everyone, I need to know the process to encrypt the file {CF_DIR}/lib/neo-datasource.xml from CFAdmin or some script.
Thanks a lot.
hi everyone, I need to know the process to encrypt the file {CF_DIR}/lib/neo-datasource.xml from CFAdmin or some script.
Thanks a lot.
@HugoA ,
Tell your security people the algorithm used is AES/CBC/PKCS5Padding.
The link that Charlie provides is useful. It will take you some way towards a solution. However, it contains a mistake or two.
1. The first occurrence of CreateObject("java",coldfusion.server.ServiceFactory") misses a quote. The author corrects it in the code that follows.
2. The author uses generate3DesKey() as if it were an ordinary function in Adobe ColdFusion. It is a Lucee function, but is not a function in Adobe ColdFusion. At least not in recent versions.
But there is good news. I will show how to gain access to the function.
The code you need is presented in two parts:
<!--- Replace "yourPassword" with your CF Admin password--->
<cfset createObject("component","CFIDE.adminapi.administrator").login("yourPassword")>
<cfset sf = createObject("java", "coldfusion.server.ServiceFactory")>
<!--- Dump the datasources --->
<cfdump var="#sf.DataSourceService.getDatasources()#">
<!--- Alternative code --->
<!---
<cfset createObject("component","CFIDE.adminapi.administrator").login("yourPassword")>
<!--- Instantiate the data source object --->
<cfset datasourceObject = createObject("component","CFIDE.adminapi.datasource")>
<!--- Dump the datasources --->
<cfdump var="#datasourceObject.getDatasources()#">
---><!--- Get from the dump the encrypted password of one of the datasources. Use your own. --->
<cfset encryptedPassword = "XDT5sdkIw1OiCdzj/F2WEvBi6RKBZE/Uz5S+Jx8Gq7w=">
<!--- Get the seed and the algorithm from the file /lib/seed.properties. Use your own. --->
<cfset seed = "655630C7A3C5BA3E">
<cfset encryptionAlgorithm = "AES/CBC/PKCS5Padding">
<!--- Use the CFPage class to gain access to the function generate3DesKey --->
<cfset pageObject = createobject("java","coldfusion.runtime.CFPage")>
<cfset encryptionKey = pageObject.generate3DesKey(seed)>
<cfset decryptedPassword = Decrypt(encryptedPassword, encryptionKey, encryptionAlgorithm, "base64")>
Decrypted datasource password: <cfoutput>#decryptedPassword#</cfoutput>
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.