How to create JSON Object before Encryption

Note:

Create a JSON object before encryption using the following terminology for the presence of each field:

  • M: Mandatory - The field MUST be present.

  • O: Optional - The field MAY be present.

Java Code for createCertificate(), createPKCS12(), and createCertificateP7B()

CreateX509Entity certUtil = new CreateX509Entity(); 
certUtil.setProfileName(profileName); 
certUtil.setUserName(userName); 
certUtil.setPassword(password); 
certUtil.setSignature(signature); 
certUtil.setSubscriberId(subscriberId);
certUtil.setApplicationId(applicationId);

// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

NET Code for createCertificate(), createPKCS12(), and createCertificateP7B()

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," 
+ "\"userName\":\"" + <User Name> + "\"," 
+ "\"password\":\"" + <Password> "\"," 
+ "\"profileName\":\"" + <Certificate Profile Name> "\"," 
+ "\" subscriberId \":\"" + < subscriberId > + "\"," 
+ "\"applicationId\":\"" + < applicationId> +
"\"}";

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

profileName

M

String

Pass Certificate profile name to be used to create x509Certificate

signature

M

String

Pass the signature (signed data) in section 5 i.e., PKCS#7 data

Note:

To generate the signature (sign data) for createCertificate and createCertificateP7B APIs, pass the CSR.

For createPKCS12 API, generate the signature (sign data) by passing the CSR information in the format below.

“CN=Test123~SERIALNUMBER=04f85bdd24773b66e0bf16b0f59194c78855c7ffcb7c3cf40dce71ba4ff1e91~E=test987@test.com~O=eMudhra~OU=ESS~S=KARNATAKA~C=IN~PostalCode=570004~STREET= Bengaluru~ HOUSEIDENTIFIER=3-88~UID=test877~PSEUDONYM=test098~ PHONE=0123456789~TITLE=Mr~2.5.4.4=kumar~rfc822Name=arjun.kb@emudhra.com~dNSName=www.emudhra.com~dNSName=*.emudhra.com~iPAddress=10.80.106.78~iPAddress=10.80.106.79~registeredID=2.10.100.2.4.5~KeyAlogirthmAndSize=RSA-2048~Password=eMudhra@1”

subscriberId

M

String

Pass the Subscriber ID

applicationId

M

String

Pass application ID (For every transaction request unique application id is required)

Java Code for getcertificate

CertificateDetails certificateDetails = new CertificateDetails(); 
certificateDetails.setUserName(userName); 
certificateDetails.setPassword(password); 
certificateDetails.setSignature(signature);

// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

.Net Code for getcertificate

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> +
"\"password\":\"" + <Password> +
"\"}";

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 (signature) in section 5 i.e., PKCS#7 data

Signed Certificate Serial Number

Jave Code for revoke

RevocationDetails revocationDetails = new RevocationDetails(); 
revocationDetails.setUserName(userName); 
revocationDetails.setPassword(password); 
revocationDetails.setSignature(signature); 
revocationDetails.setRevokeMode(revokeMode); 
revocationDetails.setRemarks(remarks);

// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(revocationDetails);

.Net Code for revoke

string jsonObject = "{
\"signature\":\"" + <signature> + 
"\"," + "\"userName\":\"" + <User Name> +
"\","+ "\"password\":\"" + <Password>  +
"\","+ "\" revokeMode \":\"" + < revokeMode > + 
"\"," + "\" remarks \":\"" + < remarks> +
"\"}";

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 signature (signed data) in section 5 i.e., PKCS#7 data Signed Certificate Serial Number

remarks

M

String

Pass your reason for revocation of certificate

revokeMode

M

Integer

Pass the below values

0 for - Unspecified

1 for - Key Compromise

2 for - CA compromise

3 for - Affiliation

4 for - Superseded

5 for - Cessation of operation

9 for - Privilege withdrawn

10 for - AA Compromise

Java Code for verifysignature

SignatureInput input = new SignatureInput(); 
input.setSignature(signature); 
input.setUserName(userName); 
input.setPassword(password);

// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

.Net Code for verifysignature

string jsonObject = "{
\"signature\":\"" + <signature> + 
"\"," + "\"userName\":\"" + <User Name> +
 "\"," + "\"password\":\"" + <Password> +
"\"}";

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 signature (signed data) in section 5 i.e., PKCS#7 data generated based on the TBS.

Java Code for createCertificateById, createPKCS12ById & createCertificateP7BById

