Gemalto Ezio Web Connector

 

Frequently Asked Questions

Some antivirus software may report a false positive/warning on SConnect browser extension or executable. We are in touch with antivirus editors to prevent this but in case you are experiencing an issue, just add SConnect extension/executable to the white list of your antivirus software. So far, Panda and Avast antivirus may report false positive on SConnect.

The installation mode has been removed. The default installation is the only installation mode now. The parameter in the method invokation is removed.

Browsers enables the QUIRK mode when they have to display a HTML page that is not well-formed.

In that case, no control check is performed on the page. The rendering is minimalist. The JavaScript & browser's plug-in can be affected.

This is why SConnect does not work when it is invoked from a page in QUIRK mode.

Keep in mind that only the standard mode is supported otherwise your web application will not be able to operate with EWC.

This is especially rigth using Internet Explorer.

Internet Explorer 7 does not have JSON support by default, and SConnect needs one.

To explicitly add the inclusion of an external JSON library in your HTML page, add ‹!--[if IE 7]› ‹script src='json.js'›‹/script› ‹![endif]--›.

Note that the json.js script included here is one of the reference implementation that you can use, but you are free to use any other available JSON library implementation, if you wish to.

This JSON script inclusion must occur before the inclusion of the sconnect.js script of your HTML page.

Internet Explorer 10 on Windows 8 has two versions, one for Metro and one for desktop. The one for Metro Style only supports the websites that are plug-in free. In that case SConnect will not be supported.

To explicitly switch to desktop mode, add the meta tag ‹meta http-equiv=”X-UA-Compatible” content=”requiresActiveX=true”› in the ‹head› block of your HTML page.

The SDK is a collection of static web pages. Unfortunately Google Chrome is not able to use the SConnect extension from an URL file.

To avoid that limitation, you have to enable the incognito mode and the local file access options of the SConnect extension settings.

Note that Chrome on Linux is not supported.

Safari does not allow usage of extension from file URL.

To avoid that limitation, you have to set up and run a local web server on the SDK static web pages to access them from Safari.

The SConnect browser extension must be installed on the card holder's browser to provide to EWC the access to the PCR. The installation is driven directly by SConnect from the on-line banking server. You have to provide the URLs to access the images, EULA, FAQ, extensions and web pages to guide the card holder during the installation.

The server configuration is composed of different URLs:

  • The "extPath" property is required to reach the SConnect extension for the browser.
    THIS PATH IS ALWAYS ABSOLUTE.
  • The "addonPath" property is required to reach the SConnect add-ons (as PC/SC addon) for the browser.
    THIS PATH IS ALWAYS ABSOLUTE.
  • The "imgPath" property is required to reach the images to display during installtion.
    THIS PATH IS ALWAYS ABSOLUTE.
  • The "eulaPath" property is required to reach the EULA (license agreement) to display during the installation.
    THIS PATH IS ALWAYS ABSOLUTE.
  • The "faqPath" property is required to reach the Frequently Asked Questions to display during the installation.
    THIS PATH IS ALWAYS ABSOLUTE.
  • The "licensePath" property is required to reach the SConnect license on the on-line server to be validated after the installation.
    THIS PATH IS ALWAYS RELATIVE.
    THIS PATH MUST NOT BE NULL.
var serverConfiguration = {
extPath     : "https://127.0.0.1/sconnect/extensions/",
addonPath   : "https://127.0.0.1/sconnect/addons/",
imgPath     : "https://127.0.0.1/sconnect/images/",
eulaPath    : "https://127.0.0.1/sconnect/eula/",
faqPath     : "https://127.0.0.1/sconnect/faqs/",
licensePath : "/sconnect.lic",
};
                    

EWC is not designed to work with several readers and smartcards at the same time. It is not possible to open a connection with a selected reader or smart card.

To avoid that limitation, the web application have to enable to filter the targeted reader or the smartcard. The "init" function accepts a parameter named "CallbackHardwareFilter".

This is a function that EWC uses each time a new reader or smart card is inserted to accept or ignore the piece of hardware:

