13
[email protected] elevenpaths.com SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications ElevenPaths, radical and disruptive innovation in security solutions

SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

Embed Size (px)

Citation preview

Page 1: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

[email protected]

elevenpaths.com

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

ElevenPaths, radical and disruptive innovation in security solutions

Page 2: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 2 of 13

TABLE OF CONTENT

1 Introduction ................................................................................................................ 3

2 Common Tasks ............................................................................................................ 4

2.1 Including Web Service References ........................................................................................... 4

2.2 Including the SealSignBSSClientLibrary Client .......................................................................... 4

2.3 Authentication of Calls to Web Services .................................................................................. 5

2.3.1 Credentials Transfer for Basic Authentication............................................................................ 5

3 Use Cases .................................................................................................................... 6

3.1 Biometric Signature .................................................................................................................. 6

3.1.1 Including the Handwritten Signature Capture Panel .................................................................. 6

3.1.2 Establishing a Transparent Signature Background ..................................................................... 6

3.1.3 Starting the Capture ................................................................................................................... 6

3.1.4 Stopping the Capture ................................................................................................................. 6

3.1.5 Deleting the Capture .................................................................................................................. 6

3.1.6 Beginning the Signature ............................................................................................................. 7

3.1.7 Client Cryptography .................................................................................................................... 7

3.1.8 Ending the Signature .................................................................................................................. 7

3.2 Verifying Signed Documents ..................................................................................................... 7

3.3 Disconnected Biometric Signature ........................................................................................... 7

3.3.1 Disconnected Capture ................................................................................................................ 7

3.3.2 Synchronizing the Signature with the Server ............................................................................. 8

3.4 Biometric Signature with Document Provider (Document on Server) ..................................... 8

3.4.1 Beginning the Signature ............................................................................................................. 9

3.4.2 Cryptography in Client ................................................................................................................ 9

3.4.3 Ending the Signature .................................................................................................................. 9

3.5 Document Providers Development .......................................................................................... 9

3.5.1 Including SealSignBSSTypes and SealSignDSSTypes ................................................................... 9

3.5.2 Interface Implementation .......................................................................................................... 9

3.5.3 Getting the Document and the Signature Parameters ............................................................. 10

3.5.4 Storing the Signed Document ................................................................................................... 10

4 Resources .................................................................................................................. 12

Page 3: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 3 of 13

1 Introduction

SealSign BSS is a product developed entirely by ElevenPaths, designed to facilitate the integration of the electronic signature with corporate applications. SealSign BSS exposes its functionality through Web services based on WCF (Windows Comunication Framework) technology. These services can be invoked by applications implemented on most technologies on the market.

The SDK of SealSign BSS also provides several panels for the capture of handwritten signatures, available depending on the technology used by the client application.

This document is not intended as a manual for the specific aspects of the electronic signature, but a technical reference guide, developer-oriented, on integrating SealSign BSS in Windows Phone 8.1 Applications.

Page 4: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 4 of 13

2 Common Tasks

2.1 Including Web Service References

The Web services layer is used to interact with the server platform. The “SealSign BSS - Web Services Reference” document details each service and its parameters. In this section you will learn, as an example, how to include the reference to a platform web service using Visual Studio 2013

The capacity for adding WCF web services has been lost for Windows Phone 8.1 applications using XAML, so the type of contract has to be generated separately and the proxies with the web requests required for calling the services. For this proxy, using the JSON services endpoint is recommended.

In the project that is available on GITHub there is an example of a type of proxy that makes requests using the type HttpRequestMessage.

2.2 Including the SealSignBSSClientLibrary Client

In order to include cryptographic functions in the platform client, you need to add the reference to the SealSignBSSClientLibrary library in the project. To do so, just right-click on the .NET project, select the Add option and then Reference...

Figure 01: Adding the SealSignBSSClientLibrary.dll library

Once you have done this, the reference manager window that will allow the selection of the SealSignBSSClientLibrary.dll library will be displayed:

Page 5: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 5 of 13

Figure 02: Visual Studio 2013 Reference Manager.

2.3 Authentication of Calls to Web Services

Depending on the configuration and operations you wish to conduct, requests to the platform web services will be conducted with authentication. For example, a certificate enumeration operation must be performed with authentication from the client, so that the use of allowed certificates is secure.

In the case of Windows Phone 8.1 applications, we will use basic authentication.