CreateX509Entity certUtil = new CreateX509Entity(); 
certUtil.setProfileID(profileID); 
certUtil.setUserName(userName); 
certUtil.setPassword(password); 
certUtil.setSignature(signature); 
certUtil.setSubscriberId(subscriberId); 
certUtil.setValidity(validity); 
certutil.setValidFrom(validFrom); 
certutil.setApplicationId(applicationId);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

.Net Code for createCertificateById, createPKCS12ById & createCertificateP7BById

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," + 
"\"profileID\":\"" + <Certificate Profile Id> + "\"," +
"\"validity\":\"" + <Validity> + "\"," + 
"\"validFrom\":\"" + < validFrom > + "\"," + 
"\"subscriberId \":\"" + <SubscriberId> + "\"," +
"\"applicationId \":\"" + < applicationId> +
"\"}";

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.

ProfileID

M

String

Pass Certificate profile name to be used to create x509Certificate.

signature

M

String

Pass the signed data in section 5 i.e., PKCS#7 data

Note:

To generate the signature (sign data) for createCertificateById and createCertificateP7BById APIs, pass the CSR.

For the createPKCS12ById API, generate the signature (sign data) by passing the CSR information in the format below.

“CN=Test123~SERIALNUMBER=04f85bdd24773b66e0bf16b0f59194c78855c7ffcb7c3cf40dce71ba4ff1e91~E=test987@test.com~O=eMudhra~OU=ESS~S=KARNATAKA~C=IN~PostalCode=570004~STREET= Bengaluru~ HOUSEIDENTIFIER=3-88~UID=test877~PSEUDONYM=test098~ PHONE=0123456789~TITLE=Mr~2.5.4.4=kumar~rfc822Name=arjun.kb@emudhra.com~dNSName=www.emudhra.com~dNSName=*.emudhra.com~iPAddress=10.80.106.78~iPAddress=10.80.106.79~registeredID=2.10.100.2.4.5~KeyAlogirthmAndSize=RSA-2048~Password=eMudhra@1”

subscriberId

M

String

Pass the Subscriber ID.

validity

O

String

Pass the validity in the form of (Days : Hours : Minutes : Seconds)

Days – 36135 (maximum days)

Hours - 23 (max hours)

Minutes - 59 (max minutes)

Seconds - 59 (max seconds)

to create certificate with the given validity.

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 the certificate.

This parameter only applies if the user certificate profile has ‘Support Customized Validity’.

Java Code for Suspend

RevocationDetails revocationDetails = new RevocationDetails();
revocationDetails.setUserName(userName); 
revocationDetails.setPassword(password);
revocationDetails.setSignature(signature); 
revocationDetails.setRevokeMode(revokeMode); 
revocationDetails.setRemarks(remarks);

// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(revocationDetails);

.Net Code for Suspend

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," +
"\" revokeMode \":\"" + < revokeMode > + "\"," + 
"\" remarks \":\"" + < remarks > "\"," +
"\"}";

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 Certificate Serial Number

revokeMode

M

Integer

6 for - Certificate hold (Suspension)

remarks

M

String

Pass your reason for revocation of certificate

Java Code for reinstate

ReinstateDetails reinstateDetails = new ReinstateDetails();

reinstateDetails.setSignature(signature); 
reinstateDetails.setUserName(userName); 
reinstateDetails.setPassword(password); 
reinstateDetails.setRemarks(remarks);


// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(reinstateDetails);

.Net Code for reinstate

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," +
 "\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," + 
"\" remarks \":\"" + < remarks > +
"\"}";

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 Certificate Serial Number

remarks

M

String

Pass your reason to reinstate the certificate

Java Code for rekey

ReIssueCertificate reIssueCert = new ReIssueCertificate(); 
reIssueCert.setSerialNum(serialNum); 
reIssueCert.setSignature(signature); 
reIssueCert.setUserName(userName); 
reIssueCert.setPassword(password); 
reIssueCert.setRemarks(remarks); 
reIssueCert.setValidFrom(validFrom); 
reIssueCert.setApplicationId(applicationId);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(reIssueCert);

.Net Code for rekey

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," +
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," +
"\" serialNumber\":\"" + < SerialNumber> + "\"," +
"\" remarks \":\"" + < Remarks > + "\"," +
"\" validFrom \":\"" + < validFrom > + "\"," +
"\" applicationId \":\"" + < ApplicationId > +
"\"}";

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’.

Java Code for getCertificateByRequestID

