API Method -rekey
Purpose
Use the “rekey” method for creating certificate in case an existing certificate is lost.
Type of Method
POST
Request URL
http://www.example.com/emCAServices/rest/rekey
Request Input Parameters
Parameter | Presence | Data Type | Description |
userName | M |
String | You need to pass username that is registered with emCA for API process. |
password | M |
String | You need to pass the password that is registered with emCA for API process. |
signature | M | String | Pass the signed data in section 5 i.e., PKCS#7 data Signed CSR Data |
remarks | M |
String |
Pass your Reason to rekey the certificate |
serialNo | M | String | Certificate Serial number |
applicationId | M | String |
Pass application ID |
ValidFrom | O | String | Pass the valid from in the form of (dd:MM:yyyy HH:mm:ss) to create certificate.
This parameter applies if the user certificate profile has ‘Support Customized Validity’. |
Sample JSON Object
Parameter | Presence | Data Type | Description |
requestData | M | String | All the request input parameters mentioned above should be converted to JSON object and encrypted with AES 256 key shared with you by emCA team. Pass Encrypted JSON Object. |
userName | M | String | You need to pass username that is registered with emCA for API process. |
Header Details
Key | Presence | Value | Description | |
Application / JSON | M | Content-Type | Type of request should be in JSON Format. | |
Authentication Key | M | emKey | emKey is an encoded key (Refer section 4 for generating Authentication Key using command prompt). |
Sample Request Data
Process
When request is received by the emCA service, we will decrypt the request JSON Object with the same AES key that is shared with the client.
After successful decryption, request JSON object (Signed data + Username + Password + serialNum + remarks+ Valid From+ Application ID) is retrieved.
First the emCA service will validate username and password and check if the IP Address used for request and registered with the user are same.
If request is registered with the same user, then we check if the certificate is already created for requested applicationId or not.
if certificate is already created for applicationId then return existing certificate.
if certificate is not created for applicationId then we will create the certificate using next step.
If it is same then signed data (signature) is validated by trust verification, CRL verification and expiry.
If validation fails at any point in processing the request, emCA service will throw error/failure message.
Response Parameters
Parameter | Data Type | Description |
Parameter |
Data Type |
Description |
response |
String |
Returns JSON Object |
JSON Object Contains below parameters
Parameter |
Data Type |
Description |
status |
String |
Returns Status of the request as success if CSR is signed by the selected certificate profile id and generates x509 certificate. Returns status of the request as failure if authentication fails or unregistered user tries to call the API. |
result |
String |
Returns In case of success: base 64 encoded x509 certificate data In case of failure: Error message will be displayed. |
subscriberId |
String |
Return Subscriber ID. |
requestId |
String |
Return Request ID null. |
Response JSON Format
Error Messages
Error Message | Description |
Invalid serial number | If the given serial number is invalid |
Please enter valid data | If the signature parameter (CSR) contains an invalid CSR or if the CSR does not contain the required details of the selected certificate profile. |
Signature verification failed | If signature parameter (CSR) is not signed by the pfx shared by eMudhra |
Invalid From Date | Invalid Input: From Date should be in proper format dd:MM:YYYY hh:mm:ss e.g: 12:12:2019 00:00:00 |
Last updated