public class EMVConfig
extends java.lang.Object
EMVConfig
class enables the EMV configuration databases to be updated
inside the security processor (terminal settings configuration for Contact,
Visa, Mastercard, Amex, language settings, revocation list, etc).
EMVConfig
class is
security-critical, updates can only be done by opening a secure session
with the security processor on the Yello terminal.
EMVConfig
class
allows the user to perform the EMV configuration update either locally from an Android application
running on the Yello terminal (via the method openSecureEMVSession(String, String, String, int)
) or
remotely from a PC or Server (via the method
openSecureEMVSession(SocketChannel, String, String, String, int)
), provided
that there is a proxy agent running on the Yello terminal to relay the request.
The proxy-agent can be implemented by the client.
ProgressListener
interface can be registered via the method
updateEMVConfig(EMVConfigType, byte[], int, ProgressListener)
to receive notification about the progress of the update.
ProgressListener
//Assuming that String ca_cert, cert and pkey are populated with data respectively from a SSL //CA Certificate, a SSL client certificate and SSL client private key, all in PEM format. //Assuming that byte[] emv_data is already populated with data from the Contact EMV configuration file in XML format String ca_cert, cert, pkey; byte[] emv_data; // Populate ca_cert, cert, pkey and emv_data ... EMVConfig emvConfig = EMVConfig.getInstance(); try { //Using default timeout emvConfig.openSecureEMVSession(ca_cert, cert, pkey, 0); //Using default timeout with no EMVConfigProgessListener registered emvConfig.updateEMVConfig(EMVConfigType.CONTACT, emv_data, 0, null); } catch (Exception e) { Log.i("DEMOAPI", "failed to update EMV config " + e); } finally { emvConfig.closeSecureEMVSession(); }
ProgressListener
//Assuming that String ca_cert, cert and pkey are populated with data respectively from a SSL //CA Certificate, a SSL client certificate and SSL client private key, all in PEM format. //Assuming that byte[] emv_data is already populated with data from the Contact EMV configuration file in XML format private class MyProgressListener implements ProgressListener { public void showProgress(long progressPercentage) { Log.i("DEMOAPI", "Progress " + progressPercentage + "%"); } } ... private MyProgressListener progressListener = new MyProgressListener(); String ca_cert, cert, pkey; byte[] emv_data; // Populate ca_cert, cert, pkey and emv_data ... EMVConfig emvConfig = EMVConfig.getInstance(); try { //Using default timeout emvConfig.openSecureEMVSession(ca_cert, cert, pkey, 0); //Using default timeout with a EMVConfigProgessListener registered emvConfig.updateEMVConfig(EMVConfigType.CONTACT, emv_data, 0, progressListener); } catch (Exception e) { Log.i("DEMOAPI", "failed to update EMV config " + e); } finally { emvConfig.closeSecureEMVSession(); }NOTE: full example of remote access will be provided at a later time.
Modifier and Type | Method and Description |
---|---|
void |
closeSecureEMVSession()
Closes the currently opened secure EMV session
|
java.util.List<EMVKernelType> |
getAvailableEMVKernels(int timeoutMs)
Gets the list of available EMV kernels from the security processor
|
IINDataBaseInfo |
getEMVBrandInfo(int timeoutMs) |
com.yello.api.secure.configuration.EMVConfiguration |
getEMVConfig(EMVConfigType type,
int timeoutMs)
Gets an EMV configuration from the secure processor
|
static EMVConfig |
getInstance()
Gets the instance of the
EMVConfig singleton |
boolean |
isSecureEMVSessionOpened()
Checks if a secure EMV session to the secure processor is already opened
|
void |
openSecureEMVSession(java.security.cert.Certificate caCert,
java.security.cert.Certificate cert,
java.security.Key pKey,
int timeoutMs)
Opens a local secure EMV session to the secure processor.
|
void |
openSecureEMVSession(java.nio.channels.SocketChannel channel,
java.security.cert.Certificate caCert,
java.security.cert.Certificate cert,
java.security.Key pKey,
int timeoutMs)
Opens a remote (from PC or Server) secure EMV session to the secure processor
|
void |
openSecureEMVSession(java.nio.channels.SocketChannel channel,
java.lang.String caCert,
java.lang.String cert,
java.lang.String pKey,
int timeoutMs)
Opens a remote (from PC or Server) secure EMV session to the secure processor
|
void |
openSecureEMVSession(java.lang.String caCert,
java.lang.String cert,
java.lang.String pKey,
int timeoutMs)
Opens a local secure EMV session to the secure processor
(from an Android application running on the Yello terminal)
|
void |
updateEMVConfig(EMVConfigType type,
byte[] data,
int timeoutMs,
ProgressListener listener)
Performs an EMV configuration update on the secure processor
|
public static EMVConfig getInstance()
EMVConfig
singletonEMVConfig
object.public void openSecureEMVSession(java.nio.channels.SocketChannel channel, java.lang.String caCert, java.lang.String cert, java.lang.String pKey, int timeoutMs) throws java.lang.Exception
channel
- SocketChannel opened and connected to a proxy agent running on the Yello terminalcaCert
- String containing SSL CA certificate data in PEM formatcert
- String containing an SSL client certificate data in PEM formatpKey
- String containing an SSL client private key data in PEM formattimeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedjava.lang.IllegalAccessException
- if a secure EMV session is already openedjava.io.IOException
- if the session cannot be opened due to IO errors or if
the SocketChannel provided as parameter is not connected.java.lang.Exception
- for other types of exceptionspublic void openSecureEMVSession(java.nio.channels.SocketChannel channel, java.security.cert.Certificate caCert, java.security.cert.Certificate cert, java.security.Key pKey, int timeoutMs) throws java.lang.Exception
channel
- SocketChannel opened and connected to a proxy agent running on the Yello terminalcaCert
- SSL CA certificatecert
- SSL client certificatepKey
- SSL client private keytimeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedjava.lang.IllegalAccessException
- if a secure EMV session is already openedjava.io.IOException
- if the session cannot be opened due to IO errors or if
the SocketChannel provided as parameter is not connected.java.lang.Exception
- for other types of exceptionspublic void openSecureEMVSession(java.lang.String caCert, java.lang.String cert, java.lang.String pKey, int timeoutMs) throws java.lang.Exception
caCert
- String containing SSL CA certificate data in PEM formatcert
- String containing an SSL client certificate data in PEM formatpKey
- String containing an SSL client private key data in PEM formattimeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedjava.lang.IllegalAccessException
- if a secure EMV session is already openedjava.io.IOException
- if the session cannot be opened due to IO errors or if
the SocketChannel provided as parameter is not connected.java.lang.Exception
- for other types of exceptionspublic void openSecureEMVSession(java.security.cert.Certificate caCert, java.security.cert.Certificate cert, java.security.Key pKey, int timeoutMs) throws java.lang.Exception
caCert
- SSL CA certificatecert
- SSL client certificatepKey
- SSL client private keytimeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedjava.lang.IllegalAccessException
- if a session (either secure or non-secure) is already openedjava.io.IOException
- if the session cannot be opened due to IO errors or if
the SocketChannel provided as parameter is not connected.java.lang.Exception
- for other types of exceptionspublic boolean isSecureEMVSessionOpened()
public void closeSecureEMVSession()
public void updateEMVConfig(EMVConfigType type, byte[] data, int timeoutMs, ProgressListener listener) throws java.lang.Exception
type
- type of EMV configuration update as defined by EMVConfigType
data
- data in bytes containing the EMV configuration XML data to updatetimeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedlistener
- ProgressListener
to keep track of the update. Optional, can be null.java.io.IOException
- if the EMV configuration update cannot be performed due to IO errorsjava.lang.IllegalArgumentException
- if EMV configuration XML data is not validjava.lang.Exception
- for other types of exceptions.public java.util.List<EMVKernelType> getAvailableEMVKernels(int timeoutMs) throws java.lang.Exception
timeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedEMVKernelType
representing the list of EMV kernels availablejava.util.NoSuchElementException
- if not EMV kernels are availablejava.lang.Exception
- for other type of errorspublic com.yello.api.secure.configuration.EMVConfiguration getEMVConfig(EMVConfigType type, int timeoutMs) throws java.lang.Exception
type
- type of EMV configuration as defined by EMVConfigType
timeoutMs
- Timeout in milliseconds. If timeoutMs is <= 0, internal default timeout will be usedEMVConfiguration
object representing the EMV configurationjava.io.IOException
- if the EMV configuration update cannot be performed due to IO errorsjava.lang.IllegalArgumentException
- if the EMV configuration data is not validjava.lang.Exception
- for other types of exceptions.public IINDataBaseInfo getEMVBrandInfo(int timeoutMs) throws java.lang.Exception
java.lang.Exception
Copyright © 2019 Yello. All rights reserved.