Skip to main content
Solved

How to decrypt field value in GI ?


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?

Best answer by praveenpo

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.

View original
Did this topic help you find an answer to your question?

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3401 replies
  • July 13, 2022

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.   


praveenpo
Semi-Pro II
Forum|alt.badge.img+3
  • Semi-Pro II
  • 99 replies
  • Answer
  • July 13, 2022

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.


Vinay Koppula
Semi-Pro II
Forum|alt.badge.img+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. 

 


Nayan Mansinha
Community Manager
Forum|alt.badge.img+2
  • Acumatica Developer Support
  • 49 replies
  • November 7, 2022
NChowdhury wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings