Quantcast
Channel: SCN: Message List - Security
Viewing all articles
Browse latest Browse all 5338

Re: Problem with digital signature of documents

$
0
0

Martin, as you said, the problem was the PKCS#7 format.

 

In a communication problem, I was told that the application works with that format, whereas in reality is working with PKCS#1 - V1.5

 

I just have to search for a FM that support that format, like SSFW_KRN_SIGN.

 

This FM calculates the MD, and sign it, so it was easier than I originally thought.

 

This is the FM call that I'm using, just in case someone needs the code:

 

* Leemos los parametros definidos en la SSFA

CALL FUNCTION 'SSF_GET_PARAMETER'

   EXPORTING

     application             = 'INTBAN'

   IMPORTING

     str_profileid           = lv_profileid

     str_profile             = lv_str_profile

   EXCEPTIONS

     ssf_parameter_not_found = 1

     OTHERS                  = 2.

 

*Cargamos la tabla con el encargado de firmar

lw_signer-id = lv_profileid.

lw_signer-profile = lv_str_profile.

INSERT lw_signer INTO TABLE lt_signer.

 

*Calculamos MD del documento (SHA1), y firmamos

CALL FUNCTION 'SSFW_KRN_SIGN'

   EXPORTING

     str_format                   = 'PKCS1-V1.5'

     str_hashalg                  = 'SHA1'

     ostr_input_data              = lv_xstring_data_to_sign

   IMPORTING

     ostr_signed_data             = lv_xstring_signed_data

   TABLES

     signer                       = lt_signer

   EXCEPTIONS

     ssf_krn_error                = 1

     ssf_krn_noop                 = 2

     ssf_krn_nomemory             = 3

     ssf_krn_opinv                = 4

     ssf_krn_nossflib             = 5

     ssf_krn_signer_list_error    = 6

     ssf_krn_input_data_error     = 7

     ssf_krn_invalid_par          = 8

     ssf_krn_invalid_parlen       = 9

     ssf_fb_input_parameter_error = 10

     OTHERS                       = 11.


Where lv_xstring_data_to_sign is just a xstring with the document that I have to sign.


Regards!

--

German Guzelj


Viewing all articles
Browse latest Browse all 5338

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>