/
AlisonMobile SDK

AlisonMobile SDK


Description

AlisonSDK Mobile is a native library for IOS and Android platforms. 

This library generates CAdES digital signatures for UTF-8 strings and allows the installation of digital certificates under a security policy that protects the certificate usage.

This library offers a similar behavior under both platforms, complying with a common security policy layer. This security policy protects certificate usage, controlled by the certificate issuer.

Platform compatibility

Android

IOS

IONIC

Latest ✔Latest ✔Latest ✔

Download

You can download latest stable release of AlisonSDK-Mobile:

Future Releases

It is possible to access future releases of the library to test new features to be implemented.

.


Security Policy defines rules to protect certificate usage.

Following fields can be included into a security policy.

FieldexampleDescription
nameclient_nameName of the policy. It can be used to recognize between different policies and values.
version5.0.1Version of the policy.
security_level2Security level required to protect the certificate. This value is explained below.
max_try5Limit of tries to enter a password or biometric factor. After the second try, a "toast or flash" message is displayed on screen. After reach the limit defined with this value, action defined in "fail_behavior" is executed.
fail_behavior*lock || erase

This action is executed after reaching the max_try value. 

  • lock disables certificate usage for fail_timeout minutes. 
  • erase destroy the certificate from the keystore.
fail_timeout10Minutes to lock the certificate usage.

Note: a typo was introduced in original library and is maintained by backward compatibility.

Security Level table

DecHexDescription
00x0000none security. Each certificate can be used without any kind of control.
10x0001requires lock-screen of the device to activate the certificate usage.
20x0001requires biometric lock. If biometric lock is not available, level 1 is required.
30x0003any kind of lock (level_1 or level_2).
40x0004the password that protect the certificate is required.
10250x0401password AND lock-screen is required. Both factor must be entered by the user.
10260x0402password AND biometric is required.

.


Methods

List of available methods.


AlisonMobileSDK is a static class used to define some general behaviours of the library and to obtain execution results..

This class must be used to initialize the library before of using any of its methods or classes.

This method must be invoked after OnCreate callback and before of SetContent function. This is required condition to setup the language correctly.

Initialize
initializeAlisonMobile(	String initializeName, String language, 
					   	boolean notification, Context context, 
						String baseUrl );
ArgumentValuesDescription
initializeNamestring

it must indicate a unique identifier for the library. This identifier is used to mark those certificates related to this application. 

languageen | es

language of the messages to show to the user. Other values can be used but programmer must extend the language definitions provided by the library.

if none (null) value is defined, then the library uses the OS language.

notificationfalsethis value indicates to the library if toast messages must be displayed or not.
context
this is the context of the activity requiring this function.
baseUrl
URL where to call to fetch renewal or inform the installation of a new request. This URL is provided by the certification authority, like: "https://panel.certisur.com/panel/acme"

.


Initialize
String getLibVersion();

This method can be used to determine the library version. This can be useful under certain development conditions. This is a static method of AlisonMobileSDK.

.


This library is implemented as an general administrator of operation to be performed. Each operation has its own result, which is communicated to the caller throw the corresponding callback.

The function onActivityResult(int requestCode, int resultCode, Intent data) is used as a callback.

Each kind of operation has a specific class, and specific methods to use.

.


This class can be used to obtain all the certificates. 


Initialize
listOp = new AlisonListOperation(Context context, boolean eraseCerts);

To obtain the list of all certificates installed and controlled by the library and installed into the specific keystore of the application:

Initialize
ArrayList<WebCertificate> certs= ListCertificates();


After obtaining the certificate, it is possible to get information of each certificate.

MethodDescription
String getAlias();Obtain the certificate's alias.
Int getDaysToExpire();Returns validity days of the certificate. A positive value represents that the certificate is still valid.
Int getCertificateStatus();

Obtain the status of the certificate. This status is related to the security policy defined during its installation.

A list of possible values can be found forward.


Certificate Status

ValueCodeDescription
0OKCertificate status OK. Valid for a signature operation.
22009STATUS_INVALIDATED_C

Invalid Status. A certificate with this status can't be used to sign.

This status can be reached when user changes some security features of the device after installing the certificate. For example: user disables all methods that protect the login to the device.

22010STATUS_CHECK_POLICY_ERROR_CCertificate doesn't comply with the security defined by its policy.
22011STATUS_POLICY_ERROR
_AND_INVALIDATED_CERT_C
Certificate doesn't comply with the policy and it's invalid.


Si no hay ningún certificado instalado devuelve una lista vacia.

ArgumentDescription
ContextContext del activity que controla la actividad.
eraseCertsthis parameter can be used to delete those certificates, that are in INVALID status.

.


This class can be used to generate a signed authentication token. This token is used to determine the certificate used to login into the application.

Initialize
authOp = new AlisonAuthOperation(String certAlias);

ArgumentDescription
certAlias

Receives the certificate alias that identify the certificate.

If none parameter is provided, then the library select automatically the certificate to be used.