function hardwareFilter( a_ReaderName, a_SmartCardATR ) {
  
  if (a_ReaderName.toUpperCase().search("EZIO") >= 0) {
    return true;
  }
  return false;
}

In this example, EWC will only accept readers with the key word "ezio" in its name.

But if several readers compliant with the filter are available, only the last smart card compliant with the filter with be used by EWC. Any previous connection with a previous complaint with the filter smart card will be disposed and a connection with the last inserted smart card will be created.

It is up to the web application to manage which reader and smart card to use.

In the previous eNex, the function "getConnection" was able to silently reconnected to the smart card if possible (in case the connection was not possible due to PCSC exclusive access from another application for example). This is no more possible with EWC. A new function "reConnection" is provided to help the web application to restablish the connection.

var cnx = enex.getconnection();
if (cnx === null) {
    
    // The connection is lost but the smart card is still in the reader
    // To avoid to ask for the end-user to withdraw and insert again the smart card
    // the web application can try to connect silently to the last smart card/reader pair used by EWC
    var callbackConnection = {
    
        success : function(a_oConnection) {
        
            // The connection is available !
            
            // Use the a_oConnection to operate with EWC
            // ...
        },
        
        failure : function(oError) {
        
            // No connection possible !
            
            // Try to know why exploring the error
            var errorCode = oError.errorCode;
            var errorMessage = oError.message;
            
            // ...
        }
    };
    
    enex.reConnection(callbackConnection)
}
                        

To avoid that kind of tricky manipulations, the best case is to use only one reader and one smart card in your environment.

eNex was a synchronous library. Each function of the eNex API took a callback which was called in case of success or error after the end of the execution of the function. It was possible to chain the call of several eNex API functions to build a scenario. But the scenario was blocking the web application until the end of the last call to any eNex function.

EWC is asynchronous. Each function of the EWC API also takes a callback which is called in case of success or error after the end of the execution of the function. But the function returns immediately and the callback is invoked later when the final execution is done. EWC functions are not more blocking. But the web application has to chain differently the EWC functions to build a scenario.

You have to wait the end of the execution current function to call the next. As the function returns immediately, you have to perform the next call within the callback code.

Here is an example. Imagine you need first to get the PAN of the smart card and then perform a CAP operation.