CreateCertificate userRequest=new CreateCertificate();
String signdata = getSigndata(requestId.getBytes()); 
userRequest.setPassword(password); 
userRequest.setUserName(userName);
userRequest.setSignature(signature);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(userRequest);

.Net Code for getCertificateByRequestID

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> +
"\"}";

Java Code for createCustomCertificateById

CreateX509Entity certUtil = new CreateX509Entity(); 
certUtil.setProfileID(profileID); 
certUtil.setUserName(userName); 
certUtil.setPassword(password); 
certUtil.setSignature(signature); 
certUtil.setSubscriberId(subscriberId); 
certUtil.setValidity(validity); 
certutil.setValidFrom(validFrom); 
certutil.setsANValues(sANValues); 
certutil.setSubjectDNOids(subjectDNOids);
certutil.setP7Brequest(Boolean.parseBoolean(certificateTyperequest)); 
certUtil.setApllicationId(applicationId);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

.Net Code for createCustomCertificateById

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," +
"\"profileID\":\"" + <Certificate Profile Id> + "\"," +
"\"validity\":\"" + <Validity> + "\"," + 
"\"validFrom\":\"" + < validFrom > + "\"," + 
"\"isP7Brequest \":\"" + < isP7Brequest > + "\"," + 
"\"subscriberId \":\"" + <SubscriberId> + "\"," +
"\"sANValues \":\"" + <sANValues> + "\"," +
"\"subjectDNOids\":\"" + <subjectDNOids> +
"\" applicationId\":\"" + < applicationId> +
"\"}";

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.

profileID

M

String

Pass Certificate profile name to be used to create x509Certificate.

signature

M

String

Pass the signed data in section 5 i.e., PKCS#7 data

Signed CSR Data

subscriberId

M

String

Pass the Subscriber ID.

validity

O

String

Pass the validity in the form of (Days : Hours : Minutes : Seconds)

Days – 36135 (maximum days)

Hours - 23 (max hours)

Minutes - 59 (max minutes)

Seconds - 59 (max seconds)

to create certificate with the given validity.

sANValues

M

String

Pass sANValues to be used to createCustomCertificateById

Example:

"rfc822Name=test@gmail.com|dNSName=www.e xample.com|iPAddress=127.0.0.1|registeredID=2. 10.100.2.4.5"

Note: If sAN values are not available then pass it as empty string.

Java Code for getExpirySoonCertificate

CreateCertificate createX509Entity= new CreateCertificate(); 
createX509Entity.setUserName(userName); 
createX509Entity.setPassword(password); 
createX509Entity.setSignature(signature); 
createX509Entity.setSubscriberId(subscriberId);

.Net Code for getExpirySoonCertificate

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," +
"\"subscriberId \":\"" + <SubscriberId> +
"\"}";

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 Data will be No. of Days to get the expiry soon certificates.

subscriberId

O

String

Pass the Subscriber ID.

Java code for getProfileinfoByProfilename

CreateCertificate createX509Entity= new CreateCertificate(); 
createX509Entity.setUserName(userName); 
createX509Entity.setPassword(password); 
createX509Entity.setSignature(signature); 

.Net Code for getProfileinfoByProfilename

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> +
"\"}";

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 data will be user certificate profile name

Java Code for getCertificateProfileList

CreateCertificate createX509Entity= new CreateCertificate(); 
createX509Entity.setUserName(userName); 
createX509Entity.setPassword(password); 
createX509Entity.setSignature(signature); 

.Net Code for

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + "\"userName\":\"" + <User Name> +
"\"password\":\"" + <Password> +
}";

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 Data will be CAName

Java Code for createCertificatesByIdWithMultipleCsrData

CreateX509Entity certUtil = new CreateX509Entity(); 
certUtil.setProfileID(profileID); 
certUtil.setUserName(userName); 
certUtil.setPassword(password); 
certUtil.setSignature(signature); 
certUtil.setSubscriberId(subscriberId); 
certUtil.setValidity(validity); 
certutil.setValidFrom(validFrom); 
certutil.setApplicationId(applicationId);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); 
String json = ow.writeValueAsString(certUtil);

.Net Code for

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," +
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," + 
"\"profileID\":\"" + <Certificate Profile Id> + "\"," +
"\"validity\":\"" + <Validity> + "\"," +
"\"validFrom\":\"" + < validFrom > + "\"," + 
"\"subscriberId \":\"" + <SubscriberId> + "\"," + 
"\"applicationId \":\"" + < applicationId> +
}";

