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

requestData
{
"signature": "axcns/EEczS5nGivHuOHFabnKQhsRNPJLQq7AJnQtGWbl7DgU9WoSLbHf4cvBKozlMnU5E7XOwkxhbQm NQrxv12KAG2F5OYvZosUXaLbp0g3T1V3YRXn3KV74cPY7LM4uO62eHEWJ80PYB+pmXOPxLqGFPNsdvZ/A
+HPkuHpTnnjmUxqO8hDuHEc1y00hxJvasDEXzNU5SuDNWADQNYn45SJU+6H+9ty4GTfzjrNRaLvLHNQgQ 1lFkYEU5Fra8QiZWDqeH6F4h6D+CspxpGxFp4jqOddBvWhWmutSobjJItxEuRjCKaE2w/SPAguY9JKudl FmuPz0uIV4BAkTwFgKw==",
“userName” : "username" “password” : "password"
“profileName” : "Class2IndividualSignatureOneyear" “subscriberId” : "XXX",
                 “applicationId” : "XXX"
}

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

Header:
            Content-Type : application/json
           emKey	: 47b54594063957de22fce0aeddd51a6adf4a80aa

Request Body:
{
 
"requestData":"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 6slznkXDqn2WB1iWWU6ml3rmZj07C8Icz9HPFLeC8Wa0VDkEEvN/ICy5TiXr93+IKoUeTX2Bc9sDehdR Ou3y4v68rGNIlvXm1kqM+YZjruBDonry8cjDjNGV9n23ggOIqVbQyVWD+TgXk4GeUthXJEzhIiTqC5Wp 3XwA2m65gLls5e8V5hP76CDiHCV3yAHIt16R03SV1USTFGI9IuAt2FVVPFSmDQeD",
"userName":"username"
}

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.

  1. If certificate is already created for the applicationId then return existing certificate.

  2. 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:
Success:
Response Body()
{
"status":"success",
"result":"base 64 encoded x509 certificate	data",
“subscriberId”:”XXX” "requestId": null, 
}


Response Body (Is Manual Authorization Enabled is checked from emCA )
{
"status": "Success",
"result": " your request proceded sucssusfully", "subscriberId": "XXXX",
"requestId": “XXXX”,
}
Failure:
{
"status":"failure", "result":"<Error message>" “subscriberId”:null "requestId": null,
}

Sample for base 64 encoded x509 certificate data

"    MIIDFjCCAf6gAwIBAgIDLcbYMA0GCSqGSIb3DQE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ate 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