// Create a callback to treat the return of the CAP asynchronous function
var capCallback = {
  
  success : function( a_oConnection, a_sToken, a_sUmpredictableNumber ) {
    
    // Display the token computed by the CAP operation
    alert("Your token " + a_sToken + " has been successfully generated");
  },

  failure : function( a_oConnection, a_oError ) {
  
    alert("Your token has NOT been generated. Error code (" + a_oError.errorCode + "). Error message (" + a_oError.message + ")");
};

// Create a callback to treat the return of the get PAN asynchronous function
var panCallback = {
  
  success : function(a_oConnection, a_PAN, a_PSN, a_ExpirationDate) {

    // The PAN has been retrieved. The current operation is done with EWC.
    doSomethingWithThePAN(a_PAN);
    
    // Initiate the next operation with EWC
    var cnx = enex.getConnection();
    if ( cnx ) {
  
      cnx.cap_mode2(capCallback);
    }
  },

  failure : function(a_oConnection, a_oError) {
 
    alert("The PAN cannot be retrieved. " + a_oError);
  },
  
};
  
// Initiate the scenario by calling the CAP function
function myScenario() {
  
  var cnx = enex.getConnection();
  if ( cnx ) {

    cnx.get_pan_psn(panCallback);
  }  
}

The chaining is done by calling each EWC function at the end of the execution of the previous one in the returned callback.

If you call each EWC function at the end of the execution of the previous one out of the returned callback then your scenario will fail.

      
// WRONG SCENARIO !!!!
function myWrongScenario() {
  
  var cnx = enex.getConnection();
  if ( cnx ) {

    cnx.get_pan_psn(panCallback);
    
    // Call the next function without waiting for the end of the previous one drives you to failure !
    cnx.cap_mode2(capCallback);
  }  
}

As in the previous versin, the main API of EWC is accessible from the global "enex" object.
After initialization, the web application can operate with the smart card using the "Connection" object returned by the "enex.getConnection()" function.
Here is the list of the main API functions with the corresponding changes.

dudu
Method Name Changed Description
dispose( ) No Releases the global "enex" object.
No return or callback.
getBrowserCaracteristics( ) No Gets the browser information.
Returns an object containing the properties "BrowserName", "BrowserVersion" and "OS".
getConnection( ) YES Gets the current Connection object.
Returns a Connection object or null.
The silent reconnection is no more provided. If the connection is lost, the web application can try to restablish the connection using the function "reConnection".
getPersonalCardReaderInformation(callback) No Reads the PCR Information block from the PCR currently connected.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the PCR information is returned as the first parameter.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {

    success : function( a_PCR_Information ) {
    
        alert( "The PCR information block is:" + a_PCR_Information );
    },
    
    failure : function( a_oError ) {
    
        alert( "An error occured. Error code (" + a_oError.errorCode + "). Error message (" + a_oError.message + ")");
    }
};

var c = enex.getConnection( );

if( c ) {
    c.getPersonalCardReaderInformation( resultCallback );
}
                                
getSConnectVersion(callback) NEW Gets the current version of the installed SConnect.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the SConnect version is returned as the first parameter.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var callbackSConnectVersion = {

    success:function(version) {
    
        alert("The SConnect version is " + version);
    },
    
    failure:function(error) {
    
        alert("An error occurred (" + error.errorCode + ") (" + error.message + ")";
    }					
};

enex.getSConnectVersion(callbackSConnectVersion);
                                
getSecureChannelState(callback) No Checks if the Secure Channel is established or not. The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the boolean value of the Secure Channel state is returned as the first parameter.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
  // Create a callback to treat the return of the getSecureChannelState function
  var resultCallback = {
  
    success : function( a_bState ) {
      alert( "is Secure Channel active ? (" + a_bState + ")" );
    },
    
  failure : function( a_oError ) {
  
    var message = "Operation FAILED.";
    message += " Error (" + a_oError.errorCode + ").";
    message += " Message (" + a_oError.message + ")";
    alert(message);
  }
  
};

var cnx = enex.getConnection( );

if (cnx) { 
  cnx.getSecureChannelState(resultCallback);
}
getTrackingInformation( ) No Gets the EWC trace logs.
Returns an array of records describing each step performed by EWC.
Each record is an object composed of the properties "Category" (Debug, Info, Warning, Error), "TimeStamp" and "Message".
var log = enex.getTrackingInformation( );

if ( log ) {

    // Format the record for screen display
    var r = "";
    for( var i = 0 ; i < log.length ; ++i ) {
        switch( log[ i ].Category ) {

            case "Debug":
            r = "debug - ";
            break;

            case "Info":
            r = "info - ";
            break;
            
            case "Warning":
            r = "warning - ";
            break;
            
            case "Error":
            r = "error - ";
            break;
            
            default:
            r = "unknown - ";
            break;
        }
        
        r += log[ i ].TimeStamp;
        r += " - ";
        r += log[ i ].Message;
        
        displayThisLineOnMyPage( r );
    }
}
getVersion( ) No Returns the version of the EWC library.
var version = enex.getVersion( );
get_file_from_server(url, callback) No Fetchs a file from the server through JavaScript. It is typically used to fetch the EWC configuration file. This function can operate either synchronously or asynchronously.
init( a_JSONReaderConfiguration, a_CallbackHardwareFilter, a_CallbackConnection, a_CallbackHardwareEventNotification, a_CallbackLicenceVerificationFailed, a_JSONServerConfiguration, a_ShowValidationMessage, a_bEnableGUI, a_CallbackDialogBox, a_InstallationMode, a_CallbackInstallation, a_CallbackInitialization) YES Initializes the EWC library.
The parameters "Installation mode" and "callback installation" have been removed.
A new parameter "callbackInitialization" has been introduced as last parameter of the function. Note that if a SConnect installation is required this callback is not invoked.
The function is useful to know when the EWC initialization is finished and the library is ready to be used.

The parameter is an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked when the initialization is finished.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var callbackInitialization = {

    success : function() {
        alert('initialization done');
    },

    error : function(a_oError) {
        alert('initialization failed. The error is ' + a_oError.errorCode + " "
                + a_oError.message);
    }
};

enex.init(  JSONReaderConfiguration,
            CallbackHardwareFilter,
            CallbackConnection,
            CallbackHardwareEventNotification,
            CallbackLicenceVerificationFailed,
            JSONServerConfiguration,
            ShowValidationMessage,
            bEnableGUI,
            CallbackDialogBox,
            callbackInitialization);
     
isBrowserSupported( ) No Returns if the current browser is supported as a boolean value.
var bIsBrowserSupported = enex.isBrowserSupported( );

if ( bIsBrowserSupported ) {

   alert( "Your browser is properly supported." );
}
     
isSmartcardServiceAvailable( ) No Returns if the smart card service is running on the computer as a boolean value.
var bIsSmartcardServiceAvailable = enex.isSmartcardServiceAvailable( );

if ( bIsSmartcardServiceAvailable ) {

    alert( "The Smart Card Service is running on your machine." );
}
     
is_installed(callback) YES Checks if SConnect extension is installed or an update is available to replace the current version. This function is now asynchronous. A parameter has been introduced. The parameter is an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked when the SConnect extension is installed.
When the function fails, the "failure" function is invoked when SConnect is not installed or an update is available and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
If SConnect is not installed then the "errorCode" is to -1 and the "message" is empty.
If SConnect is installed but an upgrade is availalble then the "errorCode" is set to -1 and the "message" is "update required".
var cb = {

    success : function() {
    
        alert("SConnect is installed");
    },
    
    failure : function(error) {
    
        var sMessage = "SConnect is not installed or an update is ready to be installed. ";
        sMessage += "Error (" + error.errorCode + ") ";
        sMessage += "Message (" + error.message + ")";
        alert(sMessage);
    }
};
 
enex.is_installed(cb);
     
list_readers(withCard, callback) YES Retrieves a list of all readers connected with or without smart card inside as an array of the reader names. This function is now asynchronous. A parameter has been introduced. The parameter is an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked to return the list as first parameter of the function.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var listCallback = {
  
  success : function( r ) {
    
    var sMessage = "The available readers are: ";
    
    if ( r.length ) {
    
        for( var i = 0 ; i < r.length ; ++i ) {
        
            sMessage += r[ i ] + " ";
        }
    } else {
    
        sMessage = "No reader available";
    }
    
    alert(sMessage);
  },

  failure : function( a_oError ) {
  
    var error = "An error occurred. ";
    error += "Error code (" + a_oError.errorCode + ").";
    error += " Error message (" + a_oError.message + ")";
    alert(error);
  }
};

enex.list_readers( a_WithSmartcard, listCallback );
reConnection(callback) NEW This new function has been introduced to silently reconnect to the smartcard withing asking the end-user to move the smart card in the reader.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the Connection object is returned as the first parameter.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
  
  success : function( a_oConnection ) {
    
    alert("You are reconnected to the smart card");
  },

  failure : function( a_oError ) {
  
    alert("The reconnection failed. Error code (" + a_oError.errorCode + "). Error message (" + a_oError.message + ")");
  }  
};

enex.reConnection(resultCallback);
                                
sendAPDUAsynchronous( apdu, callback ) No Transmits an APDU to the smart card.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and an object is returned containing the properties statusWord and dataOut describing the response.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
    
    success : function( a_oResponse ) {
        alert("APDU sent successfuly. Status word (" + a_oResponse.statusWord + ") - Data (" + a_oResponse.dataOut + ")" );
    },
    
    failure : function( a_oError ) {
        alert("APDU transmission failed. Error code (" + a_oError.errorCode + "). Error message (" + a_oError.message + ")");
    }
};

