2014 Jul 28 7:42 AM
Hi All,
Is it possible to Encryption and Decryption of ABAP Code ?
For Encryption : I have found if i
* append *special* character 1st line to hide source code
Like : APPEND '*@#@@[SAP]' to report
Than my Report will be ecrypted ? how to decrypted the report else any other way around for Encryption and Decryption of ABAP Code?
2014 Jul 28 8:01 AM
Hello,
Please refer to this link in SCN.
You can also 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.
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.
Hope it helps.
Regards,
Yovish.
2014 Jul 28 10:17 AM
Thanks Yovish for your prompt .
But My objective is to hide or encrypt whole code from any other user .
I achieved Hiding the ABAP Code
Code :
DATA: GT_CODE(72) TYPE C OCCURS 0,
GV_CODE LIKE LINE OF GT_CODE,
GT_CODE2(72) TYPE C OCCURS 0.
PARAMETERS: PROGRAM LIKE SY-REPID.
START-OF-SELECTION.
READ REPORT PROGRAM INTO GT_CODE.
IF SY-SUBRC NE 0.
MESSAGE E398(00) WITH 'Report' PROGRAM 'not found.'.
ENDIF.
READ TABLE GT_CODE INDEX 1 INTO GV_CODE.
APPEND '*@#@@[SAP]' TO GT_CODE2.
LOOP AT GT_CODE INTO GV_CODE.
APPEND GV_CODE TO GT_CODE2.
ENDLOOP.
INSERT REPORT PROGRAM FROM GT_CODE2.
WRITE :/ PROGRAM , ' Encrypted Sucessful !!!'.
This I have tried but Decrypting is not working ...
Please Suggest