API Method -createCertificate and createCertificateP7B
Purpose
Use the “createCertificate” and “createCertificateP7B” method for creating the X509 certificate based on the profile selection.
Type of Method
POST
Request URL
http://www.example.com/emCAServices/rest/createCertificate http://www.example.com/emCAServices/rest/createCertificateP7B
Request Input Parameters
Parameter
Presence
Data Type
Description
signature
M
String
CSR file has to be generated and signed with PFX shared by us.
Pass Signed CSR data i.e., PKCS#7 data.
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.
subscriberId
M
String
Pass the Subscriber ID.
applicationId
M
String
Pass the application ID.
profileName
M
String
Pass Certificate profile name to be used to create x509Certificate.
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 the 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 emCA service, we will decrypt the request JSON Object with same AES key that is shared to the client.
After successful decryption, request JSON object (Signed CSR data+Username+Password+ Profile Name+ Subscriber ID+ Application ID) is retrieved.
First emCA service will validate username and password and check if the IP Address used for request is registered with the same user.
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 the applicationId then return existing certificate.
If certificate is not created for applicationId then we create certificate using next step.
If it is same then signed CSR data (signature) is validated by checking whether CSR is signed by the same PFX file which is registered for the specific user.
If validation fails at any point in processing the request, the emCA service will throw error/failure message. (Refer error messages section)
Response Parameters
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 selected certificate profile and generates x509 certificate.
Returns status of the request as failure when 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
Returns Subscriber Id
requestId
String
Return request ID when user is manually authorized and request accepted successfully. Otherwise it will return null.
Response JSON Format
Sample for base 64 encoded x509 certificate data
Error Messages
Error Message
Description
Invalid Certificate Profile
If the given certificate profile Name is invalid
Signature verification failed
If signature parameter (CSR) is not signed by the pfx shared by eMudhra
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.
Last updated