var cnx = enex.getConnection( );
if (cnx) {
    cnx.sendAPDUAsynchronous("8012030100", resultCallback);
}
                                    
sendAPDU( a_sAPDU ) REMOVED This synchronous method is no more provided. Use sendAPDUAsynchronous instead.
validate_installation(server_validation_callback, extension_configuration, showValidationMsg) No Checks first if SConnect is installed and starts installation if needed. Then checks if the SConnect licence is validated.
cap_mode1(a_oCallback, a_sUnpredictableNumber, a_sAmount, a_sCurrency, a_sPasscode) No Generates a CAP Mode1 token from the incoming parameters.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and an object is returned containing the current connnection and the generated token.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
  
  success : function( a_oConnection, a_sToken ) {
    
    alert("Your token " + a_sToken + " has been successfully generated.");
  },

  failure : function( a_oConnection, a_oError ) {
  
    var sMessage = "Your token has NOT been generated.";
    sMessage += " Error (" + a_oError.errorCode + ").";
    sMessage += " Message (" + a_oError.message + ")";

    alert(sMessage);
  }
};

// Collect the end-user information to operate the CAP
var sUnpredictableNumber = "11223344"
var sAmount = "10000"
var sCurrency = "USD"
    
// Retrieve the Connection object attached to the smart card inserted into the reader
var cnx = enex.getConnection( );
if ( !cnx ) {
  
  return;
}
cnx.mode1( resultCallback, sUnpredictableNumber, sAmount, sCurrency );
         
