‎2014 Nov 18 5:10 PM
Hi,
My requirement is encrypt the string using one public key as well as decrypt the cipher text to plain text using the same key in ABAP.
I already know the list of function modules:
1. SCRAMBLE_STRING
2. HTTP_SCRAMBLE
3. MD5_CALCULATE_HASH_FOR_CHAR
etc.......
I can encrypt the string into cipher text using one of the above function modules. But I can't to be decrypt the cipher text to plain text.
Important thing is I want to encrypt some public key and the same is used to decrypt the cipher text to plain text.
Kindly help for this experts....
Regards,
Ramesh N
‎2014 Nov 19 9:44 AM
Hi Ramesh
interesting Topic 🙂
i did encryption/decryption with private/public key (including signing) some time ago by using the functions of
sap Standard Report SSF01 (yes i know strange Name for a Report)
Example Encryption:
* do encryption call CALL FUNCTION 'SSF_KRN_ENVELOPE'
EXPORTING ssftoolkit = space
str_format = 'PKCS7'
b_inenc = 'X'
io_spec = 'T'
ostr_input_data_l = l_contentlen
str_pab = ssfpse
str_pab_password = space
IMPORTING ostr_enveloped_data_l = l_contentenclen
crc = ssfrc
TABLES ostr_input_data = in_data_table
recipient_list = recip_list
ostr_enveloped_data = out_data_table
EXCEPTIONS ssf_krn_error = 399 ssf_krn_noop = 201 ssf_krn_nomemory = 202 ssf_krn_opinv = 203 ssf_krn_recipient_list_error = 207 ssf_krn_input_data_error = 208 ssf_krn_invalid_par = 209 ssf_krn_invalid_parlen = 210 ssf_fb_input_parameter_error = 211 OTHERS = 212.
do decryption call
* fill recipient parameter
CLEAR l_recip. l_recip-id = ssfid.
REFRESH recip_list.
APPEND l_recip TO recip_list.
CALL FUNCTION 'SSF_KRN_DEVELOPE'
EXPORTING SSFTOOLKIT = space
STR_FORMAT = 'PKCS7'
B_OUTDEC = 'X'
IO_SPEC = 'T'
OSTR_ENVELOPED_DATA_L = l_contentlen
IMPORTING OSTR_OUTPUT_DATA_L = l_contentenclen
CRC = SSFRC TABLES
OSTR_ENVELOPED_DATA = IN_DATA_TABLE
RECIPIENT = RECIP_LIST
OSTR_OUTPUT_DATA = OUT_DATA_TABLE
EXCEPTIONS SSF_KRN_ERROR = 399 SSF_KRN_NOOP = 201 SSF_KRN_NOMEMORY = 202 SSF_KRN_OPINV = 203 SSF_KRN_RECIPIENT_ERROR = 206 SSF_KRN_INPUT_DATA_ERROR = 208 SSF_KRN_INVALID_PAR = 209 SSF_KRN_INVALID_PARLEN = 210 SSF_FB_INPUT_PARAMETER_ERROR = 211 OTHERS = 212.
if you give me some time i can write a more detailled blog about this functions
‎2014 Nov 19 9:44 AM
Hi Ramesh
interesting Topic 🙂
i did encryption/decryption with private/public key (including signing) some time ago by using the functions of
sap Standard Report SSF01 (yes i know strange Name for a Report)
Example Encryption:
* do encryption call CALL FUNCTION 'SSF_KRN_ENVELOPE'
EXPORTING ssftoolkit = space
str_format = 'PKCS7'
b_inenc = 'X'
io_spec = 'T'
ostr_input_data_l = l_contentlen
str_pab = ssfpse
str_pab_password = space
IMPORTING ostr_enveloped_data_l = l_contentenclen
crc = ssfrc
TABLES ostr_input_data = in_data_table
recipient_list = recip_list
ostr_enveloped_data = out_data_table
EXCEPTIONS ssf_krn_error = 399 ssf_krn_noop = 201 ssf_krn_nomemory = 202 ssf_krn_opinv = 203 ssf_krn_recipient_list_error = 207 ssf_krn_input_data_error = 208 ssf_krn_invalid_par = 209 ssf_krn_invalid_parlen = 210 ssf_fb_input_parameter_error = 211 OTHERS = 212.
do decryption call
* fill recipient parameter
CLEAR l_recip. l_recip-id = ssfid.
REFRESH recip_list.
APPEND l_recip TO recip_list.
CALL FUNCTION 'SSF_KRN_DEVELOPE'
EXPORTING SSFTOOLKIT = space
STR_FORMAT = 'PKCS7'
B_OUTDEC = 'X'
IO_SPEC = 'T'
OSTR_ENVELOPED_DATA_L = l_contentlen
IMPORTING OSTR_OUTPUT_DATA_L = l_contentenclen
CRC = SSFRC TABLES
OSTR_ENVELOPED_DATA = IN_DATA_TABLE
RECIPIENT = RECIP_LIST
OSTR_OUTPUT_DATA = OUT_DATA_TABLE
EXCEPTIONS SSF_KRN_ERROR = 399 SSF_KRN_NOOP = 201 SSF_KRN_NOMEMORY = 202 SSF_KRN_OPINV = 203 SSF_KRN_RECIPIENT_ERROR = 206 SSF_KRN_INPUT_DATA_ERROR = 208 SSF_KRN_INVALID_PAR = 209 SSF_KRN_INVALID_PARLEN = 210 SSF_FB_INPUT_PARAMETER_ERROR = 211 OTHERS = 212.
if you give me some time i can write a more detailled blog about this functions
‎2014 Nov 21 2:45 AM
Hi Jorg,
Thanks for your valuable reply. Kindly let me know if any other function modules or any other way to achieve the encryption and decryption in ABAP.
I'm also searching the ways to achieve the same in ABAP .
Regards,
Ramesh N
‎2021 Jan 02 4:13 PM
Hi
I have requirement to create password protected pdf ( I have pdf in binary ,XML,xstring format)
‎2020 May 22 3:42 PM
Hi Ramesh,
Were you finally able to achieve this outcome?
I am also looking at such a solution to encrypt /decrypt using public key.
‎2021 Jan 15 11:58 AM