Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HTTP_SCRAMBLE

Former Member
0 Likes
3,323
CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            = 'fpt_pwd'
    sourcelen         = len_pwd
    key               = 
* IMPORTING
*   DESTINATION       =

<b>What does key stand for?</b>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,674

Hi,

Please try this.


DATA: BEGIN OF itab OCCURS 0,
        line(132) TYPE c,
      END OF itab.
 
DATA: ftp_pwd(20) TYPE c lower case,   "<--- change here
      len_pwd TYPE i,
      pwd_key TYPE i value '5',
      ihdl TYPE i.
 
ftp_pwd = 'password'.

*DESCRIBE FIELD ftp_pwd LENGTH len_pwd IN CHARACTER MODE.  "<--- remove here
 

SET EXTENDED CHECK OFF.              "<--- add here
len_pwd = STRLEN( ftp_pwd ).         "<--- add here 
 
CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE       = fpt_pwd           "<--- change here
    sourcelen    = len_pwd
    key          = pwd_key
 IMPORTING                           "<--- change here 
  DESTINATION    = fpt_pwd.          "<--- change here

Regards,

Ferry Lianto

12 REPLIES 12
Read only

Former Member
0 Likes
2,674

Hi,

The key is used to 'scramble' the password by the c routine that you are calling in your code.

The destination server does not need to know how to unscramble the password-technically the password goes across the wire unencrypted and in free text (bit of a security issue). The RFC server program provided by SAP which performs the actual issuing of the commands unscrambles the password. For example, the password is only 'scrambled' between the parent abap process and the hand-off to the RFC server program.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,674

What should the value of key be ?

Read only

2,674

It can be anything. It could be a random number

Regards,

Rich Heilman

Read only

2,674

You could even use this function module, ISU_RANDOM_INTEGER, to give you a random number.

Regards,

RIch HEilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
2,674

Key is simply used to base the encryption on. For example, if you pass the number 5 to the function module, you will always get the same encrypted destination, if you pass 10, it will be differnent, 15 also different. It is just as a basis for the calculation.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,674

every where i see the key value as 26101957

I think this is related to the number of bytes occupied

chk this program <b>RSFTP004</b>

Read only

Former Member
0 Likes
2,674

Hi,

You can assign any random number.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,674
DATA: BEGIN OF itab OCCURS 0,
      line(132) TYPE c,
      END OF itab.

DATA: ftp_pwd(20) TYPE c,
      len_pwd TYPE i,
      pwd_key TYPE i value '5',
      ihdl TYPE i.

ftp_pwd = 'password'.

DESCRIBE FIELD ftp_pwd LENGTH len_pwd IN CHARACTER MODE.

CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            = 'fpt_pwd'
    sourcelen         = len_pwd
    key               = pwd_key
* IMPORTING
*   DESTINATION       =

I am getting an exception error in "HTTP_SCRAMBLE"

The current program "SAPLSFTP" tried to access a part of a string using

an explicit offset specification.

However, the offset (7) was grater than the length of the string

(7).

This is not allowed.

What could be wrong with my code

Read only

0 Likes
2,674

You should pass as a variable, not literal.

CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            =  fpt_pwd     "<- REmove the quotes

Regards,

Rich HEilman

Read only

0 Likes
2,674
DATA: BEGIN OF itab OCCURS 0,
      line(132) TYPE c,
      END OF itab.
 
DATA: ftp_pwd(20) TYPE c,
      len_pwd TYPE i,
      pwd_key TYPE i value 26101957,
      ihdl TYPE i.
 
ftp_pwd = 'password'.
 
len_pwd = strlen( ftp_pwd ).
 
CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            = ftp_pwd
    sourcelen         = len_pwd
    key               = pwd_key
 IMPORTING
  DESTINATION       = ftp_pwd
Read only

Former Member
0 Likes
2,675

Hi,

Please try this.


DATA: BEGIN OF itab OCCURS 0,
        line(132) TYPE c,
      END OF itab.
 
DATA: ftp_pwd(20) TYPE c lower case,   "<--- change here
      len_pwd TYPE i,
      pwd_key TYPE i value '5',
      ihdl TYPE i.
 
ftp_pwd = 'password'.

*DESCRIBE FIELD ftp_pwd LENGTH len_pwd IN CHARACTER MODE.  "<--- remove here
 

SET EXTENDED CHECK OFF.              "<--- add here
len_pwd = STRLEN( ftp_pwd ).         "<--- add here 
 
CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE       = fpt_pwd           "<--- change here
    sourcelen    = len_pwd
    key          = pwd_key
 IMPORTING                           "<--- change here 
  DESTINATION    = fpt_pwd.          "<--- change here

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,674

Thanks folks !!