SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Function Module for Encryption and Decryption



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Jan 31, 2009 7:03 pm    Post subject: Function Module for Encryption and Decryption Reply with quote

Any function module which can be used for encryption or decryption of any particular field?

Use the following FM to encrypt

CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'

Use the following FM to decrypt

CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'

By these FM you can encrypt & decrypt any fields of the Program.

Two more things:
1. You can't use these FM to decode user passwords.

2. Although their import parameters are case sensitive, when you test them from se37, the import parameters are converted to uppercase (thus, it may seem that they aren't working). A suggestion: encapsulate them in a custom FM that receives a string to be encrytped/decrypted and a parameter that says if you want to encrypt or decrypt and call this fm from your program. Test them very carefully, because once the string has been encrypted the decryption side is the only way to get it back.

Code:
function zsecurtext.
*"----------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(INTEXT) TYPE  FIEB_DECRYPTED_PASSWD OPTIONAL
*"     REFERENCE(ENCRYPT) TYPE  C OPTIONAL
*"  EXPORTING
*"     REFERENCE(OUTTEXT) TYPE  FIEB_DECRYPTED_PASSWD
*"----------------------------------------------------------------------
** NOTE: This code doesn't work if run from se37. You should
** encrypt
  if encrypt = 'X'.
    call function 'FIEB_PASSWORD_ENCRYPT'
         exporting
              im_decrypted_password = intext
         importing
              ex_encrypted_password = outtext.
   else.
******** Decrypting *******************
    call function 'FIEB_PASSWORD_DECRYPT'
         exporting
              im_encrypted_password = intext
         importing
              ex_decrypted_password = outtext.
  endif.

endfunction.


ABAP Tips by: Horacio
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.