diff --git a/apitest-commons/Biometric Devices/Face/DeviceDiscovery.json b/apitest-commons/Biometric Devices/Face/DeviceDiscovery.json
new file mode 100644
index 0000000000..b5ca41591e
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Face/DeviceDiscovery.json
@@ -0,0 +1,17 @@
+{
+ "deviceId":"3",
+ "deviceStatus":"Ready",
+ "certification":"L0",
+ "serviceVersion":"0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId":"",
+ "deviceCode": "b692b595-3523-face-99fc-bd76e35f190f",
+ "specVersion":[
+ "0.9.5"
+ ],
+ "purpose":"",
+ "error":null
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Face/DeviceInfo.json b/apitest-commons/Biometric Devices/Face/DeviceInfo.json
new file mode 100644
index 0000000000..e8e4d59cef
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Face/DeviceInfo.json
@@ -0,0 +1,18 @@
+{
+ "deviceStatus": "Ready",
+ "deviceId": "3",
+ "firmware": "MOSIP.FACE.1.0.0.0",
+ "certification": "L0",
+ "serviceVersion": "0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId": "",
+ "deviceCode": "b692b595-3523-face-99fc-bd76e35f190f",
+ "env": "Staging",
+ "purpose": "",
+ "specVersion": [
+ "0.9.5"
+ ]
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Face/DigitalId.json b/apitest-commons/Biometric Devices/Face/DigitalId.json
new file mode 100644
index 0000000000..a041adf736
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Face/DigitalId.json
@@ -0,0 +1,10 @@
+{
+ "serialNo":"2345678901",
+ "make":"MOSIP",
+ "model":"FACE01",
+ "type":"Face",
+ "deviceSubType":"Full face",
+ "deviceProvider":"MOSIP",
+ "deviceProviderId":"MOSIP.PROXY.SBI",
+ "dateTime":""
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Face/Keys/mosipface.p12 b/apitest-commons/Biometric Devices/Face/Keys/mosipface.p12
new file mode 100644
index 0000000000..94b2589ade
Binary files /dev/null and b/apitest-commons/Biometric Devices/Face/Keys/mosipface.p12 differ
diff --git a/apitest-commons/Biometric Devices/Face/Keys/mosipfaceftm.p12 b/apitest-commons/Biometric Devices/Face/Keys/mosipfaceftm.p12
new file mode 100644
index 0000000000..3a5cd3d00c
Binary files /dev/null and b/apitest-commons/Biometric Devices/Face/Keys/mosipfaceftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/Face/Stream Image/0.jpeg b/apitest-commons/Biometric Devices/Face/Stream Image/0.jpeg
new file mode 100644
index 0000000000..1fa782a7d4
Binary files /dev/null and b/apitest-commons/Biometric Devices/Face/Stream Image/0.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Finger/Single/DeviceDiscovery.json b/apitest-commons/Biometric Devices/Finger/Single/DeviceDiscovery.json
new file mode 100644
index 0000000000..142a5aaedd
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Single/DeviceDiscovery.json
@@ -0,0 +1,17 @@
+{
+ "deviceId":"4",
+ "deviceStatus":"Ready",
+ "certification":"L0",
+ "serviceVersion":"0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId":"",
+ "deviceCode": "b692b595-3523-slap-99fc-bd76e35f290f",
+ "specVersion":[
+ "0.9.5"
+ ],
+ "purpose":"",
+ "error":null
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Single/DeviceInfo.json b/apitest-commons/Biometric Devices/Finger/Single/DeviceInfo.json
new file mode 100644
index 0000000000..7070641345
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Single/DeviceInfo.json
@@ -0,0 +1,18 @@
+{
+ "deviceStatus": "Ready",
+ "deviceId": "4",
+ "firmware": "MOSIP.SINGLE.1.0.0.0",
+ "certification": "L0",
+ "serviceVersion": "0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId": "",
+ "deviceCode": "b692b595-3523-slap-99fc-bd76e35f290f",
+ "env": "Staging",
+ "purpose": "",
+ "specVersion": [
+ "0.9.5"
+ ]
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Single/DigitalId.json b/apitest-commons/Biometric Devices/Finger/Single/DigitalId.json
new file mode 100644
index 0000000000..4773012450
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Single/DigitalId.json
@@ -0,0 +1,10 @@
+{
+ "serialNo":"1234567990",
+ "make":"MOSIP",
+ "model":"SINGLE01",
+ "type":"Finger",
+ "deviceSubType":"Single",
+ "deviceProvider":"MOSIP",
+ "deviceProviderId":"MOSIP.PROXY.SBI",
+ "dateTime":""
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingle.p12 b/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingle.p12
new file mode 100644
index 0000000000..b1af929c60
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingle.p12 differ
diff --git a/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingleftm.p12 b/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingleftm.p12
new file mode 100644
index 0000000000..e92a0a26ac
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Single/Keys/mosipfingersingleftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/DeviceDiscovery.json b/apitest-commons/Biometric Devices/Finger/Slap/DeviceDiscovery.json
new file mode 100644
index 0000000000..37664dc9d4
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Slap/DeviceDiscovery.json
@@ -0,0 +1,17 @@
+{
+ "deviceId":"2",
+ "deviceStatus":"Ready",
+ "certification":"L0",
+ "serviceVersion":"0.9.5",
+ "deviceSubId":[
+ "1", "2", "3"
+ ],
+ "callbackId":"",
+ "digitalId":"",
+ "deviceCode": "b692b595-3523-slap-99fc-bd76e35f190f",
+ "specVersion":[
+ "0.9.5"
+ ],
+ "purpose":"",
+ "error":null
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/DeviceInfo.json b/apitest-commons/Biometric Devices/Finger/Slap/DeviceInfo.json
new file mode 100644
index 0000000000..7d9e3eb3a4
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Slap/DeviceInfo.json
@@ -0,0 +1,18 @@
+{
+ "deviceStatus": "Ready",
+ "deviceId": "2",
+ "firmware": "MOSIP.SLAP.1.0.0.0",
+ "certification": "L0",
+ "serviceVersion": "0.9.5",
+ "deviceSubId":[
+ "1", "2", "3"
+ ],
+ "callbackId":"",
+ "digitalId": "",
+ "deviceCode": "b692b595-3523-slap-99fc-bd76e35f190f",
+ "env": "Staging",
+ "purpose": "",
+ "specVersion": [
+ "0.9.5"
+ ]
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/DigitalId.json b/apitest-commons/Biometric Devices/Finger/Slap/DigitalId.json
new file mode 100644
index 0000000000..759794b80f
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Finger/Slap/DigitalId.json
@@ -0,0 +1,10 @@
+{
+ "serialNo":"1234567890",
+ "make":"MOSIP",
+ "model":"SLAP01",
+ "type":"Finger",
+ "deviceSubType":"Slap",
+ "deviceProvider":"MOSIP",
+ "deviceProviderId":"MOSIP.PROXY.SBI",
+ "dateTime":""
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslap.p12 b/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslap.p12
new file mode 100644
index 0000000000..59e2d477b1
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslap.p12 differ
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslapftm.p12 b/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslapftm.p12
new file mode 100644
index 0000000000..0885eb8f46
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Slap/Keys/mosipfingerslapftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/1.jpeg b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/1.jpeg
new file mode 100644
index 0000000000..b9d93bc292
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/1.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/2.jpeg b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/2.jpeg
new file mode 100644
index 0000000000..faf47323f3
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/2.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/3.jpeg b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/3.jpeg
new file mode 100644
index 0000000000..e2d0fb6c9f
Binary files /dev/null and b/apitest-commons/Biometric Devices/Finger/Slap/Stream Image/3.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Iris/Double/DeviceDiscovery.json b/apitest-commons/Biometric Devices/Iris/Double/DeviceDiscovery.json
new file mode 100644
index 0000000000..3b947d2414
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Double/DeviceDiscovery.json
@@ -0,0 +1,17 @@
+{
+ "deviceId":"1",
+ "deviceStatus":"Ready",
+ "certification":"L0",
+ "serviceVersion":"0.9.5",
+ "deviceSubId":[
+ "1", "2", "3"
+ ],
+ "callbackId":"",
+ "digitalId":"",
+ "deviceCode": "b692b595-3523-iris-99fc-bd76e35f190f",
+ "specVersion":[
+ "0.9.5"
+ ],
+ "purpose":"",
+ "error":null
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Double/DeviceInfo.json b/apitest-commons/Biometric Devices/Iris/Double/DeviceInfo.json
new file mode 100644
index 0000000000..e7b08d1efa
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Double/DeviceInfo.json
@@ -0,0 +1,18 @@
+{
+ "deviceStatus": "Ready",
+ "deviceId": "1",
+ "firmware": "MOSIP.IRIS.1.0.0.0",
+ "certification": "L0",
+ "serviceVersion": "0.9.5",
+ "deviceSubId":[
+ "1", "2", "3"
+ ],
+ "callbackId":"",
+ "digitalId": "",
+ "deviceCode": "b692b595-3523-iris-99fc-bd76e35f190f",
+ "env": "Staging",
+ "purpose": "",
+ "specVersion": [
+ "0.9.5"
+ ]
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Double/DigitalId.json b/apitest-commons/Biometric Devices/Iris/Double/DigitalId.json
new file mode 100644
index 0000000000..eb100965e9
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Double/DigitalId.json
@@ -0,0 +1,10 @@
+{
+ "serialNo":"3456789012",
+ "make":"MOSIP",
+ "model":"IRIS01",
+ "type":"Iris",
+ "deviceSubType":"Double",
+ "deviceProvider":"MOSIP",
+ "deviceProviderId":"MOSIP.PROXY.SBI",
+ "dateTime":""
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdouble.p12 b/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdouble.p12
new file mode 100644
index 0000000000..6d0874494d
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdouble.p12 differ
diff --git a/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdoubleftm.p12 b/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdoubleftm.p12
new file mode 100644
index 0000000000..3203fb8efe
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Double/Keys/mosipirisdoubleftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/Iris/Double/Stream Image/1.jpeg b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/1.jpeg
new file mode 100644
index 0000000000..b4d108386d
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/1.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Iris/Double/Stream Image/2.jpeg b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/2.jpeg
new file mode 100644
index 0000000000..485712ef4a
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/2.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Iris/Double/Stream Image/3.jpeg b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/3.jpeg
new file mode 100644
index 0000000000..8691a94604
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Double/Stream Image/3.jpeg differ
diff --git a/apitest-commons/Biometric Devices/Iris/Single/DeviceDiscovery.json b/apitest-commons/Biometric Devices/Iris/Single/DeviceDiscovery.json
new file mode 100644
index 0000000000..93510c8c44
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Single/DeviceDiscovery.json
@@ -0,0 +1,17 @@
+{
+ "deviceId":"5",
+ "deviceStatus":"Ready",
+ "certification":"L0",
+ "serviceVersion":"0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId":"",
+ "deviceCode": "b692b595-3523-iris-99fc-bd76e35fff8",
+ "specVersion":[
+ "0.9.5"
+ ],
+ "purpose":"",
+ "error":null
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Single/DeviceInfo.json b/apitest-commons/Biometric Devices/Iris/Single/DeviceInfo.json
new file mode 100644
index 0000000000..0fecb5d662
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Single/DeviceInfo.json
@@ -0,0 +1,18 @@
+{
+ "deviceStatus": "Ready",
+ "deviceId": "5",
+ "firmware": "MOSIP.IRIS.2.0.0.0",
+ "certification": "L0",
+ "serviceVersion": "0.9.5",
+ "deviceSubId":[
+ "0"
+ ],
+ "callbackId":"",
+ "digitalId": "",
+ "deviceCode": "b692b595-3523-iris-99fc-bd76e35fff8",
+ "env": "Staging",
+ "purpose": "",
+ "specVersion": [
+ "0.9.5"
+ ]
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Single/DigitalId.json b/apitest-commons/Biometric Devices/Iris/Single/DigitalId.json
new file mode 100644
index 0000000000..b2d91c8d8e
--- /dev/null
+++ b/apitest-commons/Biometric Devices/Iris/Single/DigitalId.json
@@ -0,0 +1,10 @@
+{
+ "serialNo":"3456789099",
+ "make":"MOSIP",
+ "model":"IRIS02",
+ "type":"Iris",
+ "deviceSubType":"Single",
+ "deviceProvider":"MOSIP",
+ "deviceProviderId":"MOSIP.PROXY.SBI",
+ "dateTime":""
+}
\ No newline at end of file
diff --git a/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingle.p12 b/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingle.p12
new file mode 100644
index 0000000000..c3903f9188
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingle.p12 differ
diff --git a/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingleftm.p12 b/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingleftm.p12
new file mode 100644
index 0000000000..0801aa158b
Binary files /dev/null and b/apitest-commons/Biometric Devices/Iris/Single/Keys/mosipirissingleftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/mosiprootca.p12 b/apitest-commons/Biometric Devices/mosiprootca.p12
new file mode 100644
index 0000000000..3f1db48fb4
Binary files /dev/null and b/apitest-commons/Biometric Devices/mosiprootca.p12 differ
diff --git a/apitest-commons/Biometric Devices/mosiprootcaftm.p12 b/apitest-commons/Biometric Devices/mosiprootcaftm.p12
new file mode 100644
index 0000000000..ab4c5929aa
Binary files /dev/null and b/apitest-commons/Biometric Devices/mosiprootcaftm.p12 differ
diff --git a/apitest-commons/Biometric Devices/rootca.cer b/apitest-commons/Biometric Devices/rootca.cer
new file mode 100644
index 0000000000..dfaf87e47e
--- /dev/null
+++ b/apitest-commons/Biometric Devices/rootca.cer
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDPzCCAiegAwIBAgIEYCFEgjANBgkqhkiG9w0BAQsFADBSMQswCQYDVQQGEwJJ
+TjESMBAGA1UECAwJS2FybmF0YWthMQ4wDAYDVQQKDAVNb3NpcDEOMAwGA1UECwwF
+TW9zaXAxDzANBgNVBAMMBlJvb3RDQTAeFw0yMTAyMDgxNDAyNDJaFw0zMTAyMDgx
+NDAyNDJaMFIxCzAJBgNVBAYTAklOMRIwEAYDVQQIDAlLYXJuYXRha2ExDjAMBgNV
+BAoMBU1vc2lwMQ4wDAYDVQQLDAVNb3NpcDEPMA0GA1UEAwwGUm9vdENBMIIBIjAN
+BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz9kaCs4Yrh2mMFx/wGV42Tn7vM9d
+t2au3JOWu/fbeaNk8/TgNEA1GrVerqagcRDDo+6jBDbX7XO9iRHX1wmIcVkH7osa
+cMKGfYzZbvkWjGFRCam10xLGyczSeDiIIj+H3eLXzTP0iZBcVyw40EMLWk7BHld+
+eFY1XS+EDPIv6snjIxWDEd+wND1tOvWgPsS7mYy8Mn9QRYZXH9KW8/nW0bf/Z74U
+d89PtXl3WSSrrRZSQofGDwM5RPOEzrYcurZowwWLWmgAmvcsATxhOAiKe6e6tvbD
+yXTC8+9CRv22zGTcasI5QOYzGaj6wMKr9h2WgAY1LJFBIkEjf1ykWGlTbQIDAQAB
+ox0wGzAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQsFAAOC
+AQEAzWge0dKje1/opIyiho0e6p6a/M/UD05bNLg7XD6uMqJAT9C1YTwq77OD0nrc
+ZpMQoQ4zCFEbGoPvHWzW0Isc7Y3F40YI8bQdmEQtJuiqsCUQ8XW3b4YDTH6VM5go
++VZgoRucIRBwCAss1tMrxjT3lMWwuyA9DaOkryRW/m9QmlLoTWLQabi/pO+FS+oy
+WYYxJOzvqC3xUTYHi+DzlLSWR08NE7gdHrD4aAHYLPIyzgVuToztB7PYmbuOnKmS
+M9sHlKqgpN7/AgvTOFOEX5mi5BcPGKagryTfipwLVyWaQBDCcVNkAtoLTYPCTEAj
+UhONf7GpbeehitYjHQoknr21EA==
+-----END CERTIFICATE-----
diff --git a/apitest-commons/Biometric Devices/rootcaftm.cer b/apitest-commons/Biometric Devices/rootcaftm.cer
new file mode 100644
index 0000000000..ac57e8ba9e
--- /dev/null
+++ b/apitest-commons/Biometric Devices/rootcaftm.cer
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDeTCCAmGgAwIBAgIEYMHynDANBgkqhkiG9w0BAQsFADBvMQswCQYDVQQGEwJJ
+TjESMBAGA1UECAwJS2FybmF0YWthMRIwEAYDVQQHDAlCYW5nYWxvcmUxETAPBgNV
+BAoMCG1vc2lwLmlvMREwDwYDVQQLDAhtb3NpcC5pbzESMBAGA1UEAwwJUm9vdENB
+RlRNMB4XDTIxMDYxMDExMDgxMloXDTIyMDYxMDExMDgxMlowbzELMAkGA1UEBhMC
+SU4xEjAQBgNVBAgMCUthcm5hdGFrYTESMBAGA1UEBwwJQmFuZ2Fsb3JlMREwDwYD
+VQQKDAhtb3NpcC5pbzERMA8GA1UECwwIbW9zaXAuaW8xEjAQBgNVBAMMCVJvb3RD
+QUZUTTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3FfxvirIiPH6YF
+X4GR1z7LOI8tiwvfqjAFba6p4vMHs0xNu0TWJ9GS3qlDglmWczm3hgHndWD3rIUQ
+V4fMsQDapA0giFVMxushm8u9JYl2HXwtVgrXUeKEdVS3zpWf2qQCXK9vQAOHvhhu
+UMWVzL4yxd1RwUGjuSjM/pZqa/Tq0aDfqFVZ/MckxSvieEKEYODtcxXA708SQ07I
+aFDZ2gKTD4aYUlCed9fAois+ko06tzqS1kerMiORzZExtUY/hwx2UrLVUBFYTBqW
+Wuw0N2VjsaifQAti0JJGYPCBqM2Q7OctIvccAjghHYxCXj+yNRtOm8ooNZTefMJr
+fCY9OucCAwEAAaMdMBswCwYDVR0PBAQDAgEGMAwGA1UdEwQFMAMBAf8wDQYJKoZI
+hvcNAQELBQADggEBAEQJMIT958jm1e5sCctUcOoHLQVdM9f3NLKicCUCjVMNCDjg
+DbkoL72rlktTDbzi4AizaBXwxQdB951SG4Vjbc5tSC3WzB7d8QMiLRwG14Q165Gw
+VGuMMOpJn4jlMzJMhhP67vJ4hYI2Op4eDAPH3HCods/Ew4JJ/edwpJ80tLKiB0f6
+fnyPXxPUSMtkLCCpp2/zf1OkXmUT8dIgU27R9+/8x/ZphDVJcc00XrgM4VI1dX+W
+8W8Ua6GlQSL83HIqVudnFAmCDF0dRX//ghUOeJwWEMgcm/cUNTZv6hZjmDpVeout
+E1o6hXGXWRnaDU9/QGpi2BuiSgREOarAQf62sPI=
+-----END CERTIFICATE-----
diff --git a/apitest-commons/application.properties b/apitest-commons/application.properties
new file mode 100644
index 0000000000..8e2d92cc16
--- /dev/null
+++ b/apitest-commons/application.properties
@@ -0,0 +1,143 @@
+server.minport=4501
+server.maxport=4600
+server.serveripaddress=127.0.0.1
+cors.headers.allowed.methods="OPTIONS, RCAPTURE, CAPTURE, MOSIPDINFO, MOSIPDISC, STREAM, GET, POST"
+cors.headers.allowed.origin="*"
+
+mosip.mock.sbi.allowed.admin.apis="admin/score, admin/delay, admin/status, admin/profile"
+mosip.mock.sbi.quality.score=94
+mosip.mock.sbi.device.purpose.registration=Registration
+mosip.mock.sbi.device.purpose.auth=Auth
+
+mosip.mock.sbi.biometric.type.biometricdevice=Biometric Device
+mosip.mock.sbi.biometric.type.finger=Finger
+mosip.mock.sbi.biometric.type.face=Face
+mosip.mock.sbi.biometric.type.iris=Iris
+
+mosip.mock.sbi.biometric.subtype.finger.slap=Slap
+mosip.mock.sbi.biometric.subtype.finger.single=Single
+mosip.mock.sbi.biometric.subtype.finger.touchless=Touchless
+mosip.mock.sbi.biometric.subtype.face=Full face
+mosip.mock.sbi.biometric.subtype.iris.single=Single
+mosip.mock.sbi.biometric.subtype.iris.double=Double
+
+mosip.mock.sbi.biometric.seed.finger=99
+mosip.mock.sbi.biometric.seed.face=3
+mosip.mock.sbi.biometric.seed.iris=999
+
+mosip.mock.sbi.file.face.digitalid.json=/Biometric Devices/Face/DigitalId.json
+mosip.mock.sbi.file.face.deviceinfo.json=/Biometric Devices/Face/DeviceInfo.json
+mosip.mock.sbi.file.face.devicediscovery.json=/Biometric Devices/Face/DeviceDiscovery.json
+mosip.mock.sbi.file.face.streamimage=/Biometric Devices/Face/Stream Image/0.jpeg
+mosip.mock.sbi.file.face.keys.keystorefilename=/device-dsk-partner.p12
+mosip.mock.sbi.file.face.keys.keyalias=keyalias
+mosip.mock.sbi.file.face.keys.keystorepwd=qwerty@123
+mosip.mock.sbi.file.face.keys.keystorefilename.ftm=/Biometric Devices/Face/Keys/mosipfaceftm.p12
+mosip.mock.sbi.file.face.keys.keyalias.ftm=mosipfaceftm
+mosip.mock.sbi.file.face.keys.keystorepwd.ftm=mosipfaceftm
+mosip.mock.sbi.file.face.keys.encryption=/Biometric Devices/Face/Keys/mosip-ida.cer
+
+mosip.mock.sbi.file.finger.slap.digitalid.json=/Biometric Devices/Finger/Slap/DigitalId.json
+mosip.mock.sbi.file.finger.slap.deviceinfo.json=/Biometric Devices/Finger/Slap/DeviceInfo.json
+mosip.mock.sbi.file.finger.slap.devicediscovery.json=/Biometric Devices/Finger/Slap/DeviceDiscovery.json
+mosip.mock.sbi.file.finger.slap.streamimage.left=/Biometric Devices/Finger/Slap/Stream Image/1.jpeg
+mosip.mock.sbi.file.finger.slap.streamimage.right=/Biometric Devices/Finger/Slap/Stream Image/2.jpeg
+mosip.mock.sbi.file.finger.slap.streamimage.thumb=/Biometric Devices/Finger/Slap/Stream Image/3.jpeg
+mosip.mock.sbi.file.finger.slap.keys.keystorefilename=/device-dsk-partner.p12
+mosip.mock.sbi.file.finger.slap.keys.keyalias=keyalias
+mosip.mock.sbi.file.finger.slap.keys.keystorepwd=qwerty@123
+mosip.mock.sbi.file.finger.slap.keys.keystorefilename.ftm=/Biometric Devices/Finger/Slap/Keys/mosipfingerslapftm.p12
+mosip.mock.sbi.file.finger.slap.keys.keyalias.ftm=mosipfingerslapftm
+mosip.mock.sbi.file.finger.slap.keys.keystorepwd.ftm=mosipfingerslapftm
+mosip.mock.sbi.file.finger.slap.keys.encryption=/Biometric Devices/Finger/Slap/Keys/mosip-ida.cer
+
+mosip.mock.sbi.file.iris.double.digitalid.json=/Biometric Devices/Iris/Double/DigitalId.json
+mosip.mock.sbi.file.iris.double.deviceinfo.json=/Biometric Devices/Iris/Double/DeviceInfo.json
+mosip.mock.sbi.file.iris.double.devicediscovery.json=/Biometric Devices/Iris/Double/DeviceDiscovery.json
+#mosip.mock.sbi.file.iris.double.streamimage.both=/Biometric Devices/Iris/Double/Stream Image/1.jpeg
+#mosip.mock.sbi.file.iris.double.streamimage.left=/Biometric Devices/Iris/Double/Stream Image/2.jpeg
+#mosip.mock.sbi.file.iris.double.streamimage.right=/Biometric Devices/Iris/Double/Stream Image/3.jpeg
+mosip.mock.sbi.file.iris.double.keys.keystorefilename=/device-dsk-partner.p12
+mosip.mock.sbi.file.iris.double.keys.keyalias=keyalias
+mosip.mock.sbi.file.iris.double.keys.keystorepwd=qwerty@123
+mosip.mock.sbi.file.iris.double.keys.keystorefilename.ftm=/Biometric Devices/Iris/Double/Keys/mosipirisdoubleftm.p12
+mosip.mock.sbi.file.iris.double.keys.keyalias.ftm=mosipirisdoubleftm
+mosip.mock.sbi.file.iris.double.keys.keystorepwd.ftm=mosipirisdoubleftm
+mosip.mock.sbi.file.iris.double.keys.encryption=/Biometric Devices/Iris/Double/Keys/mosip-ida.cer
+
+mosip.mock.sbi.folder.profile=/resource/Profile
+mosip.mock.sbi.file.folder.default=/resource/Profile/Default
+
+mosip.kernel.crypto.sign-algorithm-name=RS256
+
+mosip.auth.server.url=https://dev.mosip.net/v1/authmanager/authenticate/clientidsecretkey
+mosip.auth.appid=regproc
+mosip.auth.clientid=mosip-regproc-client
+mosip.auth.secretkey=abc123
+
+mosip.ida.server.url=https://extint1.mosip.net/idauthentication/v1/internal/getCertificate?applicationId=IDA&referenceId=IDA-FIR
+
+mds_ERROR_0_msg_en=Success
+
+mds_ERROR_100_msg_en=Device not registered
+mds_ERROR_101_msg_en=Unable to detect a biometric object
+mds_ERROR_102_msg_en=Technical error during extraction
+mds_ERROR_103_msg_en=Device tamper detected
+mds_ERROR_104_msg_en=Unable to connect to management server
+mds_ERROR_105_msg_en=Image orientation error
+mds_ERROR_106_msg_en=Device not found
+mds_ERROR_107_msg_en=Device public key expired
+mds_ERROR_108_msg_en=Domain public key missing
+mds_ERROR_109_msg_en=Requested number of biometric (Finger/IRIS) not supported
+mds_ERROR_110_msg_en=Device is not ready
+mds_ERROR_111_msg_en=Device is busy
+mds_ERROR_112_msg_en=Device Type MisMatch for given deviceId
+mds_ERROR_113_msg_en=Count MisMatch for given deviceType
+mds_ERROR_114_msg_en=Device Type can be only (Finger/Iris/Face)
+
+mds_ERROR_500_msg_en=Invalid URL
+mds_ERROR_501_msg_en=Invalid Type Value in Device Discovery Request
+mds_ERROR_502_msg_en=Biometric Type values must be Biometric Device, Finger, Face, Iris
+mds_ERROR_503_msg_en=Devices are not Connected, please connect devices
+mds_ERROR_504_msg_en=Device Status values must be Ready, Busy, Not Ready, Not Registered
+mds_ERROR_505_msg_en=Quality Score can not be empty and greater than 100 or lesser than 0
+mds_ERROR_506_msg_en=Delay can not empty and lesser than 0 milliseconds
+mds_ERROR_507_msg_en=Method array can contain values only MOSIPDISC, MOSIPDINFO, CAPTURE, STREAM, RCAPTURE
+
+mds_ERROR_551_msg_en=Profile Not Set, please check the profile value
+
+mds_ERROR_601_msg_en=Livestream request can not be done for Auth Devices
+mds_ERROR_604_msg_en=Device Id value not present in Livestream request object
+mds_ERROR_605_msg_en=Device is not connected or not Registered for the deviceId given in Livestream request object
+mds_ERROR_606_msg_en=Device connected purpose should be for Registration only for Livestream
+mds_ERROR_607_msg_en=Device Status is Not Ready or Busy
+mds_ERROR_608_msg_en=Live Stream Image not present
+mds_ERROR_609_msg_en=Live Stream timeout
+mds_ERROR_610_msg_en=Live streaming unknown error
+
+mds_ERROR_700_msg_en=RCapture Failed because Live streaming was stopped
+mds_ERROR_701_msg_en=RCapture Failed because Capture Timeout has happened
+mds_ERROR_702_msg_en=RCapture Failed because Live streaming DeviceId and DeviceSubId different
+mds_ERROR_703_msg_en=RCapture process already in progress, try after sometime
+mds_ERROR_704_msg_en=Device Id value not present in RCapture request object
+mds_ERROR_705_msg_en=Device is not connected or not Registered for the deviceId given in RCapture request object
+mds_ERROR_706_msg_en=Device connected purpose should be for Registration only for RCapture
+mds_ERROR_707_msg_en=BioMetric not present for the given bio subtype
+mds_ERROR_708_msg_en=No BioMetric information present for the given Biotype and BioSubType Id
+mds_ERROR_709_msg_en=RCapture request can not be done for Auth Devices
+mds_ERROR_710_msg_en=RCapture unknown error
+
+mds_ERROR_800_msg_en=Auth Capture Failed
+mds_ERROR_801_msg_en=Auth Capture Failed because Capture Timeout has happened
+mds_ERROR_803_msg_en=Auth Capture process already in progress, try after sometime
+mds_ERROR_804_msg_en=Device Id value not present in Auth Capture request object
+mds_ERROR_805_msg_en=Device is not connected or not Registered for the deviceId given in Auth Capture request object
+mds_ERROR_806_msg_en=Device connected purpose should be for Auth only for Auth Capture
+mds_ERROR_809_msg_en=Auth Capture request can not be done for Registration Devices
+mds_ERROR_810_msg_en=Auth Capture unknown error
+
+mds_ERROR_999_msg_en=Unknown Error
+
+mosip.mock.sbi.file.iris.double.streamimage.left=/Biometric Devices/Iris/Double/Stream Image/1.jpeg
+mosip.mock.sbi.file.iris.double.streamimage.right=/Biometric Devices/Iris/Double/Stream Image/2.jpeg
+mosip.mock.sbi.file.iris.double.streamimage.both=/Biometric Devices/Iris/Double/Stream Image/3.jpeg
diff --git a/apitest-commons/pom.xml b/apitest-commons/pom.xml
index 7d15089b99..b02e1cb180 100644
--- a/apitest-commons/pom.xml
+++ b/apitest-commons/pom.xml
@@ -121,7 +121,7 @@
2.0
1.5.2
2.1.1
- 1.60
+
63.1
1.0.0
3.3.3
@@ -391,13 +391,23 @@
icu4j
${icu4j.version}
+
+ com.jamesmurty.utils
+ java-xmlbuilder
+ 1.1
+
org.apache.httpcomponents
httpclient
- 4.5.3
- runtime
+ 4.5.14
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.16
+
+
org.apache.hadoop
hadoop-client
@@ -482,12 +492,28 @@
io.mosip.kernel
kernel-core
${kernel.version}
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+ org.bouncycastle
+ bcpkix-jdk15on
+
+
io.mosip.kernel
kernel-registration-packet-manager
1.1.5.3
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
io.mosip.kernel
@@ -527,6 +553,12 @@
bcpkix-jdk15on
1.70
+
+ io.mosip.mock.mds
+ mock-mds
+ 1.2.0.2
+
+
javax.xml.bind
jaxb-api
@@ -585,22 +617,24 @@
spring-boot-starter-security
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+ org.bouncycastle
+ bcpkix-jdk15on
+
-
- org.apache.httpcomponents
- httpclient
- 4.5.14
-
-
org.apache.httpcomponents
httpmime
- 4.5.2
+ 4.5.14
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Face.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Face.iso
new file mode 100644
index 0000000000..fbf94babc5
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Face.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.iso
new file mode 100644
index 0000000000..ed8bce5792
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.wsq.iso
new file mode 100644
index 0000000000..a14b92ba30
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Index.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Iris.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Iris.iso
new file mode 100644
index 0000000000..b36363b6c6
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.iso
new file mode 100644
index 0000000000..9f06705f6b
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.wsq.iso
new file mode 100644
index 0000000000..664d6d1204
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Little.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.iso
new file mode 100644
index 0000000000..3886e5a790
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.wsq.iso
new file mode 100644
index 0000000000..e0952a043e
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Middle.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.iso
new file mode 100644
index 0000000000..e076678521
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.wsq.iso
new file mode 100644
index 0000000000..9c139f53ad
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Ring.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.iso
new file mode 100644
index 0000000000..00d5ad5d4f
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.wsq.iso
new file mode 100644
index 0000000000..722fcef741
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Left_Thumb.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.iso
new file mode 100644
index 0000000000..e45e8d1529
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.wsq.iso
new file mode 100644
index 0000000000..2f082284b5
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Index.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Iris.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Iris.iso
new file mode 100644
index 0000000000..552750cd60
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.iso
new file mode 100644
index 0000000000..aa801c97dd
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.wsq.iso
new file mode 100644
index 0000000000..c0fd3e8e12
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Little.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.iso
new file mode 100644
index 0000000000..e6771d0264
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.wsq.iso
new file mode 100644
index 0000000000..3ee43b4ffd
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Middle.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.iso
new file mode 100644
index 0000000000..ac8d2b6295
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.wsq.iso
new file mode 100644
index 0000000000..5ac7ca4293
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Ring.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.iso
new file mode 100644
index 0000000000..722a5cd9dc
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.wsq.iso b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.wsq.iso
new file mode 100644
index 0000000000..4f73143e4a
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Auth/0001Right_Thumb.wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Exception_Photo.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Exception_Photo.iso
new file mode 100644
index 0000000000..80caced444
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Exception_Photo.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Face.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Face.iso
new file mode 100644
index 0000000000..5e84939bda
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Face.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Index.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Index.iso
new file mode 100644
index 0000000000..46c4112fae
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Iris.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Iris.iso
new file mode 100644
index 0000000000..fedadc7df9
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Little.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Little.iso
new file mode 100644
index 0000000000..d2b2684680
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Middle.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Middle.iso
new file mode 100644
index 0000000000..804de92ce9
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Ring.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Ring.iso
new file mode 100644
index 0000000000..b401048829
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Thumb.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Thumb.iso
new file mode 100644
index 0000000000..0574ba6c8e
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Left_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Index.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Index.iso
new file mode 100644
index 0000000000..bfa1808ccc
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Iris.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Iris.iso
new file mode 100644
index 0000000000..72bb495bfb
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Little.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Little.iso
new file mode 100644
index 0000000000..6b3badf299
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Middle.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Middle.iso
new file mode 100644
index 0000000000..0fa2255975
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Ring.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Ring.iso
new file mode 100644
index 0000000000..9aa5dc523b
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Thumb.iso b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Thumb.iso
new file mode 100644
index 0000000000..0931ac4fd4
Binary files /dev/null and b/apitest-commons/resource/Profile/Automatic/Registration/0001Right_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Face.iso b/apitest-commons/resource/Profile/Default/Auth/Face.iso
new file mode 100644
index 0000000000..fbf94babc5
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Face.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN.iso b/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN.iso
new file mode 100644
index 0000000000..4ee38f986b
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN_wsq.iso
new file mode 100644
index 0000000000..cc5ed30a96
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Finger_UKNOWN_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Iris_UNKNOWN.iso b/apitest-commons/resource/Profile/Default/Auth/Iris_UNKNOWN.iso
new file mode 100644
index 0000000000..1764a0e6ab
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Iris_UNKNOWN.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Index.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Index.iso
new file mode 100644
index 0000000000..ed8bce5792
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Index_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Index_wsq.iso
new file mode 100644
index 0000000000..a14b92ba30
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Index_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Iris.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Iris.iso
new file mode 100644
index 0000000000..8b3aafca11
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Little.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Little.iso
new file mode 100644
index 0000000000..9f06705f6b
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Little_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Little_wsq.iso
new file mode 100644
index 0000000000..664d6d1204
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Little_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Middle.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Middle.iso
new file mode 100644
index 0000000000..3886e5a790
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Middle_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Middle_wsq.iso
new file mode 100644
index 0000000000..e0952a043e
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Middle_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Ring.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Ring.iso
new file mode 100644
index 0000000000..e076678521
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Ring_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Ring_wsq.iso
new file mode 100644
index 0000000000..9c139f53ad
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Ring_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Thumb.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Thumb.iso
new file mode 100644
index 0000000000..00d5ad5d4f
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Left_Thumb_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Left_Thumb_wsq.iso
new file mode 100644
index 0000000000..722fcef741
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Left_Thumb_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Index.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Index.iso
new file mode 100644
index 0000000000..e45e8d1529
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Index_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Index_wsq.iso
new file mode 100644
index 0000000000..2f082284b5
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Index_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Iris.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Iris.iso
new file mode 100644
index 0000000000..3f2d73ad12
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Little.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Little.iso
new file mode 100644
index 0000000000..aa801c97dd
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Little_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Little_wsq.iso
new file mode 100644
index 0000000000..c0fd3e8e12
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Little_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Middle.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Middle.iso
new file mode 100644
index 0000000000..e6771d0264
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Middle_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Middle_wsq.iso
new file mode 100644
index 0000000000..3ee43b4ffd
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Middle_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Ring.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Ring.iso
new file mode 100644
index 0000000000..ac8d2b6295
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Ring_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Ring_wsq.iso
new file mode 100644
index 0000000000..5ac7ca4293
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Ring_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Thumb.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Thumb.iso
new file mode 100644
index 0000000000..722a5cd9dc
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Auth/Right_Thumb_wsq.iso b/apitest-commons/resource/Profile/Default/Auth/Right_Thumb_wsq.iso
new file mode 100644
index 0000000000..4f73143e4a
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Auth/Right_Thumb_wsq.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Exception_Photo.iso b/apitest-commons/resource/Profile/Default/Registration/Exception_Photo.iso
new file mode 100644
index 0000000000..80caced444
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Exception_Photo.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Face.iso b/apitest-commons/resource/Profile/Default/Registration/Face.iso
new file mode 100644
index 0000000000..5e84939bda
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Face.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Index.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Index.iso
new file mode 100644
index 0000000000..46c4112fae
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Iris.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Iris.iso
new file mode 100644
index 0000000000..fedadc7df9
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Little.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Little.iso
new file mode 100644
index 0000000000..d2b2684680
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Middle.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Middle.iso
new file mode 100644
index 0000000000..804de92ce9
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Ring.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Ring.iso
new file mode 100644
index 0000000000..b401048829
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Left_Thumb.iso b/apitest-commons/resource/Profile/Default/Registration/Left_Thumb.iso
new file mode 100644
index 0000000000..0574ba6c8e
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Left_Thumb.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Index.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Index.iso
new file mode 100644
index 0000000000..bfa1808ccc
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Index.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Iris.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Iris.iso
new file mode 100644
index 0000000000..72bb495bfb
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Iris.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Little.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Little.iso
new file mode 100644
index 0000000000..6b3badf299
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Little.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Middle.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Middle.iso
new file mode 100644
index 0000000000..0fa2255975
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Middle.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Ring.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Ring.iso
new file mode 100644
index 0000000000..9aa5dc523b
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Ring.iso differ
diff --git a/apitest-commons/resource/Profile/Default/Registration/Right_Thumb.iso b/apitest-commons/resource/Profile/Default/Registration/Right_Thumb.iso
new file mode 100644
index 0000000000..0931ac4fd4
Binary files /dev/null and b/apitest-commons/resource/Profile/Default/Registration/Right_Thumb.iso differ
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java
new file mode 100644
index 0000000000..461a6e57e8
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java
@@ -0,0 +1,858 @@
+package io.mosip.testrig.apirig.dataprovider;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+//import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
+//import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+//import java.time.LocalDateTime;
+//import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Arrays;
+//import java.util.Arrays;
+import java.util.Base64;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.apache.commons.codec.binary.Hex;
+import io.mosip.testrig.apirig.dataprovider.mds.MDSClient;
+import io.mosip.testrig.apirig.dataprovider.mds.MDSClientInterface;
+import io.mosip.testrig.apirig.dataprovider.models.BioModality;
+import io.mosip.testrig.apirig.dataprovider.models.BiometricDataModel;
+import io.mosip.testrig.apirig.dataprovider.models.IrisDataModel;
+import io.mosip.testrig.apirig.dataprovider.models.ResidentModel;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDevice;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDeviceCaptureModel;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSRCaptureModel;
+import io.mosip.testrig.apirig.dataprovider.util.CommonUtil;
+import io.mosip.testrig.apirig.dataprovider.util.DataProviderConstants;
+import io.mosip.testrig.apirig.dataprovider.util.FPClassDistribution;
+import io.mosip.testrig.apirig.testrunner.BaseTestCase;
+import io.mosip.testrig.apirig.utils.RestClient;
+import io.restassured.response.Response;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jamesmurty.utils.XMLBuilder;
+//import java.util.Date;
+
+import io.mosip.kernel.biometrics.commons.CbeffValidator;
+import io.mosip.kernel.biometrics.entities.BIR;
+import io.mosip.mock.sbi.test.CentralizedMockSBI;
+
+public class BiometricDataProvider {
+
+ public static HashMap portmap = new HashMap();
+ private static final Logger logger = LoggerFactory.getLogger(BiometricDataProvider.class);
+
+ // String constants
+ private static final String XMLNS = "xmlns";
+ private static final String MAJOR = "Major";
+ private static final String MINOR = "Minor";
+ private static final String CBEFFVERSION = "CBEFFVersion";
+ private static final String VERSION = "Version";
+ private static final String FALSE = "false";
+ private static final String BDBINFO = "BDBInfo";
+ private static final String BIRINFO = "BIRInfo";
+ private static final String INTEGRITY = "Integrity";
+ private static final String FORMAT = "Format";
+ private static final String CREATIONDATE = "CreationDate";
+ private static final String ORGANIZATION = "Organization";
+ private static final String MOSIP = "Mosip";
+ private static final String SUBTYPE = "Subtype";
+ private static final String PURPOSE = "Purpose";
+ private static final String LEVEL = "Level";
+ private static final String SHA_256 = "SHA-256";
+ private static final String ENROLL = "Enroll";
+ private static final String QUALITY = "Quality";
+ private static final String ALGORITHM = "Algorithm";
+ private static final String SCORE = "Score";
+ private static final String EXCEPTION = "EXCEPTION";
+ private static final String OTHERS = "others";
+ private static final String ENTRY = "entry";
+ private static final String RETRIES = "RETRIES";
+ private static final String SDK_SCORE = "SDK_SCORE";
+ private static final String FORCE_CAPTURED = "FORCE_CAPTURED";
+ private static final String PAYLOAD = "PAYLOAD";
+ private static final String SPEC_VERSION = "SPEC_VERSION";
+ public static final String AUTHCERTSPATH = "authCertsPath";
+ private static final String LEFTEYE = "leftEye";
+ private static final String RIGHTEYE = "rightEye";
+ private static final String RIGHT = "Right";
+ private static final String MOUNTPATH = "mountPath";
+ private static final String DIRPATH = "dirPath ";
+ private static final String SCENARIO = "scenario";
+ private static HashMap biometricDataMap = new HashMap();
+
+
+ public static void addToBiometricMap(String key, String value) {
+ biometricDataMap.put(key, value);
+ }
+
+ public static String getFromBiometricMap(String key) {
+ return biometricDataMap.get(key);
+ }
+
+ public static void main(String[] args) {
+ try {
+ generateBiometricTestData("Registration");
+ } catch (Exception e) {
+ logger.error("Failed to generate biometric test data " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ public static String toBase64Url(String input) {
+ // Encode the input string to bytes
+ byte[] byteData = input.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+ // Base64 URL-safe encode the byte data
+ String base64UrlStr = Base64.getUrlEncoder().withoutPadding().encodeToString(byteData);
+ return base64UrlStr;
+ }
+
+ public static Boolean generateBiometricTestData(String mdsMode) throws Exception {
+ ResidentModel resident = new ResidentModel();
+ String cbeff = null;
+ MDSRCaptureModel capture = BiometricDataProvider.regenBiometricViaMDS(resident, mdsMode, "70");
+ if (capture == null) {
+ logger.error("Failed to generate biometric via mds");
+ return false;
+ }
+ String strCBeff = toCBEFFFromCapture(Arrays.asList(DataProviderConstants.schemaNames), capture, null, false);
+
+// boolean isValid = CbeffValidator.validateXML(getBirs(strCBeff));
+
+
+ String encodedCBeff = toBase64Url(strCBeff);
+
+
+
+// byte[] decodedBytes = Base64.getUrlDecoder().decode(encodedCBeff);
+// String decodedCBeff = new String(decodedBytes, StandardCharsets.UTF_8);
+
+
+// isValid = CbeffValidator.validateXML(getBirs(decodedCBeff));
+
+ String strCBeffWithoutFace = toCBEFFFromCapture(Arrays.asList(DataProviderConstants.schemaNames), capture, null,
+ true);
+
+ String encodedCBeffWithoutFace = toBase64Url(strCBeffWithoutFace);
+
+ logger.info("strCBeff = " + strCBeff);
+//
+// logger.info("strCBeffWithoutFace = " + strCBeffWithoutFace);
+//
+ logger.info("encodedCBeff = " + encodedCBeff);
+
+ addToBiometricMap("BioValue", encodedCBeff);
+
+ addToBiometricMap("BioValueWithoutFace", encodedCBeffWithoutFace);
+
+ return true;
+ }
+
+// private static BIR getBirs(String cbeff) throws Exception {
+// try {
+// BIR birInfo = CbeffValidator.getBIRFromXML(cbeff.getBytes(StandardCharsets.UTF_8));
+// birInfo.setBirs(birInfo.getBirs().stream().filter(b -> b.getBdb() != null).toList());
+// return birInfo;
+// } catch (Exception ex) {
+// logger.error("Error while validating CBEFF", ex);
+// }
+// }
+
+ private static BIR getBirs(String cbeff) throws Exception {
+ try {
+ BIR birInfo = CbeffValidator.getBIRFromXML(cbeff.getBytes(StandardCharsets.UTF_8));
+ birInfo.setBirs(birInfo.getBirs().stream()
+ .filter(b -> b.getBdb() != null)
+ .collect(Collectors.toList()));
+ return birInfo;
+ } catch (Exception ex) {
+ logger.error("Error while validating CBEFF", ex);
+ throw ex; // Make sure to rethrow the exception to adhere to the method's signature
+ }
+ }
+
+ static String buildBirIris(String irisInfo, String irisName, String jtwSign, String payload, String qualityScore, String exception) throws ParserConfigurationException,
+ FactoryConfigurationError, TransformerException, FileNotFoundException {
+ String today = CommonUtil.getUTCDateTime(null);
+ XMLBuilder builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/")
+ .e(VERSION).e(MAJOR).t("1").up().e(MINOR).t("1").up().up().e(CBEFFVERSION).e(MAJOR).t("1").up().e(MINOR)
+ .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION)
+ .t(MOSIP).up().e("Type").t("9").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Iris").up()
+ .e(SUBTYPE).t(irisName).up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM)
+ .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up()
+ .e("BDB").t(getBase64EncodedStringFromBase64URL(irisInfo)).up().up();
+ if (jtwSign != null && payload != null) {
+ jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes());
+ builder.e("SB").t(jtwSign).up().
+
+ e(OTHERS).e(ENTRY).a("key", EXCEPTION).t(exception).up().e(ENTRY).a("key", RETRIES).t("1").up()
+ .e(ENTRY).a("key", SDK_SCORE).t("0.0").up().e(ENTRY).a("key", FORCE_CAPTURED).t(FALSE).up().e(ENTRY)
+ .a("key", PAYLOAD).t(payload).up().e(ENTRY).a("key", SPEC_VERSION).t("0.9.5").up().up();
+ }
+ return builder.asString(null);
+ }
+
+ static String getBase64EncodedStringFromBase64URL(String input) {
+ byte[] decodedBytes = Base64.getUrlDecoder().decode(input);
+// String decodedBdb = new String(decodedBytes, StandardCharsets.UTF_8);
+
+ return Base64.getEncoder().encodeToString(decodedBytes);
+ }
+
+ static String buildBirFinger(String fingerInfo, String fingerName, String jtwSign, String payload,
+ String qualityScore, String exception) throws ParserConfigurationException, FactoryConfigurationError,
+ TransformerException, FileNotFoundException {
+ String today = CommonUtil.getUTCDateTime(null);
+ XMLBuilder builder = null;
+ String bdbKey = "BDB";
+
+ builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/").e(VERSION)
+ .e(MAJOR).t("1").up().e(MINOR).t("1").up().up().e(CBEFFVERSION).e(MAJOR).t("1").up().e(MINOR).t("1")
+ .up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION).t(MOSIP).up()
+ .e("Type").t("7").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Finger").up().e(SUBTYPE)
+ .t(fingerName).up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM)
+ .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up()
+ .e(bdbKey).t(getBase64EncodedStringFromBase64URL(fingerInfo)).up().up();
+ if (jtwSign != null && payload != null) {
+ jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes());
+ builder.e("SB").t(jtwSign).up().
+
+ e(OTHERS).e(ENTRY).a("key", EXCEPTION).t(exception).up().e(ENTRY).a("key", RETRIES).t("1").up()
+ .e(ENTRY).a("key", SDK_SCORE).t("0.0").up().e(ENTRY).a("key", FORCE_CAPTURED).t(FALSE).up().e(ENTRY)
+ .a("key", PAYLOAD).t(payload).up().e(ENTRY).a("key", SPEC_VERSION).t("0.9.5").up().up();
+ }
+ return builder.asString(null);
+ }
+
+ static String buildBirFace(String faceInfo, String jtwSign, String payload, String qualityScore, String exception)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException,
+ FileNotFoundException {
+ String today = CommonUtil.getUTCDateTime(null);
+ XMLBuilder builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/")
+ .e(VERSION).e(MAJOR).t("1").up().e(MINOR).t("1").up().up().e(CBEFFVERSION).e(MAJOR).t("1").up().e(MINOR)
+ .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION)
+ .t(MOSIP).up().e("Type").t("8").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Face").up()
+ .e(SUBTYPE).t("").up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM)
+ .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up()
+ .e("BDB").t(getBase64EncodedStringFromBase64URL(faceInfo)).up().up();
+ if (jtwSign != null && payload != null) {
+ jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes());
+ builder.e("SB").t(jtwSign).up().
+
+ e(OTHERS).e(ENTRY).a("key", EXCEPTION).t(exception).up().e(ENTRY).a("key", RETRIES).t("1").up()
+ .e(ENTRY).a("key", SDK_SCORE).t("0.0").up().e(ENTRY).a("key", FORCE_CAPTURED).t(FALSE).up().e(ENTRY)
+ .a("key", PAYLOAD).t(payload).up().e(ENTRY).a("key", SPEC_VERSION).t("0.9.5").up().up();
+
+ }
+ return builder.asString(null);
+ }
+
+ static String buildBirExceptionPhoto(String faceInfo, String jtwSign, String payload, String qualityScore,
+ String exception) throws ParserConfigurationException, FactoryConfigurationError, TransformerException,
+ FileNotFoundException {
+ String today = CommonUtil.getUTCDateTime(null);
+ XMLBuilder builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/")
+ .e(VERSION).e(MAJOR).t("1").up().e(MINOR).t("1").up().up().e(CBEFFVERSION).e(MAJOR).t("1").up().e(MINOR)
+ .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION)
+ .t(MOSIP).up().e("Type").t("8").up().up().e(CREATIONDATE).t(today).up().e("Type").t("ExceptionPhoto")
+ .up().e(SUBTYPE).t("").up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM)
+ .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up()
+ .e("BDB").t(faceInfo).up().up();
+ if (jtwSign != null && payload != null) {
+ jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes());
+ builder.e("SB").t(jtwSign).up().
+
+ e(OTHERS).e(ENTRY).a("key", EXCEPTION).t(exception).up().e(ENTRY).a("key", RETRIES).t("1").up()
+ .e(ENTRY).a("key", SDK_SCORE).t("0.0").up().e(ENTRY).a("key", FORCE_CAPTURED).t(FALSE).up().e(ENTRY)
+ .a("key", PAYLOAD).t(payload).up().e(ENTRY).a("key", SPEC_VERSION).t("0.9.5").up().up();
+
+ }
+ return builder.asString(null);
+ }
+
+ public static List getModalitiesByType(List bioExceptions, String type) {
+ List lst = new ArrayList();
+
+ for (BioModality m : bioExceptions) {
+ if (m.getType().equalsIgnoreCase(type)) {
+ lst.add(m);
+ }
+ }
+ return lst;
+ }
+
+ public static void setMDSscore(long port, String type, String qualityScore) {
+
+ try {
+ String requestBody = "{\"type\":\"" + type + "\",\"qualityScore\":\"" + qualityScore
+ + "\",\"fromIso\":false}";
+
+ Response response = RestClient.post("http://127.0.0.1:" + port + "/admin/score", requestBody);
+ logger.info(response.toString());
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ JsonNode jsonNode = objectMapper.readTree(response.getBody().asString());
+ // Extract the errorInfo field
+ String errorInfo = jsonNode.get("errorInfo").asText();
+ logger.info("errorInfo: " + errorInfo);
+ } catch (Exception e) {
+ logger.error("Issue with the Rest Assured MOCKMDS Score Request{}", e);
+ }
+ }
+
+ public static String getKeysDirPath(String certsDir, String moduleName) {
+ String certsTargetDir = System.getProperty("java.io.tmpdir")+ File.separator + "AUTHCERTS";
+
+ if (System.getProperty("os.name").toLowerCase().contains("windows") == false) {
+ certsTargetDir = "/home/mosip/authcerts";
+ }
+
+ String certsModuleName = "IDA";
+
+
+ if (certsDir != null && certsDir.length() != 0){
+ certsTargetDir = certsDir;
+ }
+
+ if (moduleName != null && moduleName.length() != 0){
+ certsModuleName = moduleName;
+ }
+ return certsTargetDir + File.separator + certsModuleName + "-IDA-" + System.getProperty("env.user")+ ".mosip.net";
+ }
+
+ public static MDSRCaptureModel regenBiometricViaMDS(ResidentModel resident, String mdsMode, String qualityScore)
+ throws Exception {
+ BiometricDataModel biodata = null;
+ MDSRCaptureModel capture = null;
+ String contextKey = "default";
+ MDSClientInterface mds = null;
+ String val;
+ String mdsprofilePath = null;
+ String profileName = null;
+ int port = 0;
+ List filteredAttribs = resident.getFilteredBioAttribtures();
+ List bioExceptions = resident.getBioExceptions();
+ List bioexceptionlist = new ArrayList();
+
+ try {
+
+ Path p12path = Paths.get(getKeysDirPath("", BaseTestCase.certsForModule));
+
+// Path p12path = Paths.get("C:\\Users\\NANDHU~1\\AppData\\Local\\Temp\\AUTHCERTS\\IDA-api-internal.qa-inji.mosip.net");
+
+ int maxLoopCount = 20;
+
+ while (maxLoopCount > 0) {
+ try {
+ port = CentralizedMockSBI.startSBI(contextKey, mdsMode, "Biometric Device", p12path.toString());
+ } catch (Exception e) {
+ logger.error("Exception occured during startSBI " + contextKey, e);
+ }
+ if (port != 0) {
+ logger.info(contextKey, "Found the port " + contextKey + " port number is: " + port);
+ break;
+ }
+
+ maxLoopCount--;
+ }
+
+ if (port == 0) {
+ logger.error("Unable to find the port " + contextKey + " port number is: " + port);
+ return null;
+ }
+
+ portmap.put("port_", port);
+
+ mds = new MDSClient(port);
+ mds.setProfile("Default", port, contextKey);
+
+ // Change mockmds quality score
+
+ HashMap portAsPerKey = BiometricDataProvider.portmap;
+ setMDSscore(portAsPerKey.get("port_"), "Biometric Device", qualityScore);
+ logger.info(contextKey, "mds score is changed to : " + qualityScore);
+// biodata = resident.getBiometric();
+
+ // This condition will address those scenarios where we are not passing any biometrics
+// if (biodata.getFaceHash() == null && biodata.getFingerHash() == null && biodata.getIris() == null)
+// return new MDSRCaptureModel();
+ } catch (Throwable t) {
+ logger.error(" Port issue " + contextKey, t);
+ t.getStackTrace();
+ return null;
+ }
+
+ // Get Exceptions modalities and add them to list of string
+// if (bioExceptions != null && !bioExceptions.isEmpty()) {
+// for (int modalityCount = 0; modalityCount < bioExceptions.size(); modalityCount++)
+// bioexceptionlist.add(bioExceptions.get(modalityCount).getSubType().toString());
+// }
+
+ // Step 1 : Face get capture
+ try {
+// if ((filteredAttribs != null && filteredAttribs.contains("face")) && biodata.getRawFaceData() != null) {
+
+ List faceDevices = mds.getRegDeviceInfo(DataProviderConstants.MDS_DEVICE_TYPE_FACE);
+ MDSDevice faceDevice = faceDevices.get(0);
+
+ capture = mds.captureFromRegDevice(faceDevice, capture, DataProviderConstants.MDS_DEVICE_TYPE_FACE, null,
+ 60, faceDevice.getDeviceSubId().get(0), port, contextKey, null);
+// }
+ }
+
+ catch (Throwable t) {
+ logger.error(" Face get capture fail" + contextKey, t);
+ t.getStackTrace();
+ return null;
+ }
+
+ // Step 2 : IRIS get capture
+ try {
+
+ List irisDevices = mds.getRegDeviceInfo(DataProviderConstants.MDS_DEVICE_TYPE_IRIS);
+ MDSDevice irisDevice = irisDevices.get(0);
+
+ capture = mds.captureFromRegDevice(irisDevice, capture, DataProviderConstants.MDS_DEVICE_TYPE_IRIS, null,
+ 60, irisDevice.getDeviceSubId().get(0), port, contextKey, null);
+
+ if (irisDevice.getDeviceSubId().size() > 1) {
+
+ capture = mds.captureFromRegDevice(irisDevice, capture, DataProviderConstants.MDS_DEVICE_TYPE_IRIS,
+ null, 60, irisDevice.getDeviceSubId().get(1), port, contextKey, null);
+ }
+
+ }
+ catch (Throwable t) {
+ logger.error(" IRIS get capture fail" + contextKey, t);
+ t.getStackTrace();
+ return null;
+ }
+
+ // Step 3 : Finger get capture
+ try {
+ List fingerDevices = mds.getRegDeviceInfo(DataProviderConstants.MDS_DEVICE_TYPE_FINGER);
+ MDSDevice fingerDevice = fingerDevices.get(0);
+
+ for (int i = 0; i < fingerDevice.getDeviceSubId().size(); i++) {
+ capture = mds.captureFromRegDevice(fingerDevice, capture, DataProviderConstants.MDS_DEVICE_TYPE_FINGER,
+ null, 60, fingerDevice.getDeviceSubId().get(i), port, contextKey, null);
+ }
+ } catch (Throwable t) {
+ logger.error("Finger get capture fail" + contextKey, t);
+ t.getStackTrace();
+ return null;
+ }
+
+ CentralizedMockSBI.stopSBI(contextKey);
+
+ return capture;
+ }
+
+ public static String toCBEFFFromCapture(List bioFilter, MDSRCaptureModel capture,
+ List exceptionlist, boolean skipFace) throws Exception {
+
+ String retXml = "";
+
+ String mosipVersion = "1.2.1-SNAPSHOT";
+
+ XMLBuilder builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/")
+ .e(BIRINFO).e(INTEGRITY).t(FALSE).up().up();
+
+ builder.getDocument().setXmlStandalone(true);
+
+ List bioSubType = new ArrayList<>();
+
+ // Step 1: convert finger print
+ try {
+ List lstFingerData = capture.getLstBiometrics()
+ .get(DataProviderConstants.MDS_DEVICE_TYPE_FINGER);
+
+ builder = xmlbuilderFinger(bioFilter, lstFingerData, bioSubType, builder, exceptionlist);
+
+ if (exceptionlist != null && !exceptionlist.isEmpty()) {
+ builder = xmlbuilderFingerExep(bioFilter, exceptionlist, bioSubType, builder);
+ }
+ } catch (Exception e) {
+ logger.error("xmlbuilderFinger failed" + e.getMessage());
+ }
+
+ // Step 2: Add Face
+
+ if (skipFace == false) {
+ try {
+ if (bioFilter.contains("face")) {
+
+ List lstFaceData = capture.getLstBiometrics()
+ .get(DataProviderConstants.MDS_DEVICE_TYPE_FACE);
+ bioSubType.add("face");
+
+ addToBiometricMap("FaceBioValue", getBase64EncodedStringFromBase64URL(lstFaceData.get(0).getBioValue()));
+
+ String faceXml = buildBirFace(lstFaceData.get(0).getBioValue(), lstFaceData.get(0).getSb(),
+ lstFaceData.get(0).getPayload(), lstFaceData.get(0).getQualityScore(), FALSE);
+ builder = builder.importXMLBuilder(XMLBuilder.parse(faceXml));
+
+ }
+ } catch (Exception e) {
+ logger.error("buildBirFace failed");
+ logger.error(e.getMessage());
+ }
+ }
+
+ // Step 3: Add IRIS
+ try {
+ List lstIrisData = capture.getLstBiometrics()
+ .get(DataProviderConstants.MDS_DEVICE_TYPE_IRIS);
+
+ builder = xmlbuilderIris(bioFilter, lstIrisData, bioSubType, builder, exceptionlist);
+
+ if (exceptionlist != null && !exceptionlist.isEmpty()) {
+ builder = xmlbuilderIrisExcep(bioFilter, exceptionlist, bioSubType, builder);
+ }
+ } catch (Exception e) {
+ logger.error("xmlbuilderIris failed");
+ logger.error(e.getMessage());
+ }
+
+ // Step 4: Add Face as an Exception photo
+
+ try {
+ if (exceptionlist != null && !exceptionlist.isEmpty()) {
+ List lstFaceData = capture.getLstBiometrics().get(EXCEPTION);
+ bioSubType.add("exceptionphoto");
+ String faceXml = buildBirExceptionPhoto(lstFaceData.get(1).getBioValue(), lstFaceData.get(1).getSb(),
+ lstFaceData.get(1).getPayload(), lstFaceData.get(1).getQualityScore(), FALSE);
+ builder = builder.importXMLBuilder(XMLBuilder.parse(faceXml));
+ }
+ } catch (Exception e) {
+ logger.error("buildBirExceptionPhoto failed");
+ logger.error(e.getMessage());
+ }
+
+// // Print builder
+//
+// if (mosipVersion != null && mosipVersion.startsWith("1.2") && !bioSubType.isEmpty()) {
+// builder.e(OTHERS).e("Key").t("CONFIGURED").up().e("Value")
+// .t(bioSubType.toString().substring(1, bioSubType.toString().length() - 1)).up().up();
+// }
+
+ retXml = builder.asString(null);
+ return retXml;
+ }
+
+ private static XMLBuilder xmlbuilderIris(List bioFilter, List lstIrisData,
+ List bioSubType, XMLBuilder builder, List exceptionlst)
+
+ {
+ List listWithoutExceptions = bioFilter;
+ if (exceptionlst != null && !exceptionlst.isEmpty()) {
+ List exceptions = exceptionlst.stream().map(BioModality::getSubType).collect(Collectors.toList());
+ List schemaName = new ArrayList();
+ for (String ex : exceptions) {
+ schemaName.add(getschemaName(ex));
+ }
+ listWithoutExceptions = bioFilter.stream().filter(bioAttribute -> !schemaName.contains(bioAttribute))
+ .collect(Collectors.toList());
+ }
+// RestClient.logInfo(contextKey, "withoutExceptionList is: " + listWithoutExceptions);
+
+ try {
+ if (lstIrisData != null) {
+ String irisXml = "";
+ for (MDSDeviceCaptureModel cm : lstIrisData) {
+
+ if (listWithoutExceptions.contains(LEFTEYE) && cm.getBioSubType().equals("Left")) {
+ irisXml = buildBirIris(cm.getBioValue(), "Left", cm.getSb(), cm.getPayload(),
+ cm.getQualityScore(), FALSE);
+ builder = builder.importXMLBuilder(XMLBuilder.parse(irisXml));
+ bioSubType.add("Left");
+ addToBiometricMap("LeftIrisBioValue", getBase64EncodedStringFromBase64URL(cm.getBioValue()));
+ }
+ if (listWithoutExceptions.contains(RIGHTEYE) && cm.getBioSubType().equals(RIGHT)) {
+
+ irisXml = buildBirIris(cm.getBioValue(), RIGHT, cm.getSb(), cm.getPayload(),
+ cm.getQualityScore(), FALSE);
+ builder = builder.importXMLBuilder(XMLBuilder.parse(irisXml));
+ bioSubType.add(RIGHT);
+ addToBiometricMap("RightIrisBioValue", getBase64EncodedStringFromBase64URL(cm.getBioValue()));
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ return builder;
+ }
+
+ private static XMLBuilder xmlbuilderIrisExcep(List bioFilter, List lstIrisData,
+ List bioSubType, XMLBuilder builder) {
+ try {
+ if (lstIrisData != null) {
+ for (BioModality finger : lstIrisData) {
+ if (!finger.getType().equalsIgnoreCase("Iris"))
+ continue;
+
+ String strFingerXml = buildBirIris(finger.getType(), finger.getSubType(),
+ Arrays.toString(new byte[0]), "", "0", "true");
+ XMLBuilder fbuilder = XMLBuilder.parse(strFingerXml);
+ builder = builder.importXMLBuilder(fbuilder);
+ }
+
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ return builder;
+ }
+
+ private static String getschemaName(String name) {
+ // First check if it falls in all modaities
+ for (int i = 0; i < 13; i++) {
+ String displayFingerName = DataProviderConstants.displayFullName[i];
+ if (displayFingerName.equalsIgnoreCase(name) == true)
+ return DataProviderConstants.schemaNames[i];
+ }
+
+ // Other wise just return
+ return name;
+ }
+
+ private static XMLBuilder xmlbuilderFinger(List bioFilter, List lstFingerData,
+ List bioSubType, XMLBuilder builder, List exceptionlst) {
+ List listWithoutExceptions = bioFilter;
+ if (exceptionlst != null && !exceptionlst.isEmpty()) {
+ List exceptions = exceptionlst.stream().map(BioModality::getSubType).collect(Collectors.toList());
+// RestClient.logInfo(contextKey, "exceptions" + exceptions);
+ List schemaName = new ArrayList();
+ for (String ex : exceptions) {
+ schemaName.add(getschemaName(ex));
+ }
+ listWithoutExceptions = bioFilter.stream().filter(bioAttribute -> !schemaName.contains(bioAttribute))
+ .collect(Collectors.toList());
+ }
+
+ // getschemaName(BioModality::getSubType)
+
+ int i = 0;
+ String fingerData = null;
+
+ try {
+ if (lstFingerData != null) {
+ for (String finger : listWithoutExceptions) {
+ if (finger.toLowerCase().contains("eye") || finger.toLowerCase().equals("face"))
+ continue;
+ i = Arrays.asList(DataProviderConstants.schemaNames).indexOf(finger);
+ String displayName = DataProviderConstants.displayFingerName[i];
+ MDSDeviceCaptureModel currentCM = null;
+ for (MDSDeviceCaptureModel cm : lstFingerData) {
+ if (cm.getBioSubType().equals(displayName)) {
+ fingerData = cm.getBioValue();
+ bioSubType.add(finger);
+ currentCM = cm;
+ break;
+ }
+ }
+// RestClient.logInfo(contextKey, "fingerData is: " + fingerData);
+ if (i >= 0 && fingerData != null && currentCM != null) {
+ // Write the BDB values for all finger modalities in proper file.
+
+ addToBiometricMap(DataProviderConstants.schemaNames[i], getBase64EncodedStringFromBase64URL(fingerData));
+ String strFinger = DataProviderConstants.displayFingerName[i];
+ String strFingerXml = buildBirFinger(fingerData, strFinger, currentCM.getSb(),
+ currentCM.getPayload(), currentCM.getQualityScore(), FALSE);
+ XMLBuilder fbuilder = XMLBuilder.parse(strFingerXml);
+ builder = builder.importXMLBuilder(fbuilder);
+ }
+
+ }
+ }
+
+ } catch (Exception e1) {
+ logger.error(e1.getMessage());
+ }
+ return builder;
+ }
+
+ private static XMLBuilder xmlbuilderFingerExep(List bioFilter, List lstFingerData,
+ List bioSubType, XMLBuilder builder)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException, SAXException,
+ IOException {
+
+ if (lstFingerData != null) {
+ for (BioModality finger : lstFingerData) {
+ if (finger.getType().equalsIgnoreCase("iris") || finger.getType().equalsIgnoreCase("face"))
+ continue;
+
+ String strFingerXml = buildBirFinger(finger.getType(), finger.getSubType(),
+ Arrays.toString(new byte[0]), "", "0", "true");
+ XMLBuilder fbuilder = XMLBuilder.parse(strFingerXml);
+ builder = builder.importXMLBuilder(fbuilder);
+ }
+
+ }
+
+ return builder;
+ }
+
+ /*
+ * Construct CBEFF format XML file from biometric data
+ */
+ public static String toCBEFF(List bioFilter, BiometricDataModel biometricDataModel, String toFile,
+ boolean genarateValidCbeff, String contextKey) throws Exception {
+ String retXml = "";
+
+ XMLBuilder builder = XMLBuilder.create("BIR").a(XMLNS, "http://standards.iso.org/iso-iec/19785/-3/ed-2/")
+ .e(BIRINFO).e(INTEGRITY).t(FALSE).up().up();
+
+ builder.getDocument().setXmlStandalone(true);
+
+ // Step 1: convert finger print
+ String[] fingerPrint = biometricDataModel.getFingerPrint();
+
+ // get qualityScore
+ String qualityScore = null;
+ Hashtable> capture = biometricDataModel.getCapture();
+ Enumeration> elements = capture.elements();
+ while (elements.hasMoreElements()) {
+ List nextElement = elements.nextElement();
+ qualityScore = nextElement.get(0).getQualityScore();
+ break;
+ }
+
+ int i = 0;
+ for (String finger : bioFilter) {
+ if (finger.toLowerCase().contains("eye") || finger.toLowerCase().equals("face"))
+ continue;
+ i = Arrays.asList(DataProviderConstants.schemaNames).indexOf(finger);
+
+ if (i >= 0) {
+ String strFinger = DataProviderConstants.displayFingerName[i];
+ String strFingerXml = buildBirFinger(fingerPrint[i], strFinger, null, null, qualityScore, FALSE);
+
+ XMLBuilder fbuilder = XMLBuilder.parse(strFingerXml);
+ builder = builder.importXMLBuilder(fbuilder);
+ }
+
+ }
+
+ // Step 2: Add Face
+ if (bioFilter.contains("Face")) {
+ if (biometricDataModel.getEncodedPhoto() != null) {
+ String faceXml = buildBirFace(biometricDataModel.getEncodedPhoto(), null, null, qualityScore, "true");
+ builder = builder.importXMLBuilder(XMLBuilder.parse(faceXml));
+ }
+ }
+
+ // Step 3: Add IRIS
+ IrisDataModel irisInfo = biometricDataModel.getIris();
+ if (irisInfo != null) {
+ String irisXml = "";
+ if (bioFilter.contains(LEFTEYE)) {
+ irisXml = buildBirIris(irisInfo.getLeft(), "Left", null, null, qualityScore, "true");
+ builder = builder.importXMLBuilder(XMLBuilder.parse(irisXml));
+ }
+ if (bioFilter.contains(RIGHTEYE)) {
+ irisXml = buildBirIris(irisInfo.getRight(), RIGHT, null, null, qualityScore, "true");
+ builder = builder.importXMLBuilder(XMLBuilder.parse(irisXml));
+ }
+ }
+
+ if (toFile != null) {
+ FileOutputStream fos = new FileOutputStream(toFile);
+ PrintWriter writer = new PrintWriter(fos);
+ builder.toWriter(true, writer, null);
+ fos.close();
+ }
+ retXml = builder.asString(null);
+ return retXml;
+ }
+
+
+ // generate using Anguli
+
+ static Hashtable> generateFingerprint(String outDir, int nFingerPrints,
+ int nImpressionsPerPrints, int nThreads, FPClassDistribution classDist, String contextKey) {
+
+ Hashtable> tblFiles = new Hashtable>();
+
+ // C:\Mosip.io\gitrepos\biometric-data\anguli
+ String[] commands = { DataProviderConstants.ANGULI_PATH + "/Anguli.exe", "-outdir", outDir, "-numT",
+ String.format("%d", nThreads), "-num", String.format("%d", nFingerPrints), "-ni",
+ String.format("%d", nImpressionsPerPrints), "-cdist", classDist.name() };
+// RestClient.logInfo(contextKey, "Anguli commands" + commands);
+ ProcessBuilder pb = new ProcessBuilder(commands);
+ pb.directory(new File(DataProviderConstants.ANGULI_PATH));
+
+ try {
+ Process proc = pb.start(); // rt.exec(commands);
+ BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
+ // Read any errors from the attempted command
+ // logger.info("Error:\n");
+ String s;
+
+ while ((s = stdError.readLine()) != null) {
+// RestClient.logInfo(contextKey, s);
+ }
+ // read from outdir
+ for (int i = 1; i <= nImpressionsPerPrints; i++) {
+
+ List lst = CommonUtil.listFiles(outDir + String.format("/Impression_%d/fp_1/", i));
+ tblFiles.put(i, lst);
+ }
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ }
+ return tblFiles;
+ }
+
+ public static IrisDataModel loadIris(String filePath, String subModality, IrisDataModel im) throws Exception {
+
+ IrisDataModel m = im;
+ if (m == null)
+ m = new IrisDataModel();
+ String irisData = "";
+ String irisHash = "";
+
+ if (Files.exists(Paths.get(filePath))) {
+ byte[] fdata = CommonUtil.read(filePath);
+ irisData = Hex.encodeHexString(fdata);
+ irisHash = CommonUtil.getHexEncodedHash(fdata);
+ if (subModality.equals("left")) {
+ m.setLeftHash(irisHash);
+ m.setLeft(irisData);
+ } else {
+ m.setRightHash(irisHash);
+ m.setRight(irisData);
+ }
+ }
+
+ return m;
+ }
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/HttpRCapture.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/HttpRCapture.java
new file mode 100644
index 0000000000..b0c4db96e1
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/HttpRCapture.java
@@ -0,0 +1,39 @@
+package io.mosip.testrig.apirig.dataprovider.mds;
+import java.net.URI;
+
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpRCapture extends HttpEntityEnclosingRequestBase{
+private static final Logger logger = LoggerFactory.getLogger(HttpRCapture.class);
+
+//HttpRequestBase
+
+
+ String METHOD_NAME ;
+
+ public void setMethod(String method) {
+ METHOD_NAME = method;
+ }
+ public HttpRCapture() {
+ super();
+ METHOD_NAME = "RCAPTURE";
+ }
+
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+
+ public HttpRCapture(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ METHOD_NAME = "RCAPTURE";
+ }
+
+ public String getName() {
+ return METHOD_NAME;
+ }
+}
+
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/ISOConverter.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/ISOConverter.java
new file mode 100644
index 0000000000..0bd22c8263
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/ISOConverter.java
@@ -0,0 +1,284 @@
+package io.mosip.testrig.apirig.dataprovider.mds;
+
+
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.io.Files;
+
+import io.mosip.biometrics.util.CommonUtil;
+import io.mosip.biometrics.util.ConvertRequestDto;
+import io.mosip.biometrics.util.face.FaceEncoder;
+import io.mosip.biometrics.util.finger.FingerEncoder;
+import io.mosip.biometrics.util.finger.FingerPosition;
+import io.mosip.biometrics.util.iris.IrisEncoder;
+
+public class ISOConverter {
+
+ static Map mapFingerPos = new HashMap();
+ static {
+ mapFingerPos.put("Right Thumb", FingerPosition.RIGHT_THUMB);
+ mapFingerPos.put("Right IndexFinger", FingerPosition.RIGHT_INDEX_FINGER);
+ mapFingerPos.put("Right MiddleFinger", FingerPosition.RIGHT_MIDDLE_FINGER);
+ mapFingerPos.put("Right RingFinger", FingerPosition.RIGHT_RING_FINGER);
+ mapFingerPos.put("Right LittleFinger", FingerPosition.RIGHT_LITTLE_FINGER);
+ mapFingerPos.put("Left Thumb", FingerPosition.LEFT_THUMB);
+ mapFingerPos.put("Left IndexFinger", FingerPosition.LEFT_INDEX_FINGER);
+ mapFingerPos.put("Left MiddleFinger", FingerPosition.LEFT_MIDDLE_FINGER);
+ mapFingerPos.put("Left RingFinger", FingerPosition.LEFT_RING_FINGER);
+ mapFingerPos.put("Left LittleFinger", FingerPosition.LEFT_LITTLE_FINGER);
+
+ }
+ public static int getFingerPos(String bioSubType) {
+ Integer fingerPosition = mapFingerPos.get(bioSubType);
+ return fingerPosition;
+ }
+ public byte [] convertFinger(byte[] inStream, String outFile, String biometricSubType,String purpose) throws Exception {
+ /*
+ byte[] imageData = inStream;// Base64.getDecoder().decode(inStream);
+
+ //ImageDataType imageDataType = ImageDataType.JPEG2000_LOSS_LESS;
+ // ByteArrayInputStream bis = new ByteArrayInputStream(imageData);
+
+ // BufferedImage buffImg = ImageIO.read(bis);
+
+
+ int fingerPosition = mapFingerPos.get(biometricSubType);
+ long formatIdentifier = FingerFormatIdentifier.FORMAT_FIR;
+ int versionNumber = FingerVersionNumber.VERSION_020;
+ int certificationFlag = FingerCertificationFlag.UNSPECIFIED;
+
+ FingerCaptureDeviceTechnology sourceType = FingerCaptureDeviceTechnology.UNSPECIFIED;
+ FingerCaptureDeviceVendor deviceVendor = FingerCaptureDeviceVendor.UNSPECIFIED;
+ FingerCaptureDeviceType deviceType = FingerCaptureDeviceType.UNSPECIFIED;
+ Date captureDate = new Date ();// the date instance
+ int noOfRepresentations= (int)0x0001;
+ FingerQualityAlgorithmVendorIdentifier algorithmVendorIdentifier = FingerQualityAlgorithmVendorIdentifier.NIST;
+ FingerQualityAlgorithmIdentifier qualityAlgorithmIdentifier = FingerQualityAlgorithmIdentifier.NIST;
+
+ int quality = 80;
+ FingerQualityBlock [] qualityBlocks = new FingerQualityBlock [] { new FingerQualityBlock ((byte)quality , algorithmVendorIdentifier, qualityAlgorithmIdentifier)};
+ FingerCertificationBlock[] certificationBlocks = null;
+
+ int representationNo = (int)0x0000;
+ FingerScaleUnitType scaleUnitType = FingerScaleUnitType.PIXELS_PER_INCH;
+ int captureDeviceSpatialSamplingRateHorizontal = 500;
+ int captureDeviceSpatialSamplingRateVertical = 500;
+ int imageSpatialSamplingRateHorizontal = 500;
+ int imageSpatialSamplingRateVertical = 500;
+ FingerImageBitDepth bitDepth = FingerImageBitDepth.BPP_08;
+ FingerImpressionType impressionType = FingerImpressionType.UNKNOWN;
+ int lineLengthHorizontal = 0;
+ int lineLengthVertical = 0;
+
+ int noOfFingerPresent = (int)0x0001;
+ SegmentationBlock segmentationBlock = null;
+ AnnotationBlock annotationBlock = null;
+ CommentBlock commentBlock = null;
+
+ FingerImageCompressionType compressionType = FingerImageCompressionType.JPEG_2000_LOSS_LESS;
+
+ */
+
+ byte[] jp2bytes= CommonUtil.convertJPEGToJP2UsingOpenCV(inStream, 95);
+ ConvertRequestDto convertRequestDto=new ConvertRequestDto();
+ convertRequestDto.setBiometricSubType(biometricSubType);
+ convertRequestDto.setImageType(0);
+ convertRequestDto.setInputBytes(jp2bytes);
+ convertRequestDto.setModality("Finger");
+ convertRequestDto.setPurpose(purpose);//R
+ convertRequestDto.setVersion("ISO19794_4_2011");
+// byte [] isoData = FingerEncoder.convertFingerImageToISO19794_4_2011
+// (
+// formatIdentifier, versionNumber, certificationFlag,
+// sourceType, deviceVendor, deviceType,
+// captureDate, noOfRepresentations,
+// qualityBlocks, certificationBlocks,
+// fingerPosition, representationNo, scaleUnitType,
+// captureDeviceSpatialSamplingRateHorizontal, captureDeviceSpatialSamplingRateVertical,
+// imageSpatialSamplingRateHorizontal, imageSpatialSamplingRateVertical,
+// bitDepth, compressionType,
+// impressionType, lineLengthHorizontal, lineLengthVertical,
+// noOfFingerPresent, imageData,
+// segmentationBlock, annotationBlock, commentBlock
+// );
+ byte [] isoData = FingerEncoder.convertFingerImageToISO(convertRequestDto);
+ if (isoData != null && outFile != null)
+ {
+ Files.write(isoData,new File(outFile));
+
+ }
+ return isoData;
+ }
+ public byte [] convertIris(byte[] inStream, String outFile, String biometricSubType) throws Exception {
+
+ /*
+ byte[] imageData = inStream;//Base64.getDecoder().decode(inStream);
+
+ //ImageDataType imageDataType = ImageDataType.JPEG2000_LOSS_LESS;
+ ByteArrayInputStream bis = new ByteArrayInputStream(imageData);
+
+ BufferedImage buffImg = ImageIO.read(bis);
+ int imageWidth = buffImg.getWidth();
+ int imageHeight = buffImg.getHeight();
+ long formatIdentifier = IrisFormatIdentifier.FORMAT_IIR;
+ long versionNumber = IrisVersionNumber.VERSION_020;
+ int certificationFlag = IrisCertificationFlag.UNSPECIFIED;
+
+ Date captureDate = new Date ();// the date instance
+
+ int algorithmVendorIdentifier = IrisQualityAlgorithmVendorIdentifier.ALGORITHM_VENDOR_IDENTIFIER_0001;
+ int qualityAlgorithmIdentifier = IrisQualityAlgorithmIdentifier.ALGORITHM_IDENTIFIER_0001;
+
+ int eyeLabel = EyeLabel.UNSPECIFIED;
+ if (biometricSubType.equals("Left"))
+ eyeLabel = EyeLabel.LEFT;
+ else if (biometricSubType.equals("Right"))
+ eyeLabel = EyeLabel.RIGHT;
+ int range = 0x0000;
+ int rollAngleOfEye = 0xFFFF;//ANGLE_UNDEFINED
+ int rollAngleUncertainty = 0xFFFF; //UNCERTAIN_UNDEFINED
+ int irisCenterSmallestX = 0x0000; //COORDINATE_UNDEFINED
+ int irisCenterLargestX = 0x0000; //COORDINATE_UNDEFINED
+ int irisCenterSmallestY = 0x0000; //COORDINATE_UNDEFINED
+ int irisCenterLargestY = 0x0000; //COORDINATE_UNDEFINED
+ int irisDiameterSmallest = 0x0000; //COORDINATE_UNDEFINED
+ int irisDiameterLargest = 0x0000; //COORDINATE_UNDEFINED
+ int imageType = ImageType.CROPPED;
+ int imageFormat = ImageFormat.MONO_JPEG2000;//0A
+ int horizontalOrientation = Orientation.UNDEFINED;
+ int verticalOrientation = Orientation.UNDEFINED;
+ int compressionType = IrisImageCompressionType.UNDEFINED;
+ int bitDepth = IrisImageBitDepth.BPP_08;
+ int noOfRepresentations = (int)0x0001;
+ int representationNo = (int)0x0001;
+ int noOfEyesPresent = (int)0x0001;
+ int sourceType = IrisCaptureDeviceTechnology.CMOS_OR_CCD;
+ int deviceVendor = IrisCaptureDeviceVendor.UNSPECIFIED;
+ int deviceType = IrisCaptureDeviceType.UNSPECIFIED;
+ int quality = 80;
+ IrisQualityBlock [] qualityBlocks = new IrisQualityBlock [] { new IrisQualityBlock ((byte)quality , algorithmVendorIdentifier, qualityAlgorithmIdentifier)};
+ */
+ byte[] jp2bytes= CommonUtil.convertJPEGToJP2UsingOpenCV(inStream, 95);
+ ConvertRequestDto convertRequestDto=new ConvertRequestDto();
+ convertRequestDto.setBiometricSubType(biometricSubType);
+ convertRequestDto.setImageType(0);
+ convertRequestDto.setInputBytes(jp2bytes);
+ convertRequestDto.setModality("Iris");
+ convertRequestDto.setPurpose("Registration");
+ convertRequestDto.setVersion("ISO19794_6_2011");
+// byte [] isoData = IrisEncoder.convertIrisImageToISO19794_6_2011
+// (
+// formatIdentifier, versionNumber,
+// certificationFlag, captureDate,
+// noOfRepresentations, representationNo, noOfEyesPresent,
+// eyeLabel, imageType, imageFormat,
+// horizontalOrientation, verticalOrientation, compressionType,
+// imageWidth, imageHeight, bitDepth, range, rollAngleOfEye, rollAngleUncertainty,
+// irisCenterSmallestX, irisCenterLargestX, irisCenterSmallestY, irisCenterLargestY,
+// irisDiameterSmallest, irisDiameterLargest,
+// sourceType, deviceVendor, deviceType,
+// qualityBlocks,
+// imageData, imageWidth, imageHeight
+// );
+ byte [] isoData = IrisEncoder.convertIrisImageToISO(convertRequestDto);
+ if (isoData != null && outFile != null)
+ {
+ Files.write(isoData,new File(outFile));
+
+ }
+ return isoData;
+ }
+
+ public byte [] convertFace(byte[] inStream, String outFile) throws Exception {
+
+ /* long formatIdentifier = FaceFormatIdentifier.FORMAT_FAC;
+ long versionNumber = FaceVersionNumber.VERSION_030;
+ int certificationFlag = FaceCertificationFlag.UNSPECIFIED;
+ int temporalSequenceFlags = TemporalSequenceFlags.ONE_REPRESENTATION;
+ Date captureDate = new Date ();// the date instance
+ short noOfLandMarkPoints = 0x00;
+ int algorithmVendorIdentifier = FaceQualityAlgorithmVendorIdentifier.ALGORITHM_VENDOR_IDENTIFIER_0001;
+ int qualityAlgorithmIdentifier = FaceQualityAlgorithmIdentifier.ALGORITHM_IDENTIFIER_0001;
+ int eyeColour = EyeColour.UNSPECIFIED;
+ int featureMask = 0;
+ int subjectHeight = HeightCodes.UNSPECIFIED;
+ int hairColour = HairColour.UNSPECIFIED;
+ int expression = 0;
+ int features = Features.FEATURES_ARE_SPECIFIED;
+ int noOfRepresentations = (int)0x0001;
+ int gender = Gender.UNKNOWN;
+ int [] poseAngle = { 0, 0, 0 };
+ int [] poseAngleUncertainty = { 0, 0, 0 };
+ int faceImageType = FaceImageType.FULL_FRONTAL;
+ int imageColourSpace = ImageColourSpace.BIT_24_RGB;
+ int sourceType = FaceCaptureDeviceTechnology.VIDEO_FRAME_ANALOG_CAMERA;
+ int deviceVendor = FaceCaptureDeviceVendor.UNSPECIFIED;
+ int deviceType = FaceCaptureDeviceType.UNSPECIFIED;
+
+ int spatialSamplingRateLevel = SpatialSamplingRateLevel.SPATIAL_SAMPLING_RATE_LEVEL_180;
+ int postAcquisitionProcessing = 0;
+ int crossReference = CrossReference.BASIC;
+ int quality = 80;
+ LandmarkPoints [] landmarkPoints = null;
+ FaceQualityBlock [] qualityBlock = new FaceQualityBlock [] { new FaceQualityBlock ((byte)quality , algorithmVendorIdentifier, qualityAlgorithmIdentifier)};
+ //Base64.getEncoder().encodeToString
+
+ byte[] imageData = inStream;//Base64.getDecoder().decode(inStream);
+
+ int imageDataType = ImageDataType.JPEG2000_LOSS_LESS; // In future need to change
+
+ //discuss //int imageDataType = convertRequestDto.getPurpose().equalsIgnoreCase("AUTH") ? ImageDataType.JPEG2000_LOSSY :ImageDataType.JPEG2000_LOSS_LESS;
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(imageData);
+
+ BufferedImage buffImg = ImageIO.read(bis);
+ int imageWidth = buffImg.getWidth();
+ int imageHeight = buffImg.getHeight();
+
+ */
+
+
+
+ byte[] jp2bytes= CommonUtil.convertJPEGToJP2UsingOpenCV(inStream, 95);
+ ConvertRequestDto convertRequestDto=new ConvertRequestDto();
+ convertRequestDto.setBiometricSubType("");
+ convertRequestDto.setImageType(0);
+ convertRequestDto.setInputBytes(jp2bytes);
+ convertRequestDto.setModality("Face");
+ convertRequestDto.setPurpose("Registration");
+ convertRequestDto.setVersion("ISO19794_5_2011");
+// byte [] isoData = FaceEncoder.convertFaceImageToISO19794_5_2011
+// (
+// formatIdentifier, versionNumber,
+// certificationFlag, temporalSequenceFlags,
+// captureDate, noOfRepresentations, noOfLandMarkPoints,
+// gender, eyeColour, featureMask,
+// hairColour, subjectHeight, expression,
+// features, poseAngle, poseAngleUncertainty,
+// faceImageType, sourceType, deviceVendor, deviceType,
+// qualityBlock, imageData, imageWidth, imageHeight,
+// imageDataType, spatialSamplingRateLevel,
+// postAcquisitionProcessing, crossReference,
+// imageColourSpace, landmarkPoints
+// );
+//
+
+ byte [] isoData = FaceEncoder.convertFaceImageToISO(convertRequestDto);
+
+ if (isoData != null && outFile != null)
+ {
+ Files.write(isoData,new File(outFile));
+
+ }
+ return isoData;
+ }
+
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClient.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClient.java
new file mode 100644
index 0000000000..a48835574f
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClient.java
@@ -0,0 +1,296 @@
+package io.mosip.testrig.apirig.dataprovider.mds;
+
+import static io.restassured.RestAssured.given;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.mosip.testrig.apirig.dataprovider.models.IrisDataModel;
+import io.mosip.testrig.apirig.dataprovider.models.JWTTokenModel;
+import io.mosip.testrig.apirig.dataprovider.models.ResidentModel;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDevice;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDeviceCaptureModel;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSRCaptureModel;
+import io.mosip.testrig.apirig.dataprovider.util.CommonUtil;
+import io.mosip.testrig.apirig.dataprovider.util.DataProviderConstants;
+import io.mosip.testrig.apirig.utils.RestClient;
+import io.restassured.http.ContentType;
+import io.restassured.response.Response;
+
+public class MDSClient implements MDSClientInterface {
+
+ private static final Logger logger = LoggerFactory.getLogger(MDSClient.class);
+ public int port;
+ public static String MDSURL = "http://127.0.0.1:";
+
+ public MDSClient(int port) {
+ if (port == 0)
+ this.port = 4501;
+ else
+ this.port = port;
+ }
+
+ public void setProfile(String profile, int port, String contextKey) {
+
+ String url = MDSURL + port + "/admin/profile";
+ JSONObject body = new JSONObject();
+ body.put("profileId", profile);
+ body.put("type", "Biometric Device");
+
+ try {
+ logger.info("Inside Setprofile");
+// HttpRCapture capture = new HttpRCapture(url);
+// capture.setMethod("POST");
+// String response = RestClient.rawHttp(capture, body.toString());
+ Response response = RestClient.post(url, body.toString());
+// JSONObject respObject = new JSONObject(response.as);
+
+ } catch (Exception ex) {
+ logger.error(ex.getMessage());
+ }
+
+ }
+
+ // Type ->"Finger", "Iris", "Face"
+ public List getRegDeviceInfo(String type) {
+
+ List devices = null;
+
+ String url = MDSURL + port;
+ JSONObject body = new JSONObject();
+ body.put("type", type);
+ Response response = given().contentType(ContentType.JSON).body(body.toString()).post(url);
+ if (response.getStatusCode() == 200) {
+ String resp = response.getBody().asString();
+
+ if (resp != null) {
+ JSONArray deviceArray = new JSONArray(resp);
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ try {
+ devices = objectMapper.readValue(deviceArray.toString(),
+ objectMapper.getTypeFactory().constructCollectionType(List.class, MDSDevice.class));
+
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ }
+ }
+ }
+ return devices;
+ }
+
+ // capture = mds.captureFromRegDevice(exceptionDevice, capture,
+ // DataProviderConstants.MDS_DEVICE_TYPE_EXCEPTION_PHOTO,
+ // null, 60, exceptionDevice.getDeviceSubId().get(0),
+ // port,contextKey,bioexceptionlist);
+
+ public MDSRCaptureModel captureFromRegDevice(MDSDevice device, MDSRCaptureModel rCaptureModel, String type,
+ String bioSubType, int reqScore, String deviceSubId, int port, String contextKey,
+ List listbioexception) {
+ String mosipVersion = null;
+ try {
+ mosipVersion = "1.2.1-SNAPSHOT";
+ } catch (Exception e) {
+
+ }
+
+ if (rCaptureModel == null)
+ rCaptureModel = new MDSRCaptureModel();
+
+ String url = MDSURL + port + "/capture";
+ JSONObject jsonReq = new JSONObject();
+ jsonReq.put("env", "Developer");
+ jsonReq.put("purpose", "Registration");
+ jsonReq.put("specVersion", "0.9.5");
+ jsonReq.put("timeout", "120000");
+ jsonReq.put("captureTime", CommonUtil.getUTCDateTime(null));
+ jsonReq.put("domainUri", "automated");
+ jsonReq.put("transactionId", "123456789123");
+ JSONObject bio = new JSONObject();
+ bio.put("type", type);
+
+ bio.put("count", 1);
+ bio.put("deviceSubId", deviceSubId);
+
+ if (type.equalsIgnoreCase("finger")) {
+
+ switch (deviceSubId) {
+ case "1":
+ bio.put("count", 4);
+
+ break;
+ case "2":
+ bio.put("count", 4);
+
+ break;
+ case "3":
+ bio.put("count", 2);
+ break;
+ }
+
+ }
+
+ bio.put("requestedScore", reqScore);
+ // bio.put("deviceId", Integer.valueOf(device.getDeviceId()));
+ bio.put("deviceId", device.getDeviceId());
+ if (listbioexception != null && !listbioexception.isEmpty())
+ bio.put("exception", listbioexception);
+
+ JSONArray arr = new JSONArray();
+ arr.put(bio);
+ jsonReq.put("bio", arr);
+ /*
+ * Response response = given() .contentType(ContentType.JSON)
+ * .body(jsonReq.toString()) .post(url );
+ */
+ try {
+ HttpRCapture capture = new HttpRCapture(url);
+ capture.setMethod("RCAPTURE");
+
+// String method = "RCAPTURE"; // Custom method name
+// String response = RestClient.rawHttp(url, jsonReq.toString(), method);
+
+ String response = RestClient.rawHttp(capture, jsonReq.toString());
+
+ JSONObject respObject = new JSONObject(response);
+ JSONArray bioArray = respObject.getJSONArray("biometrics");
+ List lstBiometrics = rCaptureModel.getLstBiometrics().get(type);
+ if (lstBiometrics == null)
+ lstBiometrics = new ArrayList();
+
+ if (!CollectionUtils.isEmpty(listbioexception) && type.equalsIgnoreCase("face"))
+ rCaptureModel.getLstBiometrics().put("exception", lstBiometrics);
+ else
+ rCaptureModel.getLstBiometrics().put(type, lstBiometrics);
+
+ List retriableErrorCodes = new ArrayList();
+ retriableErrorCodes.add("703");
+ retriableErrorCodes.add("710");
+
+ // Check if Rcapture returns an error response if on error, retry based on Error
+ // ;code.
+ while (bioArray.length() == 1 && retriableErrorCodes
+ .contains(bioArray.getJSONObject(0).getJSONObject("error").getString("errorCode"))) {
+ logger.info("Check if Rcapture returns an error response if on error, retry based on Error ;code. ");
+
+// method = "RCAPTURE"; // Custom method name
+// response = RestClient.rawHttp(url, jsonReq.toString(), method);
+
+ response = RestClient.rawHttp(capture, jsonReq.toString());
+
+ respObject = new JSONObject(response);
+ bioArray = respObject.getJSONArray("biometrics");
+ }
+
+ for (int i = 0; i < bioArray.length(); i++) {
+ JSONObject bioObject = bioArray.getJSONObject(i);
+ String data = bioObject.getString("data");
+
+ String hash = bioObject.getString("hash");
+ JWTTokenModel jwtTok = new JWTTokenModel(data);
+ JSONObject jsonPayload = new JSONObject(jwtTok.getJwtPayload());
+ String jwtSign = jwtTok.getJwtSign();
+ MDSDeviceCaptureModel model = new MDSDeviceCaptureModel();
+ model.setBioType(CommonUtil.getJSONObjectAttribute(jsonPayload, "bioType", ""));
+ model.setBioSubType(CommonUtil.getJSONObjectAttribute(jsonPayload, "bioSubType", ""));
+ model.setQualityScore(CommonUtil.getJSONObjectAttribute(jsonPayload, "qualityScore", ""));
+ model.setBioValue(CommonUtil.getJSONObjectAttribute(jsonPayload, "bioValue", ""));
+ model.setDeviceServiceVersion(
+ CommonUtil.getJSONObjectAttribute(jsonPayload, "deviceServiceVersion", ""));
+ model.setDeviceCode(CommonUtil.getJSONObjectAttribute(jsonPayload, "deviceCode", ""));
+ model.setHash(hash);
+ if (mosipVersion != null && mosipVersion.startsWith("1.2")) {
+ model.setSb(jwtSign); // SB is signature block (header..signature)
+ // String temp=jwtTok.getJwtPayload().replace(model.getBioValue(),);
+
+ String BIOVALUE_KEY = "bioValue";
+ String BIOVALUE_PLACEHOLDER = "\"\"";
+ int bioValueKeyIndex = jwtTok.getJwtPayload().indexOf(BIOVALUE_KEY) + (BIOVALUE_KEY.length() + 1);
+ int bioValueStartIndex = jwtTok.getJwtPayload().indexOf('"', bioValueKeyIndex);
+ int bioValueEndIndex = jwtTok.getJwtPayload().indexOf('"', (bioValueStartIndex + 1));
+ String bioValue = jwtTok.getJwtPayload().substring(bioValueStartIndex, (bioValueEndIndex + 1));
+ String payload = jwtTok.getJwtPayload().replace(bioValue, BIOVALUE_PLACEHOLDER);
+ model.setPayload(payload);
+ }
+ lstBiometrics.add(model);
+
+ }
+
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ return rCaptureModel;
+ }
+
+ public void setThresholdValue(String qualityScore) {
+
+ String url = MDSURL + port + "/admin/score";
+ JSONObject body = new JSONObject();
+ body.put("type", "Biometric Device");
+ body.put("qualityScore", qualityScore);
+ body.put("fromIso", false);
+
+ try {
+ /*
+ * HttpRCapture capture = new HttpRCapture(url);
+ * capture.setMethod("SETTHRESHOLVALUE"); String response =
+ * RestClient.rawHttp(capture, body.toString()); JSONObject respObject = new
+ * JSONObject(response);
+ */
+
+ Response response = given().contentType(ContentType.JSON).body(body.toString()).post(url);
+ String resp = response.getBody().asString();
+ logger.info(resp);
+
+ } catch (Exception ex) {
+ logger.error(ex.getMessage());
+ }
+
+ }
+
+ public static void main(String[] args) {
+
+ MDSClient client = new MDSClient(0);
+ // client.setProfile("res643726437264372");
+ // client.setProfile("Default",port);
+ List d = client.getRegDeviceInfo("Iris");
+ d.forEach(dv -> {
+ logger.info(dv.toJSONString());
+ });
+
+ List f = client.getRegDeviceInfo("Finger");
+
+ f.forEach(dv -> {
+ logger.info(dv.toJSONString());
+
+ // MDSRCaptureModel r = client.captureFromRegDevice(dv, null,
+ // "Finger",null,60,"1",0);
+ // MDSRCaptureModel r = client.captureFromRegDevice(d.get(0),null,
+ // "Iris",null,60,2);
+
+ });
+
+ // r = client.captureFromRegDevice(d.get(0),r, "Face",null,60,1);
+
+ }
+
+ @Override
+ public List getRegDeviceInfo(String type, String contextKey) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClientInterface.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClientInterface.java
new file mode 100644
index 0000000000..14b31496b5
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/mds/MDSClientInterface.java
@@ -0,0 +1,20 @@
+package io.mosip.testrig.apirig.dataprovider.mds;
+
+import java.util.List;
+
+import io.mosip.testrig.apirig.dataprovider.models.ResidentModel;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDevice;
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSRCaptureModel;
+
+public interface MDSClientInterface {
+ public void setProfile(String profile,int port,String contextKey) ;
+ //Type ->"Finger", "Iris", "Face"
+ public List getRegDeviceInfo(String type) ;
+ public MDSRCaptureModel captureFromRegDevice(MDSDevice device,
+ MDSRCaptureModel rCaptureModel,
+ String type,
+ String bioSubType, int reqScore,String deviceSubId,int port,String contextKey,List exceptionlist) ;
+
+ List getRegDeviceInfo(String type, String contextKey);
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BioModality.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BioModality.java
new file mode 100644
index 0000000000..51637c23bb
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BioModality.java
@@ -0,0 +1,10 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import lombok.Data;
+@Data
+public class BioModality {
+ String type;
+ String subType;
+ String reason;
+ String exceptionType;
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BiometricDataModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BiometricDataModel.java
new file mode 100644
index 0000000000..7750bd0c00
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/BiometricDataModel.java
@@ -0,0 +1,27 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import java.io.Serializable;
+import java.util.Hashtable;
+import java.util.List;
+
+import io.mosip.testrig.apirig.dataprovider.models.mds.MDSDeviceCaptureModel;
+import lombok.Data;
+
+@Data
+public class BiometricDataModel implements Serializable {
+ private static final long serialVersionUID = 1L;
+ //Indexed by Finger value
+ private String [] fingerPrint;
+ private String [] fingerHash;
+ private byte[][] fingerRaw;
+
+ //left, right
+ private IrisDataModel iris;
+ private String encodedPhoto;
+ private String FaceHash;
+ private byte[] rawFaceData;
+
+ private Hashtable> capture;
+
+ private String cbeff;
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/IrisDataModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/IrisDataModel.java
new file mode 100644
index 0000000000..2d5be4ab83
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/IrisDataModel.java
@@ -0,0 +1,37 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+@Data
+public class IrisDataModel implements Serializable{
+ private static final Logger logger = LoggerFactory.getLogger(IrisDataModel.class);
+ private static final long serialVersionUID = 1L;
+ String left;
+ String right;
+ String leftHash;
+ String rightHash;
+ byte[] rawLeft;
+ byte[] rawRight;
+
+ public String toJSONString() {
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.getFactory().configure(JsonWriteFeature.ESCAPE_NON_ASCII.mappedFeature(), true);
+
+ String jsonStr ="";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/JWTTokenModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/JWTTokenModel.java
new file mode 100644
index 0000000000..910ba88f23
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/JWTTokenModel.java
@@ -0,0 +1,52 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.Data;
+@Data
+public class JWTTokenModel {
+ private static final Logger logger = LoggerFactory.getLogger(JWTTokenModel.class);
+ //Map jsonHeader; // = new HashMap();
+ String jwtPayload;
+ String jwtSign;
+ JSONObject jwtHeader;
+ public static final String BIOMETRIC_SEPERATOR = "(?<=\\.)(.*)(?=\\.)";
+
+ public JWTTokenModel(String jwtToken) {
+ logger.info(jwtToken);
+ java.util.Base64.Decoder decoder = java.util.Base64.getUrlDecoder();
+ String[] parts = jwtToken.split("\\."); // split out the "parts" (header, payload and signature)
+
+ String headerJson = new String(decoder.decode(parts[0]));
+ jwtPayload= new String(decoder.decode(parts[1]));
+
+ // jwtPayload = new JSONObject(payloadJson);
+ String signatureJson = new String(decoder.decode(parts[2]));
+ jwtHeader = new JSONObject(headerJson);
+ //jwtSign = signatureJson;
+
+ Pattern pattern = Pattern.compile(BIOMETRIC_SEPERATOR);
+ Matcher matcher = pattern.matcher(jwtToken);
+ if(matcher.find()) {
+ //returns header..signature
+ jwtSign= jwtToken.replace(matcher.group(1),"");
+ }
+ //JWTTokenHeader(headerJson);
+ }
+
+
+ @Override
+ public String toString() {
+ return org.apache.commons.lang3.builder.ToStringBuilder.reflectionToString(this);
+ }
+
+ public static void main(String[] args) {
+ String jwtToken = "";
+ JWTTokenModel model = new JWTTokenModel(jwtToken);
+ logger.info(model.toString());
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricAttributeModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricAttributeModel.java
new file mode 100644
index 0000000000..8e560f59ce
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricAttributeModel.java
@@ -0,0 +1,36 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+@Data
+public class MosipBiometricAttributeModel implements Serializable{
+ private static final Logger logger = LoggerFactory.getLogger(MosipBiometricAttributeModel.class);
+
+ private static final long serialVersionUID = 1L;
+ private String biometricTypeCode;
+
+ private String code;
+ private String description;
+ private Boolean isActive;
+ private String langCode;
+ private String name;
+
+ public String toJSONString() {
+
+ ObjectMapper Obj = new ObjectMapper();
+ String jsonStr ="";
+ try {
+ jsonStr = Obj.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricTypeModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricTypeModel.java
new file mode 100644
index 0000000000..c794ee017d
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/MosipBiometricTypeModel.java
@@ -0,0 +1,34 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+@Data
+public class MosipBiometricTypeModel implements Serializable {
+ private static final Logger logger = LoggerFactory.getLogger(MosipBiometricTypeModel.class);
+
+ private static final long serialVersionUID = 1L;
+ private String code;
+ private String description;
+ private Boolean isActive;
+ private String langCode;
+ private String name;
+
+ public String toJSONString() {
+
+ ObjectMapper Obj = new ObjectMapper();
+ String jsonStr ="";
+ try {
+ jsonStr = Obj.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/ResidentModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/ResidentModel.java
new file mode 100644
index 0000000000..b43027a5bb
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/ResidentModel.java
@@ -0,0 +1,55 @@
+package io.mosip.testrig.apirig.dataprovider.models;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.Data;
+
+@Data
+public class ResidentModel implements Serializable {
+ private static final Logger logger = LoggerFactory.getLogger(ResidentModel.class);
+ private static final long serialVersionUID = 1L;
+ private BiometricDataModel biometric;
+
+
+ private List missAttributes;
+ private List invalidAttributes;
+ private List filteredBioAttribtures;
+ private List bioExceptions;
+
+ private String path;
+ private Hashtable docIndexes;
+ private Hashtable addtionalAttributes;
+
+ private Boolean skipFinger;
+ private Boolean skipFace;
+ private Boolean skipIris;
+
+ public ResidentModel() {
+
+ }
+
+ public String toJSONString() {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String jsonStr ="";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDataModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDataModel.java
new file mode 100644
index 0000000000..d644d56755
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDataModel.java
@@ -0,0 +1,19 @@
+package io.mosip.testrig.apirig.dataprovider.models.mds;
+
+import lombok.Data;
+
+@Data
+public class MDSDataModel {
+
+ byte[] faceISO;
+ byte[] irisLeftISO;
+ byte[] irisRightISO;
+ byte[][] fingersISO;
+
+ public MDSDataModel() {
+ faceISO = null;
+ irisLeftISO = null;
+ irisRightISO = null;
+ fingersISO = new byte[10][];
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDevice.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDevice.java
new file mode 100644
index 0000000000..6bff74bccb
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDevice.java
@@ -0,0 +1,44 @@
+package io.mosip.testrig.apirig.dataprovider.models.mds;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+
+@Data
+@JsonIgnoreProperties({"error"})
+public class MDSDevice {
+ private static final Logger logger = LoggerFactory.getLogger(MDSDevice.class);
+
+ String purpose;
+ List deviceSubId;
+ String digitalId;
+ String deviceStatus;
+ String deviceId;
+ String deviceCode;
+ String certification;
+ String serviceVersion;
+ List specVersion;
+ String callbackId;
+
+
+ public String toJSONString() {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String jsonStr ="";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDeviceCaptureModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDeviceCaptureModel.java
new file mode 100644
index 0000000000..500e1432fa
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSDeviceCaptureModel.java
@@ -0,0 +1,39 @@
+package io.mosip.testrig.apirig.dataprovider.models.mds;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+
+@Data
+public class MDSDeviceCaptureModel {
+
+ private static final Logger logger = LoggerFactory.getLogger(MDSDeviceCaptureModel.class);
+
+ String bioType;
+ String bioSubType;
+ String qualityScore;
+ String bioValue;
+ String deviceServiceVersion;
+ String deviceCode;
+ String hash;
+ String sb;
+ String payload;
+
+ public String toJSONString() {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String jsonStr ="";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSRCaptureModel.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSRCaptureModel.java
new file mode 100644
index 0000000000..73b7a5823d
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/models/mds/MDSRCaptureModel.java
@@ -0,0 +1,37 @@
+package io.mosip.testrig.apirig.dataprovider.models.mds;
+
+import java.util.Hashtable;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.Data;
+
+@Data
+public class MDSRCaptureModel {
+
+ private static final Logger logger = LoggerFactory.getLogger(MDSRCaptureModel.class);
+
+ Hashtable> lstBiometrics;
+
+ public MDSRCaptureModel() {
+ lstBiometrics = new Hashtable>();
+ }
+ public String toJSONString() {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String jsonStr ="";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ logger.error(e.getMessage());
+ }
+ return jsonStr;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/CommonUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/CommonUtil.java
new file mode 100644
index 0000000000..8d4665bdf0
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/CommonUtil.java
@@ -0,0 +1,303 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.mifmif.common.regex.Generex;
+import java.io.*;
+
+public class CommonUtil {
+ private static final Logger logger = LoggerFactory.getLogger(CommonUtil.class);
+ private static SecureRandom rand = new SecureRandom();
+
+ private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
+
+ public static boolean isExists(List missList, String categoryCode) {
+ if (missList != null) {
+ for (String s : missList) {
+ if (s.equals(categoryCode))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static String getJSONObjectAttribute(JSONObject obj, String attrName, String defValue) {
+ if (obj.has(attrName))
+ return obj.getString(attrName);
+ return defValue;
+ }
+
+ public static String getHexEncodedHash(byte[] data) throws Exception {
+ try {
+ MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
+ messageDigest.update(data);
+ return DatatypeConverter.printHexBinary(messageDigest.digest()).toUpperCase();
+ } catch (Exception ex) {
+ throw new Exception("Invalid getHexEncodedHash " + ex.getMessage());
+ }
+ }
+
+ public static String toCaptialize(String text) {
+ return text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
+ }
+
+ // generate count no of random numbers in range 0 - (max-1)
+ public static int[] generateRandomNumbers(int count, int max, int min) {
+ int[] rand_nums = new int[count];
+
+ for (int i = 0; i < count; i++) {
+ rand_nums[i] = rand.nextInt((max - min) + 1) + min;
+ }
+
+ return rand_nums;
+ }
+
+ public static String getUTCDateTime(LocalDateTime time) {
+ String DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(DATEFORMAT);
+ if (time == null) {
+ time = LocalDateTime.now(TimeZone.getTimeZone("UTC").toZoneId());
+ }
+ String utcTime = time.format(dateFormat);
+ return utcTime;
+ }
+
+ public static String genStringAsperRegex(String regex) throws Exception {
+ if (Generex.isValidPattern(regex)) {
+
+ Generex generex = new Generex(regex);
+
+ String randomStr = generex.random();
+ logger.info(randomStr);
+ // Generate all String that matches the given Regex.
+ boolean bFound = false;
+ do {
+ bFound = false;
+ if (randomStr.startsWith("^")) {
+ int idx = randomStr.indexOf("^");
+ randomStr = randomStr.substring(idx + 1);
+ bFound = true;
+ }
+ if (randomStr.endsWith("$")) {
+ int idx = randomStr.indexOf("$");
+ randomStr = randomStr.substring(0, idx);
+ bFound = true;
+ }
+ } while (bFound);
+ return randomStr;
+ }
+ throw new Exception("invalid regex");
+
+ }
+
+ public static String readFromJSONFile(String filePath) {
+
+ StringBuilder builder = new StringBuilder();
+ try (FileReader reader = new FileReader(filePath);) {
+
+ char[] cbuf = new char[1024];
+ int n = 0;
+ while ((n = reader.read(cbuf)) > 0) {
+ builder.append(new String(cbuf, 0, n));
+ }
+ reader.close();
+ } catch (IOException e) {
+ }
+
+ return builder.toString();
+
+ }
+
+ public static void CopyRecursivly(Path sourceDirectory, Path targetDirectory) throws IOException {
+
+ // Traverse the file tree and copy each file/directory.
+ Files.walk(sourceDirectory).forEach(sourcePath -> {
+
+ Path targetPath = targetDirectory.resolve(sourceDirectory.relativize(sourcePath));
+
+ try {
+ Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ }
+
+ });
+ }
+
+ public static String generateRandomString(int len) {
+ StringBuilder builder = new StringBuilder();
+ String alphabet = "abcdefghijklmn opqrstuvwxyz_123456789";
+
+ if (len == 0)
+ len = 20;
+
+ for (int i = 0; i < len; i++) {
+ builder.append(alphabet.charAt(rand.nextInt(alphabet.length())));
+ }
+ return builder.toString();
+ }
+
+ public static List listFiles(String dirPath) {
+
+ List lstFiles = new ArrayList();
+
+ File dir = new File(dirPath);
+ File[] files = dir.listFiles();
+ for (File f : files)
+ lstFiles.add(f);
+
+ return lstFiles;
+
+ }
+
+ public static String getSHAFromBytes(byte[] byteArray) throws NoSuchAlgorithmException {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ return bytesToHex(md.digest(byteArray));
+ }
+
+ private static String bytesToHex(byte[] hash) {
+ StringBuffer hexString = new StringBuffer();
+ for (int i = 0; i < hash.length; i++) {
+ String hex = Integer.toHexString(0xff & hash[i]);
+ if (hex.length() == 1) {
+ hexString.append('0');
+ }
+ hexString.append(hex);
+ }
+ return hexString.toString();
+ }
+
+ public static String getSHA(String cbeffStr) throws NoSuchAlgorithmException {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ return bytesToHex(md.digest(cbeffStr.getBytes(StandardCharsets.UTF_8)));
+ }
+
+
+ public static void saveToTemp(String data, String fileName) {
+ try {
+ CommonUtil.write(Paths.get("/temp/" + fileName), data.getBytes());
+ } catch (IOException e) {
+ }
+ }
+
+ public static Properties String2Props(String str) {
+ Properties props = new Properties();
+ String[] parts = str.split(",");
+ for (String p : parts) {
+ String[] v = p.split("=");
+ if (v.length > 0) {
+ props.put(v[0].trim(), v[1].trim());
+ }
+ }
+ return props;
+ }
+
+ public static void copyFileWithBuffer(Path source, Path destination) {
+ try (BufferedInputStream in = new BufferedInputStream(Files.newInputStream(source));
+ BufferedOutputStream out = new BufferedOutputStream(Files.newOutputStream(destination))) {
+ byte[] buffer = new byte[8192]; // Adjust buffer size as needed
+ int bytesRead;
+ while ((bytesRead = in.read(buffer)) != -1) {
+ out.write(buffer, 0, bytesRead);
+ }
+ // Flush the buffered output stream
+ out.flush();
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+ }
+
+ public static void copyMultipartFileWithBuffer(MultipartFile sourceFile, Path destination) {
+ try (InputStream inputStream = sourceFile.getInputStream();
+ BufferedOutputStream outputStream = new BufferedOutputStream(Files.newOutputStream(destination))) {
+ // Define buffer size
+ byte[] buffer = new byte[8192];
+ int bytesRead;
+ // Read from the input stream and write to the output stream with buffering
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ // Flush the buffered output stream
+ outputStream.flush();
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ }
+ }
+
+
+ public static void write(Path filePath, byte[] bytes) throws IOException {
+ Files.write(filePath, bytes);
+
+// ObjectMapper mapper = new ObjectMapper();
+// try (OutputStream outputStream = new FileOutputStream(filePath.toString())) {
+// mapper.writeValue(outputStream, bytes);
+// }
+ }
+
+
+ public static void write( byte[] bytes,File file) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ try (OutputStream outputStream = new FileOutputStream(file)) {
+ mapper.writeValue(outputStream, bytes);
+ }
+ }
+
+ public static byte[] read(String path)
+ {
+ byte[] data = null;
+ try {
+ data = Files.readAllBytes(Paths.get(path));
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ logger.error(e.getMessage());
+ }
+
+ return data;
+ }
+
+
+ public static void main(String[] args) throws Exception {
+ String regex1 = "^|^0[5-7][0-9]{8}$";
+ String regex2 = "^[a-zA-Zء-ي٠-٩ ]{5,47}$";
+ String regex3 = "(^|^[A-Z]{2}[0-9]{1,6}$)|(^[A-Z]{1}[0-9]{1,7}$)";
+ String regex4 = "^|^(?=.{0,10}$).*";
+
+ String regex5 = "^(1869|18[7-9][0-9]|19[0-9][0-9]|20[0-9][0-9])/([0][1-9]|1[0-2])/([0][1-9]|[1-2][0-9]|3[01])$";
+
+ String rex = regex5;
+ String values = genStringAsperRegex(rex);
+ Pattern p = Pattern.compile(rex);// . represents single character
+ Matcher m = p.matcher(values);
+ boolean b = m.matches();
+
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DPConstants.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DPConstants.java
new file mode 100644
index 0000000000..4d1dcd175c
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DPConstants.java
@@ -0,0 +1,20 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public class DPConstants {
+
+ public static String IRIS="iris";
+ public static String GENDER="gender";
+ public static String AGE="age";
+ public static String FINGER="finger";
+ public static String FACE="face";
+ public static String DOC="doc";
+ public static String DOB="dob";
+ public static String SCHEMAID="schemaid";
+ public static String MARITALSTATUS="maritalstatus";
+ public static String DYNAFIELD="dynafield";
+ public static String NAME="name";
+ public static String LOCATION="location";
+ public static String PHONE="phone";
+ public static String EMAIL="email";
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataCallback.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataCallback.java
new file mode 100644
index 0000000000..e5a7d92f8e
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataCallback.java
@@ -0,0 +1,7 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public interface DataCallback {
+ public void logDebug(String msg);
+ public void logError(String msg);
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataProviderConstants.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataProviderConstants.java
new file mode 100644
index 0000000000..9a268464d9
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/DataProviderConstants.java
@@ -0,0 +1,139 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import io.mosip.testrig.apirig.dataprovider.models.BioModality;
+
+public class DataProviderConstants {
+
+ public static final int DEFAULT_ABIS_DELAY = 3;
+ public static final Object INDIVIDUAL_TYPE = "residenceStatus";
+ /*
+ * public static int Age_Adult_Min_Age = 18;
+ *
+ * public static int Age_Minor_Min_Age = 6; public static int
+ * Age_Senior_Citizen_Min_Age = 60;
+ */
+
+ //contacts formatting firstname.surname.{randomnumber}@mailinator.com
+ public static String email_format = "%s.%s.%d@mailinator.com";
+ //mob number - excluding contry code
+ public static int mobNumber_prefix[] = {9,8,7,6};
+ public static int mobNumber_maxlen = 10;
+
+ public static int MAX_PHOTOS = 10;
+ public static String RESOURCE="src/main/resource/";
+ public static String COUNTRY_CODE ="IN";
+ public static String DOC_TEMPLATE_PATH= "documents/templates/";
+ public static String LANG_CODE_ENGLISH = "eng";
+ public static String ANGULI_PATH ="C:\\Mosip.io\\gitrepos\\biometric-data\\anguli" ;
+
+ //ensure these two are in same order
+ public static String [] schemaNames = {
+ "leftThumb",
+ "leftIndex",
+ "leftMiddle",
+ "leftRing",
+ "leftLittle",
+ "rightThumb",
+ "rightIndex",
+ "rightMiddle",
+ "rightRing",
+ "rightLittle",
+ "leftEye",
+ "rightEye",
+ "face"
+ };
+
+ public static String [] displayFullName = {
+ "Left Thumb",
+ "Left IndexFinger",
+ "Left MiddleFinger",
+ "Left RingFinger",
+ "Left LittleFinger",
+ "Right Thumb",
+ "Right IndexFinger",
+ "Right MiddleFinger",
+ "Right RingFinger",
+ "Right LittleFinger",
+ "Left",
+ "Right",
+ "Face"
+ };
+
+ public static String [] schemaFingerNames = {
+ "leftThumb",
+ "leftIndex",
+ "leftMiddle",
+ "leftRing",
+ "leftLittle",
+ "rightThumb",
+ "rightIndex",
+ "rightMiddle",
+ "rightRing",
+ "rightLittle"
+
+ };
+ public static String [] MDSProfileFingerNames = {
+ "Left_Thumb",
+ "Left_Index",
+ "Left_Middle",
+ "Left_Ring",
+ "Left_Little",
+ "Right_Thumb",
+ "Right_Index",
+ "Right_Middle",
+ "Right_Ring",
+ "Right_Little"
+
+ };
+ public static String [] displayFingerName = {
+ "Left Thumb",
+ "Left IndexFinger",
+ "Left MiddleFinger",
+ "Left RingFinger",
+ "Left LittleFinger",
+ "Right Thumb",
+ "Right IndexFinger",
+ "Right MiddleFinger",
+ "Right RingFinger",
+ "Right LittleFinger"
+ };
+ //MDS Device types
+ public static String MDS_DEVICE_TYPE_FINGER="Finger";
+ public static String MDS_DEVICE_TYPE_IRIS="Iris";
+ public static String MDS_DEVICE_TYPE_FACE="Face";
+ public static String MDS_DEVICE_TYPE_EXCEPTION_PHOTO="ExceptionPhoto";
+ public static int MAX_ADDRESS_LINES = 5;
+
+ public static String getschemaName(String name)
+ {
+ // First check if it falls in all modaities
+ for(int i=0; i < 13; i++) {
+ String displayFingerName = DataProviderConstants.displayFullName[i];
+ if (displayFingerName.equalsIgnoreCase(name) == true)
+ return DataProviderConstants.schemaNames[i];
+ }
+
+ // Other wise just return
+ return name;
+ }
+
+ public static List getListWithoutExceptions(List exceptionlst,List bioFilter)
+ {
+ List listWithoutExceptions =bioFilter;
+
+ if(exceptionlst!=null && !exceptionlst.isEmpty()) {
+ List exceptions = exceptionlst.stream().map(BioModality::getSubType).collect(Collectors.toList());
+ List schemaName=new ArrayList();
+ for(String ex: exceptions)
+ {
+ schemaName.add(getschemaName(ex));
+ }
+ listWithoutExceptions= bioFilter.stream().filter(bioAttribute -> !schemaName.contains(bioAttribute)).collect(Collectors.toList());
+ }
+ return listWithoutExceptions;
+ }
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/FPClassDistribution.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/FPClassDistribution.java
new file mode 100644
index 0000000000..d67845b2fe
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/FPClassDistribution.java
@@ -0,0 +1,11 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public enum FPClassDistribution {
+
+ arch, // : Arch Only
+ tarch, // : Tented Arch Only
+ right, // : Right Only
+ left, // : Left Only
+ dloop, // : Double Loop Only
+ whirl // : Whirl Only
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Finger.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Finger.java
new file mode 100644
index 0000000000..0e7c14acfc
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Finger.java
@@ -0,0 +1,15 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public enum Finger {
+ LeftThumb,
+ LeftFore,
+ LeftMiddle,
+ LeftRing,
+ LeftLittle,
+ RightThumb,
+ RightFore,
+ RightMiddle,
+ RightRing,
+ RightLittle
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Gender.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Gender.java
new file mode 100644
index 0000000000..e529416a43
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/Gender.java
@@ -0,0 +1,8 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public enum Gender {
+ Male ,
+ Female,
+ Others,
+ Any
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ReadEmail.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ReadEmail.java
new file mode 100644
index 0000000000..323ccac8a9
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ReadEmail.java
@@ -0,0 +1,147 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.mail.BodyPart;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.internet.MimeMultipart;
+
+import org.jsoup.Jsoup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ReadEmail {
+ private static final Logger logger = LoggerFactory.getLogger(ReadEmail.class);
+ public static String FROM_MATH ="info@mosip.io";
+ public static String FROM_MATH1 ="Alok Tiwari ";
+ public static String gmailPOPHost = "pop.gmail.com";
+ static String mailStoreType = "pop3";
+ static String username= "sanath.test.mosip@gmail.com";
+ static String password= "";//change accordingly
+ static String regexpattern = "\\d+";
+ public static String messageSubject="Requesting the additional details for progressing on the application of UIN";
+
+ public static List getOtps(){
+ List otps = new ArrayList();
+
+ List mails = receiveEmail(gmailPOPHost, mailStoreType, username, password);
+ for(String s: mails) {
+
+ Pattern pattern = Pattern.compile(regexpattern);
+ Matcher matcher = pattern.matcher(s);
+ if (matcher.find())
+ {
+ logger.info(matcher.group());
+ otps.add(matcher.group());
+ }
+ }
+ return otps;
+ }
+
+ public static List getadditionalInfoReqIds(){
+ List additionalInfoReqIds = new ArrayList();
+ gmailPOPHost = "pop.gmail.com";
+ mailStoreType = "pop3";
+ username= "alok1.test.mosip@gmail.com";
+ password= "";//change accordingly
+ String keyWord = "AdditionalInfoRequestId";
+
+ List mails = receiveEmail(gmailPOPHost, mailStoreType, username, password);
+ for (String s : mails) {
+ int position = s.indexOf(keyWord);
+ String additionalInfoReqId = s.substring(position).split(" ")[1];
+ logger.info(additionalInfoReqId);
+ additionalInfoReqIds.add(additionalInfoReqId);
+ }
+ return additionalInfoReqIds;
+ }
+
+ public static List receiveEmail(String pop3Host, String storeType,
+ String user, String password) {
+
+ List mailMessage = new ArrayList();
+ try {
+ // 1) get the session object
+ Properties properties = new Properties();
+ properties.put("mail.pop3.host", pop3Host);
+ properties.put("mail.pop3.port", "995");
+ properties.put("mail.pop3.starttls.enable", "true");
+ properties.put("mail.pop3.ssl.enable", "true");
+
+ Session emailSession = Session.getInstance(properties);
+
+
+
+ // 2) create the POP3 store object and connect with the pop server
+ Store emailStore = emailSession.getStore(storeType);
+ emailStore.connect(user, password);
+
+ // 3) create the folder object and open it
+ Folder emailFolder = emailStore.getFolder("INBOX");
+ emailFolder.open(Folder.READ_WRITE);
+
+ // 4) retrieve the messages from the folder in an array and print it
+ Message[] messages = emailFolder.getMessages();
+ for (int i = 0; i < messages.length; i++) {
+ Message message = messages[i];
+ if (!message.getSubject().toLowerCase().contains("uin"))
+ continue;
+ logger.info("---------------------------------");
+ logger.info("Email Number {}" , (i + 1));
+ logger.info("Subject: {}" , message.getSubject());
+ logger.info("From: {}" , message.getFrom()[0]);
+ MimeMultipart content = (MimeMultipart) message.getContent();
+ String bodyMsg = getTextFromMimeMultipart(content);
+
+ if (message.getFrom()[0].toString().toLowerCase().contains("mosip")) {
+ mailMessage.add(bodyMsg);
+ message.setFlag(Flags.Flag.DELETED, true);
+ }
+
+ // 5) close the store and folder objects
+ emailFolder.close(false);
+ emailStore.close();
+ }
+ } catch (MessagingException | IOException e) {
+ logger.error(e.getMessage());
+ }
+
+ return mailMessage;
+ }
+
+ public static void main(String[] args) {
+ getadditionalInfoReqIds();
+ List otps = getOtps();
+ for(String ss: otps) {
+ logger.info(ss);
+ }
+ }
+ private static String getTextFromMimeMultipart( MimeMultipart mimeMultipart) throws MessagingException, IOException{
+ String result = "";
+ int count = mimeMultipart.getCount();
+ for (int i = 0; i < count; i++) {
+ BodyPart bodyPart = mimeMultipart.getBodyPart(i);
+ if (bodyPart.isMimeType("text/plain")) {
+ result = result + "\n" + bodyPart.getContent();
+ break; // without break same text appears twice in my tests
+ } else if (bodyPart.isMimeType("text/html")) {
+ String html = (String) bodyPart.getContent();
+ result = result + "\n" + Jsoup.parse(html).text();
+ } else if (bodyPart.getContent() instanceof MimeMultipart){
+ result = result + getTextFromMimeMultipart((MimeMultipart)bodyPart.getContent());
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ResidentAttribute.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ResidentAttribute.java
new file mode 100644
index 0000000000..eae02eddd6
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/util/ResidentAttribute.java
@@ -0,0 +1,30 @@
+package io.mosip.testrig.apirig.dataprovider.util;
+
+public enum ResidentAttribute {
+ RA_Count ,
+ RA_PRIMARAY_LANG,
+ RA_SECONDARY_LANG,
+ RA_THIRD_LANG,
+ RA_FirstName,
+ RA_LastName,
+ RA_Country,
+ RA_State,
+ RA_City,
+ RA_Age,
+ RA_Infant,
+ RA_Minor,
+ RA_Adult,
+ RA_Senior,
+ RA_Gender,
+ RA_Phone,
+ RA_Photo, //If set to faase, dont generate Photo
+ RA_Iris, //If set to false, dont generate Iris
+ RA_Finger, //if set to false dont generate finger prints
+ RA_Document,
+ RA_FingersList, /* if RA_Finger is not set to false, use this list to generate only those finger prints (1111111111) */
+ RA_SKipGaurdian, //if Set to true, and if Minor , dont generate gaurdian data
+ RA_InvalidList,
+ RA_MissList,
+ RA_SCHEMA_VERSION
+}
+
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java
index 422a91f2ae..2c30e4cc30 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java
@@ -105,6 +105,7 @@
import com.opencsv.CSVWriter;
import io.mosip.kernel.core.util.HMACUtils2;
+import io.mosip.testrig.apirig.dataprovider.BiometricDataProvider;
import io.mosip.testrig.apirig.dbaccess.AuditDBManager;
import io.mosip.testrig.apirig.dto.OutputValidationDto;
import io.mosip.testrig.apirig.dto.TestCaseDTO;
@@ -3101,11 +3102,12 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
}
if (jsonString.contains("$BIOVALUE$")) {
- jsonString = replaceKeywordWithValue(jsonString, "$BIOVALUE$", propsBio.getProperty("BioValue"));
+ jsonString = replaceKeywordWithValue(jsonString, "$BIOVALUE$",
+ BiometricDataProvider.getFromBiometricMap("BioValue"));
}
if (jsonString.contains("$BIOVALUEWITHOUTFACE$")) {
jsonString = replaceKeywordWithValue(jsonString, "$BIOVALUEWITHOUTFACE$",
- propsBio.getProperty("BioValueWithoutFace"));
+ BiometricDataProvider.getFromBiometricMap("BioValueWithoutFace"));
}
if (jsonString.contains("$CLAIMSFROMCONFIG$"))
jsonString = replaceKeywordWithValue(jsonString, "$CLAIMSFROMCONFIG$", getValueFromConfigActuator());
@@ -4643,40 +4645,47 @@ public static String buildIdentityRequest(String identityRequest) {
if (identityRequest.contains(GlobalConstants.TRANSACTION_ID))
identityRequest = identityRequest.replace(GlobalConstants.TRANSACTION_ID, TRANSACTION_ID);
if (identityRequest.contains("$FACE$"))
- identityRequest = identityRequest.replace("$FACE$", propsBio.getProperty("FaceBioValue"));
+ identityRequest = identityRequest.replace("$FACE$",
+ BiometricDataProvider.getFromBiometricMap("FaceBioValue"));
if (identityRequest.contains("$RIGHTIRIS$"))
- identityRequest = identityRequest.replace("$RIGHTIRIS$", propsBio.getProperty("RightIrisBioValue"));
+ identityRequest = identityRequest.replace("$RIGHTIRIS$",
+ BiometricDataProvider.getFromBiometricMap("RightIrisBioValue"));
if (identityRequest.contains("$LEFTIRIS$"))
- identityRequest = identityRequest.replace("$LEFTIRIS$", propsBio.getProperty("LeftIrisBioValue"));
+ identityRequest = identityRequest.replace("$LEFTIRIS$",
+ BiometricDataProvider.getFromBiometricMap("LeftIrisBioValue"));
if (identityRequest.contains("$RIGHTTHUMB$"))
- identityRequest = identityRequest.replace("$RIGHTTHUMB$", propsBio.getProperty("RightThumbBioValue"));
+ identityRequest = identityRequest.replace("$RIGHTTHUMB$",
+ BiometricDataProvider.getFromBiometricMap("rightThumb"));
if (identityRequest.contains("$LEFTTHUMB$"))
- identityRequest = identityRequest.replace("$LEFTTHUMB$", propsBio.getProperty("LeftThumbBioValue"));
+ identityRequest = identityRequest.replace("$LEFTTHUMB$",
+ BiometricDataProvider.getFromBiometricMap("leftThumb"));
if (identityRequest.contains("$RIGHTLITTLEFINGER$"))
identityRequest = identityRequest.replace("$RIGHTLITTLEFINGER$",
- propsBio.getProperty("RightLittleFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("rightLittle"));
if (identityRequest.contains("$RIGHTMIDDLEFINGER$"))
- identityRequest = identityRequest.replace("$RIGHTMIDDLEFINGER$", propsBio.getProperty("RightMiddleFinger"));
+ identityRequest = identityRequest.replace("$RIGHTMIDDLEFINGER$",
+ BiometricDataProvider.getFromBiometricMap("rightMiddle"));
if (identityRequest.contains("$RIGHTRINGFINGER$"))
identityRequest = identityRequest.replace("$RIGHTRINGFINGER$",
- propsBio.getProperty("RightRingFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("rightRing"));
if (identityRequest.contains("$RIGHTINDEXFINGER$"))
identityRequest = identityRequest.replace("$RIGHTINDEXFINGER$",
- propsBio.getProperty("RightIndexFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("rightIndex"));
if (identityRequest.contains("$LEFTLITTLEFINGER$"))
identityRequest = identityRequest.replace("$LEFTLITTLEFINGER$",
- propsBio.getProperty("LeftLittleFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("leftLittle"));
if (identityRequest.contains("$LEFTINDEXFINGER$"))
identityRequest = identityRequest.replace("$LEFTINDEXFINGER$",
- propsBio.getProperty("LeftIndexFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("leftIndex"));
if (identityRequest.contains("$LEFTMIDDLEFINGER$"))
identityRequest = identityRequest.replace("$LEFTMIDDLEFINGER$",
- propsBio.getProperty("LeftMiddleFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("leftMiddle"));
if (identityRequest.contains("$LEFTRINGFINGER$"))
identityRequest = identityRequest.replace("$LEFTRINGFINGER$",
- propsBio.getProperty("LeftRingFingerBioValue"));
+ BiometricDataProvider.getFromBiometricMap("leftRing"));
if (identityRequest.contains("$FACEDRAFTVALUE$"))
- identityRequest = identityRequest.replace("$FACEDRAFTVALUE$", propsBio.getProperty("FACEDRAFTVALUE"));
+ identityRequest = identityRequest.replace("$FACEDRAFTVALUE$",
+ BiometricDataProvider.getFromBiometricMap("FACEDRAFTVALUE"));
return identityRequest;
}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeyMgrUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeyMgrUtil.java
index b925ff694d..5044082b41 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeyMgrUtil.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeyMgrUtil.java
@@ -485,7 +485,7 @@ public static String trimBeginEnd(String pKey) {
public X509Certificate getCertificate(String refId)
throws KeyStoreException, IOException, CertificateException {
- String keysDirPath = getKeysDirPath();
+ String keysDirPath = AdminTestUtil.getKeysDirPath();
String certFilePath = keysDirPath + '/' + "ida-partner.cer";
// String certFilePath = keysDirPath + '/' + "ida-" + "partner" + ".cer";
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/RestClient.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/RestClient.java
index 43f706f58c..97e3f0a3f5 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/RestClient.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/RestClient.java
@@ -3,14 +3,22 @@
import static io.restassured.RestAssured.given;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.ws.rs.core.MediaType;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
+import io.mosip.testrig.apirig.dataprovider.mds.HttpRCapture;
import io.mosip.testrig.apirig.testrunner.MosipTestRunner;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
@@ -68,6 +76,33 @@ public static Response postRequestWithAuthHeader(String url, Object body, String
return postResponse;
}
+
+ public static Response post(String url, String requestBody) throws Exception {
+ Response response = null;
+// if (ConfigManager.IsDebugEnabled())
+ response = RestAssured.given().log().all().baseUri(url).contentType(MediaType.APPLICATION_JSON).and()
+ .body(requestBody).when().post().then().log().all().extract().response();
+// else
+// response = RestAssured.given().baseUri(url).contentType(MediaType.APPLICATION_JSON).and().body(requestBody).when()
+// .post().then().extract().response();
+
+ return response;
+
+ }
+
+ public static String rawHttp(HttpRCapture httpRCapture, String jsonBody) throws IOException {
+
+ String result = "";
+ try (CloseableHttpClient httpClient = HttpClients.createDefault();) {
+ httpRCapture.setEntity(new StringEntity(jsonBody));
+ HttpResponse response = httpClient.execute(httpRCapture);
+ HttpEntity entity = response.getEntity();
+ if (entity != null) {
+ result = EntityUtils.toString(entity);
+ }
+ }
+ return result;
+ }
/**
* REST ASSURED POST request method