2.3.1 Credentials Transfer for Basic Authentication The following example shows the connection to a SealSign web service.

In the example project, we use the type HttpRequestMessage to call the service, and also to add any credentials that have to be used:

requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(String.Format("{0}:{1}", @"SealSignTest", @"Passw0rd"))));

Page 6: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 6 of 13

3 Use Cases

3.1 Biometric Signature

3.1.1 Including the Handwritten Signature Capture Panel Once the SealSignBSSClientLibrary.dll library is added to Visual Studio, the next step involves adding the capture panel in XAML code, adding the namespace SealSignBSSControlLibrary and the control onto the screen.

Figure 03: Including the capture panel.

3.1.2 Establishing a Transparent Signature Background The default signature is shown in the image on a white background. If a transparent background is required for the graphic representation, the property TransparentSignature can be used:

<SealSignBSSClientLibrary:SealSignBSSPanel TransparentSignature="True" />

3.1.3 Starting the Capture Once the panel is integrated in the development, the biometric capture starts by calling the StartSignature method of the panel:

SealSignBSSPanel.StartSignature();

3.1.4 Stopping the Capture The StopSignature method of the panel stops the capture of biometric data. It is convenient to stop the capture once it has been recognized and before beginning the signature process with the server platform:

SealSignBSSWPanel.StopSignature();

3.1.5 Deleting the Capture To reset and delete the capture, you can call the CleanSignature method of the signature panel:

SealSignBSSPanel.CleanSignature();

Page 7: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 7 of 13

3.1.6 Beginning the Signature In order to biometrically sign, you need to follow these steps:

1. Notifying to the platform the document that will be signed.

2. Performing the biometric data fusion and cryptography operations through the SealSignBSSClientLibrary client library using data from the server (i.e., instance and signature token).

3. Notifying the platform of the operation result in order to complete the signature operation and form the final document.

The beginning of the signature is notified to the server platform by calling the BeginSignature method. The used service is /SealSignBSSService/BiometricSignatureServiceBasic.svc. The returned values and syntax of the method can be found in the “SealSign BSS - Web Services Reference” document.

3.1.7 Client Cryptography Calling the signature panel results in the obtaining of biometric data and the cryptographic operation:

// Client encryption with SealSignBSSClientLibrary byte[] biometricFinalState = sealSignBSSWacomSTUPanel1.GetSignature(instance, biometricState);

3.1.8 Ending the Signature The ending of the signature is notified to the platform and the final document is obtained. The used service is /SealSignBSSService/BiometricSignatureServiceBasic.svc. The returned values and syntax of the method can be found in the “SealSign BSS - Web Services Reference” document:

3.2 Verifying Signed Documents

It is possible to verify a signature captured against the signatures located within a document. To do so, a single call is made to the Verify method of the server platform. The used service is /SealSignBSSService/BiometricSignatureService.svc. The returned values and syntax of the method can be found in the “SealSign BSS - Web Services Reference” document.

3.3 Disconnected Biometric Signature

In some scenarios, there may be no connection to the biometric signature server. SealSign can create a preliminary signature to synchronize with the service when the client is connected again. The document must be located on the client in order to uniquely associate the signature captured with the same.

3.3.1 Disconnected Capture Calling the signature panel results in the obtaining of biometric data and the cryptographic operation. Instead of the data obtained from the service on a normal call, the biometric token is obtained by transferring the document to be signed as a parameter. Subsequently, the temporary instance generated on client is also obtained:

var assetsFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets"); StorageFile documentFile = await assetsFolder.GetFileAsync("sample.pdf");

Page 8: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 8 of 13

IRandomAccessStream documentStream = await documentFile.OpenAsync(FileAccessMode.Read); DataReader reader = new DataReader(documentStream.GetInputStreamAt(0)); await reader.LoadAsync((uint)documentStream.Size); byte[] documentBytes = new byte[documentStream.Size]; reader.ReadBytes(documentBytes); //Client encryption with SealSignBSSClientLibrary var response = await signaturePanel.GetOfflineSignature(documentBytes); byte[] biometricFinalState = response.BiometricState; Guid instance = response.Instance;

3.3.2 Synchronizing the Signature with the Server Once the communication with the service is restored, you will need to synchronize the signature or signatures generated without connection in order to obtain the final document including all the necessary elements by calling the SyncOfflineSignatures method. The used service is /SealSignBSSService/BiometricSignatureServiceBasic.svc:

