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

How Encrypt a File Using Key?

Former Member
0 Likes
1,516

Hi Guys,

Here is my problem. I have to create a bank's document encrypted to send to a legacy system. ( Using a KEY to validate the roll process)

I'm thinking to use two scenarios:

1 - Generate the file via ABAP and sent it to a folder in a server to be consuming - SAP ERP.

2 - Generate the file via ABAP, sent it to PI encrypt it via Java Mapping and sent it to a server.

ABAP

First question.

There is a way to generate this file using SHA1 using a Key as parameter?

(CALCULATE_HASH_FOR_CHAR)

Second one.

How can I decrypt this file to test?

Third.

There is others ways to encrypt a file via SAP ERP? UTF-8 and BASE32 are not encrypt codes. They are encoding code.

PI

First

There is a library or other way to encrypt a file without implement a Java Mapping?

Tnks.

8 REPLIES 8
Read only

former_member156446
Active Contributor
0 Likes
1,060

have your tried global class CL_HARD_WIRED_ENCRYPTOR? (was700)

Read only

JerryWang
Product and Topic Expert
Product and Topic Expert
0 Likes
1,060

Hello friend,

You can refer to code below.

DATA if_encrypt TYPE REF TO cl_hard_wired_encryptor.

CREATE OBJECT if_encrypt.

* ENCRYPTOR the string
TRY.
CALL METHOD if_encrypt->encrypt_string2string
EXPORTING
the_string = lv_string_value <---this is a string coming from user---i mean user input this value from the screen
receiving
RESULT = lv_encypt_value <----this one i declared as string as well...
.
CATCH cx_encrypt_error .

ENDTRY.

*for decryption--- put this code under your decrypt button
*since they are two different action methods that is why i needed to create the instance again.

DATA if_encrypt TYPE REF TO cl_hard_wired_encryptor.

CREATE OBJECT if_encrypt.

TRY.
CALL METHOD if_encrypt->decrypt_string2string
EXPORTING
the_string = lv_encypt_value <---declared as string, as above
receiving
RESULT = lv_decrypt_value <---declared as string as well
.
CATCH cx_encrypt_error .

ENDTRY.

Read only

Former Member
0 Likes
1,060

Tnks guys...

But I would like to know if are these methods algorithms as DES, AES, RSA... or others ?

Using these methods I can not export a KEY as a value to combine the string, is there other way to do that?

best regards.

Read only

Former Member
0 Likes
1,060

Tnks guys...

Edited by: Douglas Yuri Silveira on Jul 13, 2010 10:19 AM

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,060

> There is a way to generate this file using SHA1 using a Key as parameter?

Why don't you simple search the forum with "SHA1" term, you'd get the answer in an instant

> How can I decrypt this file to test?

> There is others ways to encrypt a file via SAP ERP? UTF-8 and BASE32 are not encrypt codes. They are encoding code.

What encryption do you need?

> But I would like to know if are these methods algorithms as DES, AES, RSA... or others ?

Couldn't you say it at the beginning!

By simply looking at CL_HARD_WIRED_ENCRYPTOR methods, we see that the encryption mechanism is very simple (I'm not expert so I can't tell what it is), I wouldn't rely on it...

I recommend you to read [Note 662340 - SSF Encryption Using the SAPCryptolib|http://service.sap.com/sap/support/notes/662340]. There are also some documentation, security guides on sap library and sap marketplace.

Edited by: Sandra Rossi on Jul 13, 2010 6:51 PM

Read only

Former Member
0 Likes
1,060

After metting,

We decided to create a ZIP file with password.

So I implemented a application that generate a .bat file that receive as parameters the file, name of zip file and password.

Tnks guys.

Edited by: Douglas Yuri Silveira on Jul 21, 2010 9:58 AM

Read only

Former Member
0 Likes
1,060

.

Read only

Former Member
0 Likes
1,060

Hi Douglas,

From the above post, you managed to create ZIP file with password. How you managed to do it? Please let me know the steps.

Thank you. Kishore