Multi-CSR Request PDF

create a PDF format like below, convert it to a base64 encoded string, and then sign the same string to generate the signature, you can follow these steps:

Here 1001, 1002 etc. is csr request id and other data is csr data for specific request id.

CSRDATA 
{  
"1001": 
"MIIBRDCB6wIBADCBiDEhMB8GCSqGSIb3DQEJARYSYW51cC5rQGVtdWRocmEuY29tMRIwEAYDVQQUEwk1Njc4OTA0MzIxGDAWBgNVBAcTD01hemFyaSBUYWtoYXlpbDEPMA0GA1UEAxMGTmlraGlsMQ0wCwYDVQQIEwRIYWlsMRUwEwYDVQQGEwxTYXVkaSBBcmFiaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJeVEW9b4aUQ9/f0ZskbrTXTzp//YRQW8iGvSirM3FTeW4VwJ3QRS16nbRiBKghhqJIroE8m9bchXmDcwVk2MwoAAwCgYIKoZIzj0EAwIDSAAwRQIgIIwWD0ZImPjLESKurtluxFAKJxHNJFinVIdlrvAKukYCIQC1g/dZWKwQ+mIQ/mgBgkdNQIkrG+A7 CarlFOpjSN3bvA==",  
"1002": 
"MIIBRDCB6wIBADCBiDEhMB8GCSqGSIb3DQEJARYSYW51cC5rQGVtdWRocmEuY29tMRIwEAYDVQQUEwk1Njc4OTA0MzIxGDAWBgNVBAcTD01hemFyaSBUYWtoYXlpbDEPMA0GA1UEAxMGTmlraGlsMQ0wCwYDVQQIEwRIYWlsMRUwEwYDVQQGEwxTYXVkaSBBcmFiaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJeVEW9b4aUQ9/f0ZskbrTXTzp//YRQW8iGvSirM3FTeW4VwJ3QRS16nbRiBKghhqJIroE8m9bchXmDcwVk2MwoAAwCgYIKoZIzj0EAwIDSAAwRQIgIIwWD0ZImPjLESKurtluxFAKJxHNJFinVIdlrvAKukYCIQC1g/dZWKwQ+mIQ/mgBgkdNQIkrG+A7 CarlFOpjSN3bvA==", 
 "1003": 
"MIIBRDCB6wIBADCBiDEhMB8GCSqGSIb3DQEJARYSYW51cC5rQGVtdWRocmEuY29tMRIwEAYDVQQUEwk1Njc4OTA0MzIxGDAWBgNVBAcTD01hemFyaSBUYWtoYXlpbDEPMA0GA1UEAxMGTmlraGlsMQ0wCwYDVQQIEwRIYWlsMRUwEwYDVQQGEwxTYXVkaSBBcmFiaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJeVEW9b4aUQ9/f0ZskbrTXTzp//YRQW8iGvSirM3FTeW4VwJ3QRS16nbRiBKghhqJIroE8m9bchXmDcwVk2MwoAAwCgYIKoZIzj0EAwIDSAAwRQIgIIwWD0ZImPjLESKurtluxFAKJxHNJFinVIdlrvAKukYCIQC1g/dZWKwQ+mIQ/mgBgkdNQIkrG+A7 CarlFOpjSN3bvA==",  
"1004": 
"MIIBRDCB6wIBADCBiDEhMB8GCSqGSIb3DQEJARYSYW51cC5rQGVtdWRocmEuY29tMRIwEAYDVQQUEwk1Njc4OTA0MzIxGDAWBgNVBAcTD01hemFyaSBUYWtoYXlpbDEPMA0GA1UEAxMGTmlraGlsMQ0wCwYDVQQIEwRIYWlsMRUwEwYDVQQGEwxTYXVkaSBBcmFiaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJeVEW9b4aUQ9/f0ZskbrTXTzp//YRQW8iGvSirM3FTeW4VwJ3QRS16nbRiBKghhqJIroE8m9bchXmDcwVk2MwoAAwCgYIKoZIzj0EAwIDSAAwRQIgIIwWD0ZImPjLESKurtluxFAKJxHNJFinVIdlrvAKukYCIQC1g/dZWKwQ+mIQ/mgBgkdNQIkrG+A7 CarlFOpjSN3bvA==",  
"1005": 
"MIIBRDCB6wIBADCBiDEhMB8GCSqGSIb3DQEJARYSYW51cC5rQGVtdWRocmEuY29tMRIwEAYDVQQUEwk1Njc4OTA0MzIxGDAWBgNVBAcTD01hemFyaSBUYWtoYXlpbDEPMA0GA1UEAxMGTmlraGlsMQ0wCwYDVQQIEwRIYWlsMRUwEwYDVQQGEwxTYXVkaSBBcmFiaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJeVEW9b4aUQ9/f0ZskbrTXTzp//YRQW8iGvSirM3FTeW4VwJ3QRS16nbRiBKghhqJIroE8m9bchXmDcwVk2MwoAAwCgYIKoZIzj0EAwIDSAAwRQIgIIwWD0ZImPjLESKurtluxFAKJxHNJFinVIdlrvAKukYCIQC1g/dZWKwQ+mIQ/mgBgkdNQIkrG+A7 CarlFOpjSN3bvA==" 
}

