User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:extensions:extensions:confidentialinfo [2017/07/13 22:29]
joebordes [Confidential Information as an Encryption/Decryption Engine]
en:extensions:extensions:confidentialinfo [2017/07/13 23:00] (current)
joebordes [Confidential Information as an Encryption/Decryption Engine]
Line 143: Line 143:
  
 ===== Confidential Information as an Encryption/​Decryption Engine ===== ===== Confidential Information as an Encryption/​Decryption Engine =====
 +
 +As with most of the development we create, we try to create infrastructure,​ things you can use in your own developments,​ not just functionality. Once an encryptionmethod is configured, you can use this module to encrypt and decrypt any information anywhere in the application. For example, in after_save event or in some hook,...
 +
 +This is what a small script to encrypt a couple of values looks like:
 +
 +<code PHP>
 +include '​vtlib/​Vtiger/​Module.php';​
 +include_once '​modules/​ConfidentialInfo/​ConfidentialInfo.php';​
 +
 +$info = array('​text'​=>'​text example','​num'​=>'​123.456'​);​
 +$encrypted = ConfidentialInfo::​encryptFields_pki($info,​ '​file://​public.key'​);​
 +
 +var_dump($encrypted);​
 +
 +$decrypted = ConfidentialInfo::​decryptFields_pki($encrypted,​ '​file://​private.key'​);​
 +
 +var_dump($decrypted);​
 +</​code>​
 +
 ===== Future Enhancements ===== ===== Future Enhancements =====