I want to sign a file using RSA algorithm and verify the signature
Below are the scenarios:
1. Outward files will be put in a folder
3. We need to sign the file with a digital signature (using RSA 256) and send to Central Bank.
4. We need to download the response and verify the signature and then copy the file to a folder.
5. If the signature validation fails, a response needs to be send to Central Bank
The file to sign:
<?xml version="1.0" encoding="UTF-8"?>
< psys:request xmlns:psys="urn:iso:std:psys:request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id>BNZW0M00000DW</id>
<type>CR</type>
<format>MT</format>
<date>2017-04-26T12:21:13</date>
<signature></signature>
<content><![CDATA[{1:F01BNZWOMRXA0011111000000}{2:I102ACHMOMRXA001N}{3:{:113:0100}}{4:
:20:BNZW0M00000DW
:23:CREDIT
:26T:19
:21:BNZW0M00000DW001
:32B:OMR111,
:50K:/123124124
test
:52A:BNZWOMRXA001
:57A:BDOFOMRUA001
:59:/1231234124
test2
:70:
:77B:234234
1
1
:71A:SHA
:32A:170426OMR111,
-}]]></content>
< /psys:request>
After Sign as below:
<?xml version="1.0" encoding="UTF-8"?>
< psys:request xmlns:psys="urn:iso:std:psys:request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id>BNZW0M00000DW</id>
<type>CR</type>
<format>MT</format>
<date>2017-04-26T12:21:13</date>
<signature>UjPx6Z1e7HLZWnhz1uz1LjQFnin/PMjkWDjADrDDOy0AOQdVbp5PwjoJQLzZzZmP5XCmoXKtByRqAzra57LzKdlQF7t4dXD6eG
<content><![CDATA[{1:F01BNZWOMRXA0011111000000}{2:I102ACHMOMRXA001N}{3:{:113:0100}}{4:
:20:BNZW0M00000DW
:23:CREDIT
:26T:19
:21:BNZW0M00000DW001
:32B:OMR111,
:50K:/123124124
test
:52A:BNZWOMRXA001
:57A:BDOFOMRUA001
:59:/1231234124
test2
:70:
:77B:234234
1
1
:71A:SHA
:32A:170426OMR111,
-}]]></content>
< /psys:request>
What I have tried:
I want to sign a file using RSA algorithm and verify the signature. Tried a simple file but didn't work.