Verify Document

The API is verifying the documents by uploading the signed document.

Sequence to call API for Verify Document

Source Code Sample

File uploadFile = new File("C:\\Users\\demo_stg.pdf");
String uploadFileHash = Utils.calculateHash(Files.readAllBytes(uploadFile.toPath()));
		 
jsonData = new JSONObject();
jsonData.put("verifyFileHash", uploadFileHash);
String uploadFileData = Hex.encodeHexString(Utils.aesEcbPkcs5PaddingEncrypt(jsonData.toString(),apiSecret));
String uploadFileMac = Utils.calculateMac(uploadFileData,apiSecret);
		      
FileBody fileBody = new FileBody(uploadFile, ContentType.DEFAULT_BINARY);
StringBody stringBody1 = new StringBody(uploadFileMac, ContentType.MULTIPART_FORM_DATA);
StringBody stringBody2 = new StringBody(uploadFileData, ContentType.MULTIPART_FORM_DATA);
StringBody stringBody3 = new StringBody(at, ContentType.MULTIPART_FORM_DATA);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
		  	  builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addPart("verifyFile", fileBody);
builder.addPart("accesstoken", stringBody3);
builder.addPart("mac", stringBody1);
builder.addPart("data", stringBody2);
HttpEntity entity = builder.build();
		  	
postRequest.setEntity(entity);
HttpResponse httpResponse = httpclient.execute(target,postRequest);
entity = httpResponse.getEntity();
if (entity != null) {
	String response=EntityUtils.toString(entity);	 
		      }
Sample code to prepare raw data object to verify document

Request Body Creation

{
    "verifyFileHash":"9f9dcc03649d5f4e3bd9b60cae3874ab776e55e576373c659",
    "verifyFile":"C:\/Users\/.....\/demo_stg.pdf"
}

Example of Request

https://<domain>/signserver/v1/contract/signature/verify?accesstoken=1f710ee6&data=71dc5&mac=bb69344&verifyFile=b2ba4aa4b07b538f472e3ff9

Expected Response

{"result":0,"message":"Success"}

For error code, please refer to status code page.

{"result":91}

API reference Verify Document

How can we help?