---
page_title: Generating the Signature
product: UPI TPAP SDK
platform: Cordova
page_source: https://juspay.io/in/docs/upi-tpap-sdk/cordova/resources/generating-the-signature
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/upi-tpap-sdk/llms.txt
---


# Generating the Signature




---



## **Generating the RSA Key Pair** 



Merchant must securely generate 2048 bit RSA Public Private Key pair on their servers inside a crypto vault. Merchant must share the Public Key (KeyFormat-PEM) with Juspay during onboardingPrivate key must be securely kept in a crypto vault on the merchant servers. Private key should never flow to the client.

> **Note**
> To simplify integration on sandbox, we have already shared a set of auto-generated keys which need to be configured. Please make sure a new set of keys is generated for production prior to go-live.



The below command would generate a private key file **private-key.pem** 


#### Command Line Code Snippet:

```command line
{"success":false,"message":"Failed to fetch snippet"}
```


The below command would generate a public key file **public-key.pem**  for the private key file generated via above command


#### Command Line Code Snippet:

```command line
{"success":false,"message":"Failed to fetch snippet"}
```



## **Signing the Payload** 




| Algorithm | Format |
|---|---|
| RSA-SHA256 | HEX; base 64 encoded |


JSON payload needs to be signed after converting it to String using the Private key stored on the merchant server. The signature shall be in **Base 64 encoded format.** 

> **Warning**
> The JSON payload converted to a string that is to be signed, which makes a signature, should exactly be the same as the string that is to be passed in the signature payload field.




### **Sample Code Snippet** 




#### Java Code Snippet:

```java
{"success":false,"message":"Failed to fetch snippet"}
```

#### Alternate Java (below JDK 11) Code Snippet:

```alternate java (below jdk 11)
{"success":false,"message":"Failed to fetch snippet"}
```

#### Python Code Snippet:

```python
{"success":false,"message":"Failed to fetch snippet"}
```

#### PHP Code Snippet:

```php
{"success":false,"message":"Failed to fetch snippet"}
```

#### Node.js Code Snippet:

```node.js
{"success":false,"message":"Failed to fetch snippet"}
```

#### C# Code Snippet:

```c#
{"success":false,"message":"Failed to fetch snippet"}
```

#### Ruby Code Snippet:

```ruby
{"success":false,"message":"Failed to fetch snippet"}
```




---

## See Also

- [Additional Parameters](https://juspay.io/in/docs/upi-tpap-sdk/cordova/miscellaneous/additional-parameters)
- [Error Codes](https://juspay.io/in/docs/upi-tpap-sdk/cordova/resources/error-codes)
