Encrypted System Setting  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Encrypted System Setting

Postby pricerc » Thu May 27, 2021 9:38 am

If I want to encrypt a system setting in a plugin, where do I encrypt the text?

I can mask the UI in FormatCell, and Decrypt in ReadData, but where would I *Encrypt* the text before it saves to the DB?

As I'm asking this, I'm figuring I'll need to popup a dialog to prompt for a new password, and then not bother with the decryption in ReadData - i.e. leave no way for the user to see the current password, which is not necessarily a bad thing for the scenario I'm working with.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Encrypted System Setting

Postby SBarnes » Sat May 29, 2021 12:27 am

Hi Ryan,

Unless I am missing what you are asking why not do a form plugin on JiwaFinancials.Jiwa.JiwaSystemSettingsUI.frmMain its business logic property is JiwaFinancials.Jiwa.JiwaApplication.SystemSettings.SystemSettings and hook onto its save start event and simply do it there?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Encrypted System Setting

Postby pricerc » Mon May 31, 2021 10:52 am

SBarnes wrote:Hi Ryan,

Unless I am missing what you are asking why not do a form plugin on JiwaFinancials.Jiwa.JiwaSystemSettingsUI.frmMain its business logic property is JiwaFinancials.Jiwa.JiwaApplication.SystemSettings.SystemSettings and hook onto its save start event and simply do it there?


Hmmm. I hadn't thought about it from that direction - but since my plugin doesn't already attach to an existing form that could work.

I might still raise a suggestion for allowing, say, 'Password' as a system setting type - JiwaEncryption provides all the necessary hooks, and it would make it easier to 'obfuscate' what's happening.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Encrypted System Setting

Postby pricerc » Mon May 31, 2021 1:19 pm

SBarnes wrote:simply do it there?


So I had a bit of a play with this idea. I suppose it's reasonably 'simple'. But it's not very obvious, and a bit 'clunky'.

If you hook into JiwaSystemSettingsUI.frmMain, you're hooking into *every* system setting on the system, not just *your* plugin's settings.

So within your intercepted read/save methods, you need to find 'your' settings, and then find the field you're wanting to intercept. And then you need to modify 'Contents', which will trigger a PropertyChanged event. And it would also mean that there is an 'unencrypted' password lurking around in memory (I don't think that's a real-world problem for my scenario, but it is a thing that people worry about).

Being able to intercept the 'Save' inside SystemSettingPlugin would be much cleaner.

So I'm going to stick with popping up a dialog from inside SystemSettingPlugin.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Encrypted System Setting  Topic is solved

Postby Mike.Sheen » Mon May 31, 2021 3:16 pm

pricerc wrote:Being able to intercept the 'Save' inside SystemSettingPlugin would be much cleaner.


Logged as improvement DEV-8740
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Encrypted System Setting

Postby pricerc » Mon May 31, 2021 3:27 pm

Mike.Sheen wrote:
pricerc wrote:Being able to intercept the 'Save' inside SystemSettingPlugin would be much cleaner.


Logged as improvement DEV-8740


Thanks Mike.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests