public class

SecIrisManager

extends Object
java.lang.Object
   ↳ com.sec.biometric.iris.SecIrisManager

This class is deprecated.
Deprecated since v1.1. No replacement

Class Overview

This class provides APIs for third party ISV apps to capture the iris using the IR camera on an integrated Samsung device. It also returns an encrypted PID block containing the iris data.

Note: This feature is only supported on Samsung devices with integrated IR camera.

Summary

Public Methods
byte[] getEncryptedHMAC()
This API returns the encrypted hmac.
byte[] getEncryptedPid(byte[] inputpiddata, int inputpidtype, int biotype, X509Certificate[] certChain)
This API returns encrypted PID xml/protobuf having biometric data.
byte[] getEncryptedSessionKey()
This API returns the encrypted session key.
static SecIrisManager getInstance()
gets the instance of iris manager.
void registerCallback(SecIrisCallback callback)
API to register for a callback to receive the iris capture events.
int startCapture(int numEyes)
API to start the iris capture.
int stopCapture()
API to stop or cancel the iris capture.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public byte[] getEncryptedHMAC ()

This API returns the encrypted hmac.

Returns
  • byte array of the encrypted hmac
Throws
LicenseRequiredException If caller does not have the required permissions.
DeviceTamperedException If device is rooted.
NeedsCaptureException In case the API is called without doing a prior successful capture.
Usage

A third party ISV app can use this API to get the encrypted hmac returned as byte array. The byte array should be base64 encoded to use in authenticate request.


 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
  byte[] encryptedhmac = mSecIris.getEncryptedHMAC();
  String encryptedencodedhmac = Base64.encodeToString(encryptedhmac, Base64.DEFAULT);
  String hmactag = "<Hmac>" + encryptedencodedhmac + "</Hmac>";
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }
 

public byte[] getEncryptedPid (byte[] inputpiddata, int inputpidtype, int biotype, X509Certificate[] certChain)

This API returns encrypted PID xml/protobuf having biometric data.

Parameters
inputpiddata PID formed by the application into which the biometric data has to be inserted.
inputpidtype type of the PID passed as input.It can be xml or protobuf. Please refer
  • SecIrisConstants.PIDTYPE_XML
  • SecIrisConstants.PIDTYPE_PROTOBUF
certChain certificate to be used for encryption( along with the intermediate certificate if it is not signed by a well-known root CA)
Returns
  • byte array of the encrypted pid.
Throws
LicenseRequiredException If caller does not have the required permissions.
DeviceTamperedException If device is rooted.
EncryptionException If there is a problem in doing the Encryption.
EngineException If there is an exception from the iris detection engine.
InvalidParamException If parameter like biotype is not in sync with parameter of startCapture API.
NeedsCaptureException In case the API is called without doing a prior successful capture.
NonTrustedCertificateException if the mCertChain is not a valid UIDAI CA certificate.
PIDParserException If not able to parse the inputpiddata.
Usage

A third party ISV app can use this API to get the encrypted PID having biometric data. Before calling this API it is mandatory to call the start capture API and it should have returned success. The certificate chain passed should be a proper trusted certificate otherwise chain of trust will fail. The PID passed as input can have optionally filled demographics, OTP or other biometric data like FMR, FIR. This API will take care of inserting the iris biometric data and return the complete encrypted PID. A sample input pid without any demographics or PIN/OTP is given below for XML and Protobuf. The return value will have to be base64 encoded for using in auth request as shown below.


 private byte[] getPIDXML() {
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZZ", Locale.US);
     sdf.setTimeZone(TimeZone.getTimeZone("UTC+5.30"));
     String timestamp = sdf.format(new Date());
       
     String pid = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
            + "<ns2:Pid xmlns:ns2=\"http://www.uidai.gov.in/authentication/uid-auth-request-data/1.0\" " +
            "ts=\""+ timestamp + "\">" + "<Bios>" + "</Bios>" + "</ns2:Pid>";
        
     byte[] piddata = pid.getBytes();
     return piddata;
 }
	
 private byte[] getPIDProtoBuf(){
	   in.gov.uidai.authserver.protobuf.Auth.Pid.Builder pidBuilder = Auth.Pid.newBuilder();

     Date date = new Date();
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZZ", Locale.US);
     sdf.setTimeZone(TimeZone.getTimeZone("UTC+5.30"));
     String timestamp = sdf.format(date);		
	   pidBuilder.setTs(timestamp);
	   pidBuilder.setVer("1.0");
			
	   in.gov.uidai.authserver.protobuf.Auth.Pid pid = pidBuilder.build();
     return pid.toByteArray();
 }		 
	 
 byte[] inputpiddata = isProtoBuf ? getPIDProtoBuf(): getPIDXML();
 int inputpidtype = isProtoBuf ? SecIrisConstants.PIDTYPE_PROTOBUF: SecIrisConstants.PIDTYPE_XML;

 int biotype = isSingleEye ? SecIrisConstants.BIOTYPE_UNKNOWN_IRIS: SecIrisConstants.BIOTYPE_BOTH_IRIS;	 

 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
  byte[] encryptedpid = mSecIris.getEncryptedPidBuffer(inputpiddata, inputpidtype, biotype, mCertChain);
  String encryptedencodedpid = Base64.encodeToString(encryptedpid, Base64.DEFAULT);
  String datatag = "<Data " + "type=\"X\">" + encryptedencodedpid + "</Data>";
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }
 

