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: 

AES-128 Encryption support in ABAP (Table RFC)

diego_a
Participant
0 Kudos

Hi,

We are implementing a new functionality which requires  message has to be encrypted usingn AES 128. I have been going through different forums/posts but none could give me a definitive answer. Can somebody help me with below-

1) Is AES-128 supported from SAP ABAP stack in ECC 6.0?

2) Is there any standard classes/FMs available to invoke the same?

Regards,

Diego.

4 REPLIES 4

mvoros
Active Contributor
0 Kudos

Hi Diego,

you have to be more specific than just AES-128. Crypto is more complex and specifying a block cipher is not enough. At least you need to specify mode as well. ABAP AS has limited crypto API. Basically, it supports only PKCS#7. Here the message can be encrypted by AES-128 but key management is handled by asymmetric crypto. So my advice is to use this API. This will take care of every detail and you as a developer don't have to worry about anything.

If we are talking about a use case that you already have a key shared among parties and you want to encrypt a binary blob with AES then ABAP AS does not have implementation of AES available. Hence you can try a common workaround: OS command. You can dump a message as a file into a folder, encrypt it with some utility and then read it from there. This is not an ideal solution from security point of view.

Once i had to encrypt a short string with 3DES to generate a SSO cookie for some 3rd part system (not a great way how to do it but that's not important). ABAP AS contains a javascript engine (I know this sounds weird). Hence I found an implementation of 3DES in Javascript and used it to perform encryption. This is another workaround which you could use. Look for class cl_java_script (documentation).

Cheers

0 Kudos

Hi ,

the javascript code of the page is copied, then a class with a method I can think, it worked, but copied into other pages with AES-128 was not above shows the original text, as the algorithm is performed differently the Encryption that can be?

JavaScript Implementation of AES Advanced Encryption Standard in Counter Mode

Here are some pages that Encryption be honest, but it did not work.

http://aesencryption.net/

https://www.infoencrypt.com/

It may be that each programmer handling a different standard AES-128?

mvoros
Active Contributor
0 Kudos

Hi,

I remember some issues with passing binary strings. Hence I think I went with base64 encoding. So you need to prepare a JS function that decodes a character string from base64 enconding, perfroms encryption and then encodes result in base64,

Your description also mentions that counter mode is used. Is this a right mode? Is other party expecting this mode to be used?

Cheers

0 Kudos

Hi,

Because when AES encryption is tested in different pages, none of them decrypt the text of the other pages, AES encryption variants ?, maybe we can find this missing me some theory, if you know a good site where fully explain the AES operation I would very useful.

Thank you,