Java Code for createeSignCustomCertificateById

CreateX509Entity certUtil = new CreateX509Entity(); 
certUtil.setProfileID(certId); 
certUtil.setUserName(userName); 
certUtil.setPassword(password); 
certUtil.setSignature(signature); 
certUtil.setSubscriberId(subscriberId); 
certUtil.setValidity(validity); 
certutil.setValidFrom(validFrom); 
certutil.setsANValues(SANValues); 
certutil.setSubjectDNOids(subjectDNOids);
certutil.setP7Brequest(Boolean.parseBoolean(certificateTyperequest));
certUtil.setApllicationId(applicationId);
// Converting the class object to Json
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); String json = ow.writeValueAsString(certUtil);

.Net Code for createeSignCustomCertificateById

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> + "\"," +
"\"profileID\":\"" + <Certificate Profile Id> + "\"," +
"\"validity\":\"" + <Validity> + "\"," + 
"\"validFrom\":\"" + < validFrom > + "\"," + 
"\"isP7Brequest \":\"" + < isP7Brequest > + "\"," + 
"\"subscriberId \":\"" + <SubscriberId> + "\"," +
"\"sANValues \":\"" + <sANValues> + "\"," +
"\"subjectDNOids\":\"" + <subjectDNOids> +
"\" applicationId\":\"" + < applicationId> +
"\"}";

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.

profileID

M

String

Pass Certificate profile name to be used to create x509Certificate.

signature

M

String

Pass the signed data in section 5 i.e., PKCS#7 data

Signed CSR Data

subscriberId

M

String

Pass the Subscriber ID.

validity

O

String

Pass the validity in the form of (Days : Hours : Minutes : Seconds)

Days – 36135 (maximum days)

Hours - 23 (max hours)

Minutes - 59 (max minutes)

Seconds - 59 (max seconds)\

to create certificate with the given validity.

sANValues

M

String

Pass sANValues to be used to createCustomCertificateById

Example:

"rfc822Name=test@gmail.com|dNSName=www.e xample.com|iPAddress=127.0.0.1|registeredID=2. 10.100.2.4.5"

Note: If sAN values are not available then pass it as empty string.

subjectDNOids

M

String

Pass subjectDNOids to be used to createCustomCertificateById

Example: “2.5.4.3|Test~2.5.4.6|India~2.5.4.8|Delhi~2.5.4.7|test~2.5.4.5|77686868687~2.5.4.10|Personal~1.2.840.113549.1.9.1|test@gmail.com~2.5.4.12|test”

validFrom

O

String

Pass the validityFrom in the form of

(dd:MM:yyyy HH:mm:ss)

This parameter applies if the user certificate profile has ‘Support Customized Validity’.

isP7BRequest

M

String

String Pass “true” for p7b Certificate and “false” for .cer Certificate.

applicationId

M

String

Pass application ID.

Java Code for getPKCS12

GetKRSPkcs12 getKRSPkcs12 = new CreateCertificate();
getKRSPkcs12.setPassword(password);
getKRSPkcs12.setUserName(userName);
getKRSPkcs12.setSignature(signature);

.Net Code for getPKCS12

string jsonObject = "{
\"signature\":\"" + <signature> + "\"," + 
"\"userName\":\"" + <User Name> + "\"," +
"\"password\":\"" + <Password> +
"\"}";

signature

M

String

Generate the Signed data by passing the pfxPin, serialNumber, subscriberId

Example :

{'pfxPin': 'eMudhra@1','serialNumber':'71403fca726c27ca2ac936f3bc3f6c21','subscriberId':'12345'}

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.

Last updated