2012 Feb 08 2:45 PM
Hello everybody,
my issue is that I want to encrypt a Char field with length 12, which is written in a table. It should be possible if necessary to decrypt the char field after encryption. Do you have any suggestions?
Thank you already
Best Regards
Martin
2012 Feb 09 5:39 AM
There is a good blog related to this topic [Encryption & Decryption of data using ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5026]. The class cl_hard_wired_encryptor is used for this.
Hello everybody,
my issue is that I want to encrypt a Char field with length 12, which is written in a table. It should be possible if necessary to decrypt the char field after encryption. Do you have any suggestions?
Thank you already
Best Regards
Martin
2012 Feb 08 5:13 PM
When we had a similar requirement for encrypting salary field what we did was creating a key table(db) with structure
ZCHAR type char.
ZKEY TYPE char(5).
The entries were on lines of
1 @#$fd
2 ^%#NF
....and so on.
Then when we encrypted by reading each and every char and translating to key and appending to string...
EX: 21 -> ^%#NF@#$fd.
and similarly for decrypting. This allowed us to change keys monthly to prevent anyone from being smart and guessing at the salaries too...
2012 Feb 09 4:12 AM
Have a look [here|http://www.sap-img.com/abap/function-module-for-encryption-and-decryption.htm].
What Ncvajja suggested is a valid approach but... the method used is easily guessed by accessing that table (SAP security should be involved).
Do a search for the common encryption algorithms. They shouldn't be hard to implement in ABAP.
Regards,
Andres.
2012 Feb 09 5:09 AM
Hi Martin..
try this code
Data enpwd(32) type c.
parameter pwd like enpwd .
******** Encrypting *******************
CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'
EXPORTING
IM_DECRYPTED_PASSWORD = pwd
IMPORTING
EX_ENCRYPTED_PASSWORD = enpwd
.
******** Decrypting *******************
CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'
EXPORTING
IM_ENCRYPTED_PASSWORD = enpwd
IMPORTING
EX_DECRYPTED_PASSWORD = pwd
.
********* Output **********************
write:/ 'Encrypt data=', enpwd,
/ 'Decrypt data=', pwd.
also try this forum links
http://forums.sdn.sap.com/thread.jspa?messageID=5077062#5077062
https://forums.sdn.sap.com/thread.jspa?threadID=1196646&tstart=0
Regards .
Shiva
2012 Feb 09 5:39 AM
There is a good blog related to this topic [Encryption & Decryption of data using ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5026]. The class cl_hard_wired_encryptor is used for this.
2012 Feb 21 8:22 AM
Thanks a lot Keshav, this blog helped me to solve my problem
2012 Feb 27 2:22 AM
Martin, keep in mind that blog does not describe a powerful encryption method like [AES|http://en.wikipedia.org/wiki/Advanced_Encryption_Standard] or [Blowfish|http://en.wikipedia.org/wiki/Blowfish_(cipher)], but common [BASE64 Encoding|http://en.wikipedia.org/wiki/Base64]. Take a look at the comments on the blog.
Regards,
Andres.