public byte[] getEncryptedSessionKey ()

This API returns the encrypted session key.

Returns
  • byte array of the encrypted and encoded session key
Throws
LicenseRequiredException If caller does not have the required permissions.
DeviceTamperedException If device is rooted.
NeedsCaptureException In case the API is called without doing a prior successful capture.
Usage

A third party ISV app can use this API to get the encrypted session key returned as byte array. The byte array should be base64 encoded to use in authenticate request.


 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
  byte[] encryptedsessionkey = mSecIris.getEncryptedSessionKey();
  String encryptedencodedsessionkey = Base64.encodeToString(encryptedsessionkey, Base64.DEFAULT);
  String sessionkeytag = "<Skey " + "ci=\"" + certIdentifier + "\">" + encryptedencodedsessionkey + "</Skey>";
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }
 

public static SecIrisManager getInstance ()

gets the instance of iris manager. This is a singleton class and you will be accessing the same object throughout the lifecycle of your app.

Throws
RuntimeException In case the device does not support the Samsung India Identity SDK.

public void registerCallback (SecIrisCallback callback)

API to register for a callback to receive the iris capture events.

Throws
LicenseRequiredException If caller does not have required permissions
Usage

A third party ISV application can use this API to register for a callback to receive iris capture events.

 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
     mSecIris.registerCallback(callback);
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }
 

public int startCapture (int numEyes)

API to start the iris capture.

Parameters
numEyes Number of eyes to be captured. single(1) or dual eyes(2)
Returns
  • A value == 0 if success . Error codes otherwise. SECIRIS_SENSOR_FAILURE will be returned incase you try to call the API when already a capture is going on or in case of error from IR camera. SECIRIS_INVALID_EYESCOUNT will be returned in case you pass a wrong number of eyes parameter. Please see
    • SecIrisErrorCodes.SECIRIS_SUCCESS
    • SecIrisErrorCodes.SECIRIS_FAILURE
    • SecIrisErrorCodes.SECIRIS_SENSOR_FAILURE
    • SecIrisErrorCodes.SECIRIS_INVALID_EYESCOUNT
Throws
LicenseRequiredException If caller does not have required permissions
DeviceTamperedException If device is rooted
Usage

A third party ISV application can use this API to start iris capture.

 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
  int errorcode = mSecIris.startCapture(numEyes);
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }
 

public int stopCapture ()

API to stop or cancel the iris capture.

Returns
  • A value == 0 if success . Error codes otherwise. This API can safely called multiple times. An error will be returned only in case an application is trying to stop the capture started by another application.
    • SecIrisErrorCodes.SECIRIS_SUCCESS
    • SecIrisErrorCodes.SECIRIS_FAILURE
Throws
LicenseRequiredException If caller does not have required permissions
DeviceTamperedException If device is rooted
Usage

A third party ISV app can use this API to stop or cancel the iris capturing. It can be called whenever the app is paused. API will not throw any exception or error in case it is called multiple times.


 SecIrisManager mSecIris = SecIrisManager.getSecIrisManager(mContext);

 try {
  int errorcode = mSecIris.stopCapture();
 } catch (LicenseRequiredException e) {
  Log.w(TAG, "LicenseRequiredException: " + e);
 }