Decrypt SQl Logins  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Decrypt SQl Logins

Postby SBarnes » Thu Mar 17, 2022 12:03 pm

How can I decrypt the value of SQLLogin and ReportSQLLogin from HR_Staff so that I can execute usp_Jiwa_Grant_Application_Permissions and usp_Jiwa_Grant_Reporting_Permissions from code?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Decrypt SQl Logins  Topic is solved

Postby Mike.Sheen » Thu Mar 17, 2022 12:20 pm

SBarnes wrote:How can I decrypt the value of SQLLogin and ReportSQLLogin from HR_Staff so that I can execute usp_Jiwa_Grant_Application_Permissions and usp_Jiwa_Grant_Reporting_Permissions from code?


You'll need to also get from the HR_Staff record the SQLLoginLastSavedDateTime and ReportsLoginLastSavedDateTime - this is used as salt for the decryption - and that's done by the DecryptString method of the JiwaEncryption.JiwaEncrypt class.

So, new up and instance of the JiwaEncryption.JiwaEncrypt class (no factory here):
Code: Select all
encryption = new JiwaEncryption.JiwaEncrypt();


Then call the DecryptString method, passing the encrypted text and the salt formatted by JiwaODBC.database.FormatDateTime:

Code: Select all
loginPlainText = Encryption.DecryptString(EncryptedSQLLogin, Manager.Database.FormatDateTime(SQLLoginLastSavedDateTime, true));
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 12 guests

cron