Encryption seems like too much returns error when decrypting
CodeViper
Member Posts: 28
I am looking for is a simple 'jumble/encryption' so prying eyes cant read a field.
I tried using the built in Encryption which encrypted the text string, but Decryption failed with a long error and complaining that it couldn't because of double padding or something like that.
Basically looking for a mask of sort.
want to take "Purchase Order 123ABC" and mask it to "u7r4yt64y9y". *example*
BUT... then when I have "u7r4yt64y9y" in the field and want to read it back, i want it to 'unmask' and be "Purchase Order 123ABC" again.
Anyone have a function that can do that...???
I tried using the built in Encryption which encrypted the text string, but Decryption failed with a long error and complaining that it couldn't because of double padding or something like that.
Basically looking for a mask of sort.
want to take "Purchase Order 123ABC" and mask it to "u7r4yt64y9y". *example*
BUT... then when I have "u7r4yt64y9y" in the field and want to read it back, i want it to 'unmask' and be "Purchase Order 123ABC" again.
Anyone have a function that can do that...???
0
Best Answer
-
You can read about ROT-13 'encryption' alghoritm here: https://en.wikipedia.org/wiki/ROT13
A simple function doing ROT-13 may look like this:ROT13(aText : Text) oText : Text oText := aText; FOR i := STRLEN(aText) DOWNTO 1 DO CASE TRUE OF oText[i] IN ['A'..'M', 'a'..'m'] : oText[i] += 13; oText[i] IN ['N'..'Z', 'n'..'z'] : oText[i] -= 13; END;
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031
Answers
-
Hi there @CodeViper
Why do you have to encrypt the data, why you just simply work with permissions in here. If the user should not see the value in the field hide the value for him. If you check your new field in User Setup table for that user so he can see the value, the value will be shown.
For additional information you can read this post:
https://forum.mibuso.com/discussion/comment/314243#Comment_314243
Solution provided by @carbon
Regards
0 -
because i am emailing the information... hence why i want it to be 'masked' once it leaves...0
-
How strong should the encryption be? If it is only to masking and you don't really care how easy is to decrypt it you could write simple ROT-13 on your string, or more advanced custom 'encryption' - say add a position of each character in a string to its value.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
sorry Slawek, i am unfamiliar with ROT-13.. .could you give me a code sniplet/example of what you mean?0
-
You can read about ROT-13 'encryption' alghoritm here: https://en.wikipedia.org/wiki/ROT13
A simple function doing ROT-13 may look like this:ROT13(aText : Text) oText : Text oText := aText; FOR i := STRLEN(aText) DOWNTO 1 DO CASE TRUE OF oText[i] IN ['A'..'M', 'a'..'m'] : oText[i] += 13; oText[i] IN ['N'..'Z', 'n'..'z'] : oText[i] -= 13; END;
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031 -
Thanks Slawek... that is EXACTLY what i was looking for... *two thumbs up* thank you!!!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions