<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: REST API - Convert XML   to Base64 encoding with SHA 1 algorithm using Private key encryption in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/rest-api-convert-xml-to-base64-encoding-with-sha-1-algorithm-using-private/m-p/12539686#M2006018</link>
    <description>&lt;P&gt;Hi Mr. Robert, &lt;/P&gt;&lt;P&gt;Thanks a lot for sharing this,&lt;/P&gt;&lt;P&gt;As per your explanation, &lt;EM&gt;I tried with xml body as massage and passing public and private keys same as explained, result am passing to &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'&lt;/P&gt;&lt;P&gt;while testing third party url on SOAP UI, invalid signature error coming. &lt;/P&gt;&lt;P&gt;My issue is how to applying "Base64 encoded signature value of the &amp;lt;Body&amp;gt; segment of the XML document, HASH algorithm  used is SHA1." &lt;/P&gt;&lt;P&gt;Can you help me  , &lt;/P&gt;&lt;P&gt;Thanks in advance. &lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 14:21:00 GMT</pubDate>
    <dc:creator>former_member778170</dc:creator>
    <dc:date>2022-02-15T14:21:00Z</dc:date>
    <item>
      <title>REST API - Convert XML   to Base64 encoding with SHA 1 algorithm using Private key encryption</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rest-api-convert-xml-to-base64-encoding-with-sha-1-algorithm-using-private/m-p/12539685#M2006017</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;We have a new requirement to send XML data to the client url using REST API, which requires "base64 encoded signature value of the &amp;lt;&lt;STRONG&gt;&lt;EM&gt;Body&lt;/EM&gt;&lt;/STRONG&gt;&amp;gt; segment of the XML document, Hash algorithm used is SHA-1" which also uses the private and public keys to encrypt and decrypt. &lt;/P&gt;
  &lt;P&gt;By applying the below code we are able to generate XML body with the Base64 encoded along with SHA 1 algorithm, &lt;/P&gt;
  &lt;P&gt;But we are not able to figure out the use of private key to encrypt the XML Body, as our client needs public key to decrypt the same. &lt;/P&gt;
  &lt;P&gt;Could you advice how to achieve it, thank you. &lt;/P&gt;
  &lt;P&gt;data : P_INPUT TYPE STRING. &lt;/P&gt;
  &lt;P&gt;P_INPUT = '&amp;lt;Body&amp;gt;&amp;lt;BillPaymentRequestMessage&amp;gt;&amp;lt;BillPaymentRequest&amp;gt;&amp;lt;BillPaymentRef&amp;gt;3666236&amp;lt;/BillPaymentRef&amp;gt;&amp;lt;SourceAccountNumber&amp;gt;2300829689940&amp;lt;/SourceAccountNumber&amp;gt;&amp;lt;BillAmount&amp;gt;219,56&amp;lt;/BillAmount&amp;gt;&amp;lt;/BillPaymentRequest&amp;gt;&amp;lt;/BillPaymentRequestMessage&amp;gt;&amp;lt;/Body&amp;gt;'.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt; CALL FUNCTION 'SCMS_STRING_TO_XSTRING'&lt;BR /&gt; EXPORTING&lt;BR /&gt; TEXT = P_INPUT&lt;BR /&gt; IMPORTING&lt;BR /&gt; BUFFER = LV_XSTRING&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; FAILED = 1&lt;BR /&gt; OTHERS = 2.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; LV_LEN = XSTRLEN( LV_XSTRING ).&lt;BR /&gt;&lt;BR /&gt; CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'&lt;BR /&gt; EXPORTING&lt;BR /&gt; INPUT = LV_XSTRING&lt;BR /&gt; IMPORTING&lt;BR /&gt; OUTPUT = LV_BASE64.&lt;BR /&gt;&lt;BR /&gt; DATA ALG TYPE HASHALG.&lt;BR /&gt; DATA DATA TYPE STRING.&lt;BR /&gt; DATA LENGTH TYPE I.&lt;BR /&gt;&lt;BR /&gt; DATA HASHB64STRING TYPE STRING.&lt;BR /&gt;&lt;BR /&gt; CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'&lt;BR /&gt; EXPORTING&lt;BR /&gt; ALG = 'SHA1'&lt;BR /&gt; DATA = LV_BASE64&lt;BR /&gt; LENGTH = LV_LEN&lt;BR /&gt; IMPORTING&lt;BR /&gt; HASHB64STRING = HASHB64STRING&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; UNKNOWN_ALG = 1&lt;BR /&gt; PARAM_ERROR = 2&lt;BR /&gt; INTERNAL_ERROR = 3&lt;BR /&gt; OTHERS = 4.&lt;BR /&gt; IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;BR /&gt;* Implement suitable error handling here&lt;BR /&gt; ENDIF.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 13:58:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rest-api-convert-xml-to-base64-encoding-with-sha-1-algorithm-using-private/m-p/12539685#M2006017</guid>
      <dc:creator>former_member778170</dc:creator>
      <dc:date>2021-11-25T13:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Convert XML   to Base64 encoding with SHA 1 algorithm using Private key encryption</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rest-api-convert-xml-to-base64-encoding-with-sha-1-algorithm-using-private/m-p/12539686#M2006018</link>
      <description>&lt;P&gt;Hi Mr. Robert, &lt;/P&gt;&lt;P&gt;Thanks a lot for sharing this,&lt;/P&gt;&lt;P&gt;As per your explanation, &lt;EM&gt;I tried with xml body as massage and passing public and private keys same as explained, result am passing to &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'&lt;/P&gt;&lt;P&gt;while testing third party url on SOAP UI, invalid signature error coming. &lt;/P&gt;&lt;P&gt;My issue is how to applying "Base64 encoded signature value of the &amp;lt;Body&amp;gt; segment of the XML document, HASH algorithm  used is SHA1." &lt;/P&gt;&lt;P&gt;Can you help me  , &lt;/P&gt;&lt;P&gt;Thanks in advance. &lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 14:21:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rest-api-convert-xml-to-base64-encoding-with-sha-1-algorithm-using-private/m-p/12539686#M2006018</guid>
      <dc:creator>former_member778170</dc:creator>
      <dc:date>2022-02-15T14:21:00Z</dc:date>
    </item>
  </channel>
</rss>