//Sign document OfflineBiometricSignature[] offlineSignatures = new OfflineBiometricSignature[1]; offlineSignatures[0] = new OfflineBiometricSignature(); offlineSignatures[0].id = ""; offlineSignatures[0].account = ""; offlineSignatures[0].biometricOptions = BiometricSignatureFlags.Default; offlineSignatures[0].biometricParameters = null; offlineSignatures[0].options = SignatureFlags.Default; offlineSignatures[0].parameters = null; offlineSignatures[0].instance = instance; offlineSignatures[0].offlineBiometricState = biometricFinalState; BiometricSignatureServiceBasicClient service = new BiometricSignatureServiceBasicClient(); var signedBytes = await service.SyncOfflineSignatures(SignatureProfile.PDF,

offlineSignatures, null,

documentBytes); //Store signed document StorageFolder localFolder = ApplicationData.Current.LocalFolder; StorageFile signedDocument = await localFolder.CreateFileAsync("sample.signed.pdf", CreationCollisionOption.ReplaceExisting); using (Stream signedStream = await signedDocument.OpenStreamForWriteAsync()) {

signedStream.Write(signedBytes, 0, signedBytes.Length); }

3.4 Biometric Signature with Document Provider (Document on Server)

The signature procedure against the platform using a document provider is similar to that of the biometric signature, but the document does not have to be on the client. Instead, a URI that the document provider will use to get the document from a documentary Backend on the server part is specified.

Page 9: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 9 of 13

3.4.1 Beginning the Signature The beginning of the signature is notified to the server platform by calling the BeginSignatureProvider method. The used service is /SealSignBSSService/BiometricSignatureServiceBasic.svc. The returned values and syntax of the method can be found in the “SealSign BSS - Web Services Reference” document.

3.4.2 Cryptography in Client Calling the signature panel performs the obtaining of biometric data and the cryptographic operation:

// Client encryption with SealSignBSSClientLibrary byte[] biometricFinalState = sealSignBSSWacomSTUPanel1.GetSignature(response.instance, response.biometricState);

3.4.3 Ending the Signature The end of the signature is notified to the platform. The used service is /SealSignBSSService/ BiometricSignatureServiceBasic.svc.

The returned values and syntax of the method can be found in the “SealSign BSS - Web Services Reference” document:

3.5 Document Providers Development

As mentioned in the previous section, there is a possibility of signing documents that are not located on the client but on a documentary Backend on the server part. To use this feature, you need to develop and register a type of add-ins, called document providers, which will manage the access to the document repository of the server part.

A document provider is an assembly developed in any .NET language and that implements the SealSignBSSFrontend.IDocumentProvider interface. The description of the interface and the document providers registration on the platform can be found in the “SealSign BSS - Web Services Reference” document.

3.5.1 Including SealSignBSSTypes and SealSignDSSTypes The definition of the SealSignBSSFrontend.IDocumentProvider interface is located within the SealSignBSSTypes.dll assembly. Therefore, you will need to include the reference to SealSignBSSTypes.dll in the .NET project of the new document provider.

In addition, some of the classes used in this interface are defined in the library of electronic signature types definition (SealSignDSSTypes.dll). The inclusion of a reference to this assembly in the project will also be required.

3.5.2 Interface Implementation Once the reference has been added to the SealSignBSSTypes.dll and SealSignDSSTypes.dll, you must create a class with public access that implements the SealSignBSSFrontend.IDocumentProvider interface.

