Skip to main content

Generate WADH value for UIDAI AADHAAR EKYC API 2.5

 

Introduction

In UIDAI ecosystem, for ekyc transaction, WADH value is necessary to be passed in CAPTURE request of RD (Registered Device) service. This WADH Value will be incorporated by RD Service while generating encrypted PID block after successful capture of biometric (Finger or Iris).

Supply WADH to RD Service is responsibility of consumer application and so, WADH value need to be calculated at consumer application side.

Background

To understand parameters and formation of WADH value, you need to first refer document of UIDAI EKYC API 2.5 where several request parameters has been explained those are used while calculating WADH value.

Let understand those parameters first as below:

ver => Aadhaar  KYC API version.

ra => Resident authentication type.

rc => Represents   resident’s  explicit consent.

lr => Flag  indicating  if  AUA  application  require  local  language  data  in addition to English.

de => Flag indicating if KUA is delegating decryption to ASA.

pfr => Print  format  request flag for retrieving  E-Aadhaar  document  in PDF format  as  part  of  response.

Let consider value of these parameters as below:

ver= 2.5

ra=F

rc = Y

lr=N

de=N

pfr=N

 

Calculating/Building plain wadh value:

Plain wadh value can be obtain by concatenation of these parameters as below:

ver + ra + rc + lr + de + pfr (order is must be maintained)

So the actual plain value of wadh is 2.5FYNNN

Final WADH value will be base64Encoded SHA-256 of plain wadh value. See below code to obtain final WADH value.

Using the code

Let refer the code of calculation.

JAVA

public String getWADH (String text) {

        MessageDigest digest = MessageDigest.getInstance("SHA-256");

        byte[] hash = digest.digest(text.getBytes(StandardCharsets.UTF_8));

        String wadh= Base64.getEncoder().encodeToString(hash);

        return wadh; // Use this WADH

 }

C#

public String getWADH (String text) {

        SHA256 sha256 = SHA256Managed.Create();

        byte[] bytes = Encoding.UTF8.GetBytes(text);

        byte[] hash = sha256.ComputeHash(bytes);

        string wadh = System.Convert.ToBase64String(hash);

        return wadh; // Use this WADH

 }

Consume the Function

String plain_wadh = ver + ra + rc + lr + de + pfr;

String final_wadh = getWADH (plain_wadh); //Final WADH value which will be passed to RD Service in CAPTURE Request

 

Comments