Application Development 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: 

HTTP_SCRAMBLE

Former Member
0 Kudos
1,285
CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            = 'fpt_pwd'
    sourcelen         = len_pwd
    key               = 
* IMPORTING
*   DESTINATION       =

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

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos
636

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

ferry_lianto
Active Contributor
0 Kudos
636

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

Former Member
0 Kudos
636

What should the value of key be ?

636

It can be anything. It could be a random number

Regards,

Rich Heilman

636

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

Regards,

RIch HEilman

RichHeilman
Developer Advocate
Developer Advocate
636

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

Former Member
0 Kudos
636

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>

ferry_lianto
Active Contributor
0 Kudos
636

Hi,

You can assign any random number.

Regards,

Ferry Lianto

Former Member
0 Kudos
636
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

0 Kudos
636

You should pass as a variable, not literal.

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

Regards,

Rich HEilman

0 Kudos
636
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

ferry_lianto
Active Contributor
0 Kudos
637

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

Former Member
0 Kudos
636

Thanks folks !!