Sample code uses ES6 language features such as arrow functions and promises. For compatibility with IE11, code written with these features must be either transpiled using tools like Babel or refactored accordingly using callbacks.
Introduction
The following page describes how you can integrate the Eherkenning module exposed on the Trust1Connector onto your web application.
Middleware of Eherkenning has to be installed to be able to fully use the Eherkenning token.
Supported version of the middleware is;
Windows: 3.5.3.0 - 64bit & 32bit
MacOS: 3.5.3.0
Contains the 'authentication certificate' stored on the smart card. The 'authentication certificate' contains the public key corresponding to the private RSA authentication key. The 'authentication certificate' is needed for pin validation and authentication. When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not
The service can be called:
Contains the 'non-repudiation certificate' stored on the smart card. The 'non-repudiation certificate' contains the public key corresponding the private RSA non-repudiation key. When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not
The service can be called:
Contains the 'encryption certificate' stored on the smart card. The 'encryption certificate' corresponds to the private key used to sign the 'biometric' and 'Address' data. When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not
The service can be called:
Depending on the connected smart card reader. A sign can be executed in 2 modes:
Using a connected card reader with 'pin-pad' capabilities (keypad and display available)
Using a connected card reader without 'pin-pad' capabilities (no keypad nor display available)
Security consideration: In order to sign a hash, security considerations prefer using a 'pin-pad'.
Raw data signing
With the function signRaw you can sign unhashed document data. This means that the Trust1Connector will hash the value itself depending on the provided sign algorithm.
Trust1Connector only supports SHA2 hashing at this point.
When using SHA3, the Trust1Connector will convert to SHA2 implicitly.
Below you can find an example
var data = {"algorithm":"sha256","data":"vl5He0ulthjX+VWNM46QX7vJ8VvXMq2k/Tq8Xq1bwEw=","osDialog":false}module.signRaw(data, callback);
The function looks the same as a regular sign operation but expects a base64 data object that is unhashed.
Supported hash functions (SHA2) are;
SHA256
SHA384
SHA512
Sign data without pin-pad
When the web or native application is responsible for showing the password input, the following request is used to sign a given hash:
var data = {"pin":"...","algorithm":"sha256","data":"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=""osDialog": true}module.sign(data, callback);
The core services lists connected readers, and if they have pin-pad capability. You can find more information in the Core Service documentation on how to verify card reader capabilities
Validate signature
The module allows you to call a function on the token that can validate a signature. For this we need to use the validateSignature function. You can call this one via;
constbody= {"algorithm":'sha256',"hash":'...',"signedHash":'...',"osDialog":false,"id":'cert_id',"pin":'pin_code',"timeout":120//timeout in seconds}safenet.validateSignature(body).then(response => {response.valid).catch(error => {errorHandler(error)})
The response of this function will return a valid property that is either true or false.