Encryption of hash

Job ID: 33608519

Budget: $30 – $250 USD

We need assistance to encrypt a hash for a software we are writing in JavaScript . The software is a middleware which sends data to an api , in order to connect with the api we need to encrypt the hash with the below requirements and send it to the api server.

The project is time sensitive it needs to be completed in a few days.

1) Convert HASH of the respective request into Byte array using UTF-8.
2) Take instance of Cipher “RSA/ECB/OAEPWithSHA-256AndMGF1Padding”.
a. RSA - PKCS#1 Ver. 1.5
b. ECB - is a place holder or use NONE (FIPS 140-2)
c. OAEPWithSHA-256
d. AndMFG1Padding (SHA1 is used for OAEP’s MFG1Padding)
3) Convert TIMS Public key string (2048 Bit RSA Public Key as sent during Handshaking by TIMS while pairing) to Byte array using Base64 decoder.
4) Get X509 specification Key object from Byte array derived from Step 3.
5) Generate public key object from X509 specification key object as derived from
Step 4 using RSA algorithm.
6) Encrypt Byte array data as derived from step 1 using Cipher initiated from step 2 and X509 specification Public Key as derived from step 5.
7) Convert encrypted byte array data as derived from step 6 to Character array using Hex encoding.
8) Convert the character array as derived from step 7 to String.
9) The string as derived from step 8 is the final encrypted HASH which needs to
be sent in <HASH/> tag of the respective request.

Hash should be calculated based on signature given below:
Signature:
TypeofMiddleware + DateOfTransaction + NumberOFLastInvoiceSent + PINOfSeller + MiddlewareSerialNumber
Related categories: JavaScript Web Security