.


This class can be used to generate a signature of a UTF-8 string.

The signature is CAdES format, without data included into it.

Initialize
signOp = new AlisonSignatureOperation(String text2sign, String certAlias);

If none certAlias is specified, then the last used certificate is selected for this operation.

If there is more than one certificate that can be used, then the select-certificate windows is displayed.

.


This class can be used to import a certificate into the keystore.

Initialize
importOp = new AlisonImportOperation(String certUrl);

This operation download the security policy related to this certificate and check if device comply with this its specification.

If device allows intallation, certificate is downloaded and installed into the keystore. Since that the certificate is protected by a password, user must enter the correct password to proceed with installation.

ArgumentDescription
certUrlURL to the certificate (and its policy) to be downloaded and installed. This URL usually was obtained from an email or scanned QR from the end-user approval console.

.


This operation allows renewal of a certificate close to expire.

A new certificate will be downloaded and installed replacing the certificate to expire. The new certificate can download a new security policy.

Initialize
importOp = new AlisonRenewOperation(String renewUrl);

.


This operation erase the certificate corresponding to the alias passed as a parameter.

Initialize
int deleteSelectedCertificate(String aliasCert);

To delete all the certificates stored into the keystore of this application:

Initialize
int deleteCertificates();

Return code:

ValueDescription
1Success. A certificate or certificates was/were deleted.
0None certificate was found to be deleted.
-1Error. It was not possible to delete the certificate or certificates.

.


Since operation works in a asynchronic mode, the result of each operation is obtained throw the onActivityResult method.

Initialize
void onActivityResult(int requestCode, int resultCode, Intent data);

FieldDescription
requestCodeRequest code included into the Intent used to perform the operation.
resultCode

Result code returned by the operation.  Possible values:

  • 0: sucess
  • 2: error
dataAdditional information returned by the operation. The method getStringExtra() can be used to fetch the information of the operation.

Use this method to obtain information of the operation.

Initialize
String value = data.getStringExtra(String key);

where key can be one of the following values:

KeyDescription
opResult

Detailled information of the result code. A json structure is returned with the following format:

 {"opResult":[{"code": CODE,"detail": DESCRIPTON}],"opType": OP_TYPE,"resultStatus":RES_STATUS}

  • CODE (int): error code of the operation.
  • DESCRIPTION (string): detailled description of the error.
  • OP_TYPE (int): operation code of the operation executed.
  • RES_STATUS (int): result status of the operation, 0 = success, 2 = error.
signatureB64signature CAdES in base64 format. This value can be obtained for AuthOperation and SignatureOperation.
signedTextsigned Text. This value can be obtained for AuthOperation and SignatureOperation.
lockedTimewhen the result.code of the operation is ERR_C_CERT_LOCKED (22311), this value can be obtained to to inform to the end-user how long this certificate will be locked.

.


Following error codes can be returned by this library. This values are defined into the class AlisonCodes.

Common codes

ValueCodeDescription
0C_OPERATION_SUCCESSOperation finished successfully.
2STATUS_ERROROperation finished with error.
22105C_CANCELLEDUser cancelled the operation.
22310ERR_C_CERT_ERASEDCertificate erased because wrong password quantity exceeded limit.
22311ERR_C_CERT_LOCKEDCertificate locked because wrong password quantity exceeded limit.
22700ERR_C_ERROR_BACKENDCpLT Backend Error. This error can be generated by a CoLT error, or a conexion error.

Import & Authentication Operation error codes

ValueCodeDescription
22307ERR_C_WRONG_PASSPassword incorrect.
22315ERR_C_1_CERTIFICATE_INSTALLEDError trying to install a certificate when there is already another certificate installed.

Signature Operation error codes

ValueCodeDescription
22008AUTHENTICATION_MODE_NOT_SETTED_CScreen lock is not enabled in the device.
22401ERR_NO_C_CANDIDATE_CERT_FOUNDNone certificate found.
22402PKCS12_PASSWORD_HASH
_DOES_NOT_MATCH_C
Entered password doesn't match with the certificate password.

.


Following additional files must be included into the project to use the library.

Check that all these folders are defined and created, otherwise complete them.

layout

  • Password_dialog.xml: dialog window to request certificate password. This window could be displayed on signature or installation operations.
  • Renew_dialog.xml: dialog window to request certificate password to be renewed.
  • sdk_activity: container used to show fragments of the windows used to renew or sign.
  • popup_loading.xml: loading popup to show the downloading progress (distributed 

values

  • Alison-leng.xml: english strings used by the library.
  • Colors.xml: color pantone used  by popup_loading.xml.

value_es

  • Alison-leng.xml: spanish strings used by the library.


Related content

Error Codes
Read with this
Alison Suite Products
Alison Suite Products
More like this
Alison SDK
More like this
Signature Suite Products
Signature Suite Products
More like this
CoLT Suite Products
CoLT Suite Products
More like this
Debbie - Validation Service
Debbie - Validation Service
More like this