using SealSignBSSFrontend; public class PDFTestProvider : IDocumentProvider { . . .

Page 10: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 10 of 13

3.5.3 Getting the Document and the Signature Parameters The first IDocumentProvider interface method is the method to get the document and signature parameters that will be applied in the operation (GetSigningDocument). With the input parameters specified from the signature client (uri and providerParameter), the document provider must access the document repository, obtain the document to be signed and return both the document and the signature parameters that will be applied.

The following example shows the code of a document provider that accesses the server file system and gets the document specified in the uri that was specified from the client application:

public Stream GetSigningDocument(string uri,

string providerParameter,

out SignatureProfile signatureProfile,

out BiometricSignatureType biometricSignatureType,

out BiometricSignatureFlags biometricOptions,

out BiometricSignatureParameters biometricParameters,

out SignatureFlags options,

out SignatureParameters parameters,

out byte[] detachedSignature)

{

// Signature parameters specification

signatureProfile = SignatureProfile.PDF;

biometricSignatureType = BiometricSignatureType.Default;

biometricOptions = BiometricSignatureFlags.Default;

biometricParameters = null;

options = SignatureFlags.Default;

parameters = null;

detachedSignature = null;

biometricParameters = new BiometricSignatureParameters();

biometricParameters.imageParameters = new BiometricImageParameters();

biometricParameters.imageParameters.signatureVisible = true;

biometricParameters.imageParameters.onAllPages = true;

biometricParameters.imageParameters.offsetX = 370;

biometricParameters.imageParameters.offsetY = 220;

biometricParameters.imageParameters.height = 80;

biometricParameters.imageParameters.width = 100;

// Getting document using uri parameter

Uri documentUri = new Uri(uri);

return new FileStream(documentUri.LocalPath, FileMode.Open, FileAccess.Read);

}

3.5.4 Storing the Signed Document The second IDocumentProvider interface method is the method for storing the document once the signature operation has been performed (SetSignedDocument). With the input parameters specified from the signature client (uri and providerParameter), the document provider will be able to access the document repository to store the document once it has been signed.

The following example shows the code of a document provider that accesses the server file system and stores the document from the uri that was specified from the client application:

Page 11: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 11 of 13

public void SetSignedDocument(string uri, string providerParameter, Stream document) { // Storing signed document using uri parameter

Uri documentUri = new Uri(uri); FileStream outputStream = new FileStream(documentUri.LocalPath+".bio.signed.pdf",

FileMode.Create, FileAccess.ReadWrite); byte[] buffer = new byte[16 * 1024];

int read; while ((read = document.Read(buffer, 0, buffer.Length)) > 0) {

outputStream.Write(buffer, 0, read); } outputStream.Flush(); outputStream.Close();

document.Close();

}

Page 12: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 12 of 13

4 Resources

For information about the different SealSign services available, please go to this address:

https://www.elevenpaths.com/technology/sealsign/index.html

Also, on the ElevenPaths blog you can find interesting articles and innovations regarding this product.

You can find more information about Eleven Paths products on YouTube, on Vimeo and on Slideshare.

Page 13: SealSign BSS Integration Guide for Windows Phone 8.1 and Universal Applications

SealSign BSS (Biometric Signature Services) Integration Guide for Windows Phone 8.1 and Universal Applications

V.3.2 – October 2016

2016 © Telefónica Digital España, S.L.U. All rights reserved. Page 13 of 13

PUBLICATION

October 2016

At ElevenPaths we have our own way of thinking when we talk about security. Led by Chema Alonso, we are a team of experts who are passionate about their work, who are eager to redefine the industry and have great experience and knowledge about the security sector.

Security threats in technology evolve at an increasingly quicker and relentless pace. Thus, since June 2013, we have become a startup company within Telefónica aimed at working in an agile and dynamic way, transforming the concept of security and, consequently, staying a step ahead of our attackers.

Our head office is in Spain, but we can also be found in the UK, the USA, Brazil, Argentina and Colombia.

IF YOU WISH TO KNOW MORE ABOUT US, PLEASE CONTACT US AT:

elevenpaths.com Blog.elevenpaths.com @ElevenPaths Facebook.com/ElevenPaths YouTube.com/ElevenPaths

The information disclosed in this document is the property of Telefónica Digital España, S.L.U. (“TDE”) and/or any other entity within Telefónica Group and/or its licensors. TDE and/or any Telefonica Group entity or TDE’S licensors reserve all patent, copyright and other proprietary rights to this document, including all design, manufacturing, reproduction, use and sales rights thereto, except to the extent said rights are expressly granted to others. The information in this document is subject to change at any time, without notice.

Neither the whole nor any part of the information contained herein may be copied, distributed, adapted or reproduced in any material form except with the prior written consent of TDE.

This document is intended only to assist the reader in the use of the product or service described in the document. In consideration of receipt of this document, the recipient agrees to use such information for its own use and not for other use.

TDE shall not be liable for any loss or damage arising out from the use of the any information in this document or any error or omission in such information or any incorrect use of the product or service. The use of the product or service described in this document are regulated in accordance with the terms and conditions accepted by the reader.

TDE and its trademarks (or any other trademarks owned by Telefonica Group) are registered service marks.