2006 Nov 14 11:20 AM
Hi Everybody,
Is there anyway to encrypt passwords in ABAP apart from da two function modules that are available to encrypt and decrypt?? it will be very helpful if anyone can give me a solution to this.
Thanks in Advance.
Hi Everybody,
Is there anyway to encrypt passwords in ABAP apart from da two function modules that are available to encrypt and decrypt?? it will be very helpful if anyone can give me a solution to this.
Thanks in Advance.
2006 Nov 14 11:22 AM
hi,
Function Module for Encryption and Decryption
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.
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.
rgds
anver
2006 Nov 14 11:24 AM
******************************
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.
2006 Nov 14 11:45 AM
hiiii first of all thanks for ur replies,but is there any other way using which i can encrypt.
2006 Nov 14 12:51 PM
HI Humerah,
Probably this may help you.
REPORT zzarun_pass .
DATA : passwd TYPE string,
encoded TYPE string,
decoded TYPE string.
PARAMETERS : p_pass(20) TYPE c LOWER CASE .
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_PASS'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
passwd = p_pass.
CONDENSE passwd.
CALL METHOD cl_http_utility=>if_http_utility~encode_base64
EXPORTING
unencoded = passwd
RECEIVING
encoded = encoded.
CALL METHOD cl_http_utility=>if_http_utility~decode_base64
EXPORTING
encoded = encoded
RECEIVING
decoded = decoded.
WRITE : / 'Password Entered :' , p_pass,
/ 'Encrypted Password :' , encoded,
/ 'Decrypted Password :' , decoded.
Regards,
<b>AS</b>
2010 Aug 19 1:49 PM
Note that this method is system independent and provides for a Dev or QA system the same values.
It could be wise to merge this method with another scrambler..
With kind regards,
Jack Otten