base64加密:

FORM encode_base64  USING    p_business  “字符串string
CHANGING p_base64. DATA l_xstring TYPE xstring.
CHECK p_business IS NOT INITIAL. CALL METHOD cl_http_utility=>encode_utf8
EXPORTING
unencoded = p_business
RECEIVING
encoded = l_xstring. CALL METHOD cl_http_utility=>encode_x_base64
EXPORTING
unencoded = l_xstring
RECEIVING
encoded = p_base64.
ENDFORM.

base64解密:

FORM decoding_base64 CHANGING p_business TYPE string.

  DATA l_xstring TYPE xstring.
CALL METHOD cl_http_utility=>if_http_utility~decode_x_base64
EXPORTING
encoded = p_business
RECEIVING
decoded = l_xstring. CLEAR p_business.
CALL METHOD cl_http_utility=>if_http_utility~decode_utf8
EXPORTING
encoded = l_xstring
RECEIVING
unencoded = p_business. ENDFORM.
05-12 15:59