Variante 1 (cl_http_utility)
DATA: lv_bas64enc TYPE string VALUE 'Teststring'.
DATA: lv_base64dec TYPE string.
WRITE: / 'Plain:', lv_bas64enc.
cl_http_utility=>encode_base64( EXPORTING
unencoded = lv_bas64enc
RECEIVING
encoded = lv_bas64enc ).
WRITE: / 'Base64 enc:', lv_bas64enc.
cl_http_utility=>decode_base64( EXPORTING
encoded = lv_bas64enc
RECEIVING
decoded = lv_base64dec ).
WRITE: / 'Base64 dec:', lv_base64dec.
Variante 2 (cl_hard_wired_encryptor)
DATA: text TYPE string VALUE 'TestString.'.
START-OF-SELECTION.
WRITE: / text.
DATA(o_base64) = NEW cl_hard_wired_encryptor( ).
DATA(enc_string) = o_base64->encrypt_string2string( text ).
WRITE: / 'Base64 encrypt_string2string: ', enc_string.
DATA(dec_string) = o_base64->decrypt_string2string( enc_string ).
WRITE: / 'Base64 decrypt_string2string: ', dec_string.
DATA(enc_xstring) = o_base64->encrypt_string2bytes( dec_string ).
WRITE: / 'Base64 encrypt_string2bytes: ', enc_xstring.
DATA(enc_bytes) = o_base64->encrypt_bytes2bytes( enc_xstring ).
WRITE: / 'Base64 encrypt_bytes2bytes: ', enc_bytes.
DATA(dec_bytes) = o_base64->decrypt_bytes2bytes( enc_bytes ).
WRITE: / 'Base64 decrypt_bytes2bytes: ', dec_bytes.
DATA(dec_string2) = o_base64->decrypt_bytes2string( dec_bytes ).
WRITE: / 'Base64 decrypt_bytes2string: ', dec_string2.
Links