cap_mode2(a_oCallback, a_aTdsData, a_sPasscode) No Generates a CAP Mode2 token from the incoming parameters.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and an object is returned containing the current connnection and the generated token.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
  
  success : function( a_oConnection, a_sToken ) {
    
    alert("Your token " + a_sToken + " has been successfully generated.");
  },

  failure : function( a_oConnection, a_oError ) {
  
    var sMessage = "Your token has NOT been generated.";
    sMessage += " Error (" + a_oError.errorCode + ").";
    sMessage += " Message (" + a_oError.message + ")";

    alert(sMessage);
  }
  
};
  
// Retrieve the Connection object attached to the smart card inserted into the reader
var cnx = enex.getConnection( );
if ( !cnx ) {
  
  return;
}

var TDS = [ "12345", "445566" ];
cnx.cap_mode2( callback, TDS );
         
cap_mode3(a_oCallback, a_sUnpredictableNumber, a_aTdsData, a_sPasscode) No Generates a CAP Mode3 token from the incoming parameters.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and an object is returned containing the current connnection, the generated token and the optional umpredicable number entered by the end-user.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
  
  success : function( a_oConnection, a_sToken, a_sUmpredictableNumber ) {
    
    // Reset the token display on the HTML page
    var sMessage = "Your token " + a_sToken + " has been successfully generated.";
    
    // From specific PCR as Ezio Shield Branch reader the card holder can specify
    // the unpredictable number directly from the PCR (you only have to send
    // the CAP Mode3 command with a 'FFFFFFFF' template as unpredictable number).
    // In this case, the 'success' function must manage a new and last parameter to
    // get the value typed by the card holder
    if ( a_sUmpredictableNumber ) {
      
      sMessage += " The card holder has specified " + a_sUmpredictableNumber + " as unpredictable number";
    }
  
    alert(sMessage);

  },

  failure : function( a_oConnection, a_oError ) {
  
    var sMessage = "Your token has NOT been generated.";
    sMessage += " Error (" + a_oError.errorCode + ").";
    sMessage += " Message (" + a_oError.message + ")";

    alert(sMessage);
  }
  
};
  
// Retrieve the Connection object attached to the smart card inserted into the reader
var cnx = enex.getConnection( );
if ( !cnx ) {
  
  return;
}

// Collect the end-user information to operate the CAP
var sUnpredictableNumber = "11223344"
var TDS = [ "12345", "445566" ];

