Solved

How to decrypt field value in GI ?

  • 12 July 2022
  • 4 replies
  • 275 views

Hi, i encrypted the “TaxRegistrationID” field for vendor with a customization project using this Acumatica Article: https://www.acumatica.com/blog/technical-tuesday-encrypting-fields-acumatica-database/

I replace the PXDBString attribute with PXRSACryptString . 

Now the field is encrypted in the database but in the UI we can see the real value. Thats what we wanted.If i make an api call to Vendor end point i do get the real value but if i export the vendor or add the field to a GI i get the encrypted value.

How can i get the real value in the GI?

icon

Best answer by praveenpo 13 July 2022, 08:20

View original

4 replies

Userlevel 7
Badge +19

Hi @NChowdhury  GI’s will fetch the data from the database and display the data.

I think, in GI we cannot decrypt the database encrypted database field values due to security reasons.   

Userlevel 6
Badge +3

Hi @NChowdhury ,

To display the actual value in the UI,you can use the below code in row selected event.

public virtual void DAC_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
    PXRSACryptStringAttribute.SetDecrypted<DAC.c2PAPIKEY>(sender, row, true);
}

This is will work only for UI. GI and API will get only Encrypted values.

Userlevel 5
Badge +1

@NChowdhury We usually encrypt the data in the DB to secure the sensitive data. So it is obvious that GI and APIs can fetch the encrypted values only. 

 

Userlevel 4
Badge +2

I replace the PXDBString attribute with PXRSACryptString . 

Now the field is encrypted in the database but in the UI we can see the real value. Thats what we wanted.If i make an api call to Vendor end point i do get the real value but if i export the vendor or add the field to a GI i get the encrypted value.

How can i get the real value in the GI?

 

As long as-

1) Field length is the same (i.e. not changed)

2) IsViewDecrypted = true is set as in

[PXRSACryptString(IsUnicode = true, InputMask = "", IsViewDecrypted = true)]

it should show proper values in GI. 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved