Skip to Content

RSA encryption in ABAP: How to?

Apr 30, 2017 at 10:17 AM


avatar image

I need to execute an RSA encryption in ABAP (more specifically: I need to do a JSON Web Signature - JWS cf - with RSA and SHA256; for SHA256 I can use cl_abap_hmac, but for RSA?).

Has anyone an idea how to achieve this?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jelena Perfiljeva
May 02, 2017 at 08:05 PM

I'm not an expert on this (actually have no clue TBH) but this question piqued my interest and I did some digging around.

Not sure if anything is available in EHP7 and higher but in EHP6 a quick search in the security packages did not find anything. It might be important to highlight the difference between a hash function (such as SHA...) and encryption/decryption such as RSA. This might be why you've found one but not the other in SAP. You can see in the description that CL_ABAP_HMAC is "copyrighted by RSA..." and I'm just guessing SAP got this one for their own needs (nice bonus for the customers) but there was no need for RSA encryption in ABAP.

As far as "how to achieve" - you can find some code examples online that are using some special Java libraries, so I'm guessing since there is no such functionality directly in ABAP you'll just have to run some external program to achieve that part. There are several ways to do so (another web service? LOL :) ), I'm sure you can figure out that part.

There might be some third-party solutions for this or other non-obvious ways. If you don't get any better replies here - try Stackoverflow. I believe the cutting edge crowd might have moved over there from SCN lately.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks for the digging. I also tried some approaches using available JavaScript implementations, unfortunately CL_JAVA_SCRIPT produces kernel dumps, what does work is utilizing cl_gui_html_viewer, however this will of course not work on jobs, etc.

So still searching for more usable solutions. This must be available in the common crypto library, but the questions is if and how this is exposed to ABAP.


Try Google -> "use Java library in ABAP", might be some helpful ideas there.


@Jelena : Unfortunately that doesn't help me for a solution inside the ABAP stack.