// Perform the operation
cnx.cap_mode3( callback, sUnpredictableNumber, TDS );
getPersonalCardReaderLanguage(a_oCallback) No Changes the PCR language with the PPDU CCID ESC_COMMAND command.
The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked and an object is returned containing the current language.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {

    success : function( a_Language ) { alert( "Current language is" + a_Language ); },
    
    failure : function( a_oError ) { alert( "Operation FAILED. Error message :" + a_oError.message + ". Error code : " + a_oError.errorCode); }
};

var cnx = enex.getConnection( );

if( cnx ) {

    cnx.getPersonalCardReaderLanguage( resultCallback );
}
get_display_size()REMOVED This function is no more provided. Use the 'getPersonalReaderInformation' function to get the 'display' information (tag D0 from the returned TLV buffer)
get_pan_psn(a_oCallback) No Collects the Primary Account Number (PAN, PSN, expiration date) from the smart card
The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked to return the current connection, the PAN, the PSN and expiration date.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {
  
  success : function( a_oConnection, a_PAN, a_PSN, a_ExpirationDate ) {

    var sMessage = "Your PAN is ";
    sMessage += a_PAN;
    sMessage += ".Your PSN is ";
    sMessage += a_PSN;
    sMessage += ".Your Expiration Date is ";
    sMessage += a_ExpirationDate;
    sMessage += ".";
    
    alert(sMessage);
  },

  failure : function( a_oConnection, a_oError ) {
  
    var sMessage = "The PAN cannot be retrieved.";
    sMessage += " Error (" + a_oError.errorCode + ")";
    sMessage += " Message (" + a_oError.message + ")";

    alert(sMessage);
  },
  
};

var cnx = enex.getConnection( );
if ( cnx ) {

  cnx.get_pan_psn( resultCallback );
}  
         
is_gemalto_driver_installed(a_oCallback) YES Checks if the Gemalto driver is installed (only on windows platforms).
This function is now asynchronous. A parameter has been introduced.
The parameter is an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked to return a boolean value as first parameter of the function. When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var cnx = enex.getConnection( );

if( cnx ) {

    var callback = {

        success : function(bIsGemaltoDriverInstalled){

            if ( bIsGemaltoDriverInstalled ) {

                alert("The Gemalto driver is properly installed");
            
            } else {
            
                alert("The Gemalto driver is NOT installed");					
            }
        },

        failure : function(a_oError) {
            
            alert("An error occurred (" + a_oError.errorCode + ") - (" + a_oError.message + ")");                    
        }
    };

    cnx.is_gemalto_driver_installed(callback);
}
                                    
secureChannelEstablishment(a_oCallback) No Establishs the Secure Channel with the PCR. The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked and the Secure Channel configuration is returned as the first parameter. When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var cnx = enex.getConnection( );
if( !cnx ) {

    alert( "no available connection to the smart card" );
    return;
}

var resultCallback = {

success : function( a_oDataOut ) {

    alert("Operation succeeded - The reader returned the following data (" + a_oDataOut + ")" );
},

failure : function( a_oError ) {

    var message = "Operation FAILED.";
    message += " Error (" + a_oError.errorCode + ").";
    message += " Message (" + a_oError.message + ")";
    alert(message);
}

};

var sUnpredictableNumber = "94882455";
var sSecureChannelConfiguration = "20109840000011223344111222330000";
var sPassCodeConfiguration = null;
var sApplicationSelectionList = null;
var bEncryption_Indicator = 0;
var bTerminate_Secure_Channel_Indicator = 0;
var bWait_Card_Indicator = 0;

cnx.secureChannelEstablishment( resultCallback, 
                                sUnpredictableNumber,
                                sSecureChannelConfiguration,
                                sPassCodeConfiguration,
                                sApplicationSelectionList,
                                bEncryption_Indicator,
                                bTerminate_Secure_Channel_Indicator,
                                bWait_Card_Indicator );
                                    
secureChannelTermination(a_oCallback, a_sMAC) No Ends the Secure Transaction established.
The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked and the Secure Channel configuration is returned as the first parameter. When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var MAC = "18C634123D170614";

var resultCallback = {

  success : function( a_oBufferFromPCR ) {
    alert("Secured Channel Terminated. PCR returned " + a_oBufferFromPCR );
  },
  
    failure : function( a_oError ) {
      var message = "Operation FAILED.";
      message += " Error (" + a_oError.errorCode + ").";
      message += " Message (" + a_oError.message + ")";
      alert(message);
  }
};

var c = enex.getConnection( );

if( c ) {
    c.SecureChannelTermination( resultCallback, MAC );
}
                                    
sendPPDU(a_oCallback, a_iFeature, a_oFeatureParameters, a_bNoGUI) No Send a PPDU command compliant with the PCSC specification..
The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked and the response is returned as the first parameter. When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
// Construct the template according the PCSC specification and the smart card configuration
var parameters = { };
parameters[ enex.FEATURE_PARAMETER_TIMEOUT ] = "1E";
parameters[ enex.FEATURE_PARAMETER_TIMEOUT2 ] = "1E";
parameters[ enex.FEATURE_PARAMETER_FORMATSTRING ] = "82";
parameters[ enex.FEATURE_PARAMETER_PINBLOCKSTRING ] = "04";
parameters[ enex.FEATURE_PARAMETER_PINLENGTHFORMAT ] = "00";
parameters[ enex.FEATURE_PARAMETER_PINMAXEXTRADIGIT ] = "0408";
parameters[ enex.FEATURE_PARAMETER_ENTRYVALIDATIONCONDITION ] = "02";
parameters[ enex.FEATURE_PARAMETER_NUMBERMESSAGE ] = "00";
parameters[ enex.FEATURE_PARAMETER_LANGID ] = "040C";
parameters[ enex.FEATURE_PARAMETER_MSGINDEX ] = "00";
parameters[ enex.FEATURE_PARAMETER_TEOPROTOCOL ] = "000000";
parameters[ enex.FEATURE_PARAMETER_DATA ] = "A020000108FFFFFFFFFFFFFFFF";
         
var cnx = enex.getConnection( );

if( !cnx ) {
  
  showResult( g_sTitleKO, "no available connection to the smart card" );
  
  return;
}

// Create the callbacks to receive the response  
var resultCallback = {
  
  success : function( dataOut ) {
    
    alert("Operation succeeded - Data returned by the reader(" + dataOut + ")" );
  },

  failure : function( a_oErrorObject ) {
    alert("Operation FAILED. Error code (" + a_oErrorObject.errorCode + "). Error message (" + a_oErrorObject.message + ")");
  }
};

cnx.sendPPDU( resultCallback, enex.FEATURE_PARAMETER_FEATURE_VERIFY_PIN_DIRECT, parameters );
sendSPE(a_oCallback, a_iFeature, a_oFeatureParameters) No Executes a Secure Pin entry operations. This function ONLY applies if the Gemalto driver is installed.
The function accepts an object containing two functions "success" and "failure" as properties. When the function succeeds, the "success" function is invoked and the response is returned as the first parameter. When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
    
var parameters = { };
parameters[ enex.FEATURE_PARAMETER_TIMEOUT ] = ...;
parameters[ enex.FEATURE_PARAMETER_TIMEOUT2 ] = ...;
parameters[ enex.FEATURE_PARAMETER_FORMATSTRING ] = ...;
parameters[ enex.FEATURE_PARAMETER_PINBLOCKSTRING ] = ...;
parameters[ enex.FEATURE_PARAMETER_PINLENGTHFORMAT ] = ...;
parameters[ enex.FEATURE_PARAMETER_PINMAXEXTRADIGIT ] = ...;
parameters[ enex.FEATURE_PARAMETER_ENTRYVALIDATIONCONDITION ] = ...;
parameters[ enex.FEATURE_PARAMETER_NUMBERMESSAGE ] = ...;
parameters[ enex.FEATURE_PARAMETER_LANGID ] = ...;
parameters[ enex.FEATURE_PARAMETER_MSGINDEX ] = ...;
parameters[ enex.FEATURE_PARAMETER_TEOPROTOCOL ] = ...;
// If the data length field is not present in the template, EWC will compute the length itself from the data field
//parameters[ enex.FEATURE_PARAMETER_DATALENGTH ] = ...;
parameters[ enex.FEATURE_PARAMETER_DATA ] = ...;

// Create a callback to treat the return of the asynchronous function
var resultCallback = {
  
  success : function( a_DataOut ) {
    
    alert("Operation succeeded - data (" + a_DataOut + ")" );
  },

  failure : function( a_oError ) {
  
    var message = "Operation FAILED.";
    message += " Error (" + a_oError.errorCode + ").";
    message += " Message (" + a_oError.message + ")";
    alert(message);
  }
};

var cnx = enex.getConnection( );

cnx.sendSPE( resultCallback, enex.FEATURE_VERIFY_PIN_DIRECT, parameters );
           
setPersonalCardReaderLanguage(a_oCallback, a_Language, a_bTemporaryChange, a_bCardLanguage) No Changes the PCR language with the PPDU CCID ESC_COMMAND command.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the response is returned as the first parameter.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
var resultCallback = {

    success : function( a_oArgs ) { alert( "Operation succeeded. The language set is " + a_oArgs); },
    
    failure : function( a_oError ) { alert( "Operation FAILED. Error message :" + a_oError.message + ". Error code : " + a_oError.errorCode); }
};

var cnx = enex.getConnection( );

if( cnx ) {

    cnx.setPersonalCardReaderLanguage( resultCallback, "0409", true, false );
}
         
swys(a_oCallback, a_sApplication, a_DataToSign, a_sAlgo, a_DisplaySizes) YES Performs a digital signature operation.
The function accepts an object containing two functions "success" and "failure" as properties.
When the function succeeds, the "success" function is invoked and the current connection, and the token are returned.
When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.
Added a last parameter to set the display size. This parameter is an array containing the possible widths and lengths of the reader screen. Each element of the array is an array which 2 cells: the first one is the width of the screen (for example 17 when the a screen line is eble to display 17 characters), the second one is the height of the screen (for example 4 when the screen is able to display 4 lines). If the parameter is not set then a default array of [17,4] array is used. Typically an invocation to the 'getPersonalCardReaderInformation' (replace the deprecated function '_get_device_info') returns the screen size characteristics (from the tag 'D0' of the returned TLV buffer).
var resultCallback = {

    success : function( a_oConnection, a_sToken ) {
    
        alert("Your token " + a_sToken + " has been successfully generated");
    },
    
    failure : function( a_oConnection, a_oError ) {
    
        var sMessage = "Your token has NOT been generated.";
        sMessage += " Error (" + a_oError.errorCode + ").";
        sMessage += " Message (" + a_oError.message + ")";
        alert(sMessage);
    }
};

var cnx = enex.getConnection( );

var targetedApplication = "BANK";

var aData = [
    ["INPUT_CHALLENGE", "12345"],
    ["INPUT_BUY_SELL", "SELL"],
    ["INPUT_DATA",  "1234"],
    ["INPUT_DATA_2",  "2345"],
    ["INPUT_DATA_3",  "3456"],
    ["INPUT_DATA_4",  "4567"],
    ["INPUT_DATA_5",  "5678"],
    ["INPUT_CURRENCY", "USD"],
    ["INPUT_AMOUNT_WITH_CURRENCY", "99.99"],
    ["FREE_TEXT",
        [
            "Do you agree ?",
            "Press ok"
        ]
    ]
];

var sAlgo = enex.SWYS_ALGO_GEMALTO;

// Set the possible displays to first 17 characters on 4 lines or 17 characters on 5 lines
var DisplaySizes = [[17,4], [17,5]];
cnx.swys( resultCallback, targetedApplication, aData, sAlgo, DisplaySizes);

Most of the function of EWC API accepts on object with two properties "success" and "failure" to provide the asynchronous result of the execution.

When the function succeeds, the "success" function is invoked and information are returned intot the parameters of the function depending on the function itself.

When the function fails, the "failure" function is invoked and an object with two properties "errorCode" and "message" describing the issue is returned as first parameter.