Amigo Security Services-Tutorial
55 pages
English

Amigo Security Services-Tutorial

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
55 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

IST Amigo Project Amigo Training Document: Using Amigo Security Services Version 2.0 IST-2004-004182 Public June 2007 Confidential Project Number : IST-004182 Project Title : Amigo Deliverable Type : Tutorial Deliverable Number : Title of Deliverable : Using Amigo Security Services Nature of Deliverable : Public Internal Document Number : Contractual Delivery Date : Actual Delivery Date : Contributing WPs : Version : 2.0 Author(s) : Edwin Naroska, Ron Mevissen, Stephan Tobies, Rich Hanbidge, Todor Dimitrov Abstract This document is a tutorial about gives an introduction on how to use the Amigo Security Services in order to setup secure communication channels between client and services. The tutorial will show how to write a secured service, how to write a client that makes use of a secured service. Further, it will explain how to authenticate a user/device within the Amigo network. Keyword list Security Service, Symmetric Encryption, Decryption Amigo IST-2004-004182 1/54 June 2007 Confidential Table of Contents Table of Contents................................................................................................... 2 1 Introduction..................................................................................................... 4 1.1 Prerequisites..............................................................................................................................4 1.2 How to use ...

Informations

Publié par
Nombre de lectures 63
Langue English

Extrait

 
IST Amigo Project   Amigo Training Document: Using Amigo Security Services Version 2.0  IST-2004-004182 Public   
 
 
June 2007
: IST-004182 : Amigo : Tutorial
Confidential 
: : Using Amigo Security Services : Public : : : : : 2.0 : Edwin Naroska, Ron Mevissen, Stephan Tobies, Rich Hanbidge, Todor Dimitrov
 Project Number Project Title Deliverable Type  Deliverable Number Title of Deliverable Nature of Deliverable Internal Document Number Contractual Delivery Date Actual Delivery Date Contributing WPs Version Author(s)  Abstract This document is a tutorial about gives an introduction on how to use the Amigo Security Services in order to setup secure communication channels between client and services. The tutorial will show how to write a secured service, how to write a client that makes use of a secured service. Further, it will explain how to authenticate a user/device within the Amigo network.  Keyword list Security Service, Symmetric Encryption, Decryption   
Amigo IST-2004-004182  
 
1/54 
June 2007
Table of Contents
Confidential 
Table of Contents...................................................................................................2 1 Introduction ..................................................................................................... 4 1.1 ................................................................P....setisiuqerer........................4.................................. 1.2  ........................................................................................................ 4How to use this document 2  5System and software requirements ............................................................... 2.1  5Installation of the security Java environment........................................................................ 2.1.1 ................................6...........................Coignfe.ur................................................................ 2.1.2 Compile .............................................................................................................................. 6 2.2 Installation of the .Net security environment......................................................................... 6 3  ................................................................................................. 7Amigo security 3.1 7...........................................................weivr........veO................................................................ 3.1.1 ................................................se......bOejtcvi.....................................................................7 3.1.2 Principles ............................................................................................................................ 7 3.1.3 Assessment ......................................................................................................................... 8 3.2 How to develop a simple secure service for .NET: example 1 .............................................. 9 3.2.1  ...................................................................................................... 9Service implementation 3.2.2  11Registering and hosting a secured service........................................................................ 3.2.3  ....................................................................................................... 13Complete server code 3.3 How to develop a simple secure service for Java / OSGi: example 1................................. 15 3.3.1  15Definition of the service class interface ........................................................................... 3.3.2  .................................................................................................... 15Service implementation 3.3.3  ....................................................................................................... 18Complete server code 3.3.4 Service bundle metadata................................................................................................... 21 3.3.5  21Service bundle manifest ................................................................................................... 3.3.6  ............................................................................................................... 22Service activator 3.3.7  22the service with the security service..............................................................Registering  3.4  24Security Control Center......................................................................................................... 3.4.1  24Starting the Security Control Center ................................................................................ 3.4.2 Register a new user........................................................................................................... 27 3.4.3 Register a new device....................................................................................................... 27 3.4.4  ...................................................................................................... 31Register a new service 3.5  .............................................. 33How to develop a secure service client for .NET: example 1 3.5.1 Complete client code ........................................................................................................ 35 3.6 How to develop a secure  37service client for Java / OSGi: example 1 .................................. 3.6.1  ........................................................................................................ 39Complete client code 3.6.2 Cliebt bundle metadata ..................................................................................................... 41 3.6.3  42Client bundle manifest...................................................................................................... Amigo IST-2004-0041822/54  
Am2-00-400gi oI TS............tor.................  8241avitca ecivreS..................................................................42................
June 2007
4 
3/54 
 
Recommended next steps.............................................................................. 53 
3.6.4  3.7  ............................................ 44How to develop a simple secure service for .NET: example 2 3.7.1 Service implementation .................................................................................................... 44 3.7.2 Registering and hosting a secured service........................................................................ 45 3.7.3  ....................................................................................................... 47Complete server code 3.7.4  49Registering the service with the Security Control Centre ................................................ 3.8  .................................................... 50How to develop a secure service client .NET: example 2 
5    
Troubleshooting.............................................................................................54 
Confidential 
June 2007
Confidential 
1 Introduction This document is a tutorial about gives an introduction on how to use the Amigo Security Services in order to setup secure communication channels between client and services. In detail the tutorial will show how to write a secured service, how to write a client that makes use of a secured service. Further, it will explain how to authenticate a user/device within the Amigo network.
1.1 Prerequisites Amigo training blocks typically requires some Amigo related as well as non Amigo related skills or knowledge. These are given in the following:  Non Amigo related prerequisites: o The reader should be familiar with either Java or C# to easily follow the explanations. o The reader should be familiar with an integrated development environment (IDE) for the programming language that shall be used. It is suggested to use either Eclipse 3.2 (or higher) for Java or Visual Studio 2005 for C#.  related prerequisites: None. Amigo For some general information on the Amigo project please refer to the Amigo project web site atrpjocesth.tice-hrojects/.com/eup:/tpww/whto/inamightmdex..
1.2 How to use this document This document aims at providing the reader with valuable information about how to use the Amigo middleware. To this end it gives a step by step introduction where explanations are accompanied with short programming assignments. Please proceed to the document section by section and step by step and try to do the assignments. In order to save some typing, an appropriate set of template files is given that can be used to fulfill the assignments. These template files already include a programming frame that must be extend by you in order to complete the assignment. For information on how where to obtain these template files please refer to Chapter 2. If code is printed in normal text, it is shown in italic. This example shows how the method namee() cribsubsnuprinted. Entire code blocks are embedded in a box as shown below:is             using(Serviceservice =new AddService(securedService)) {                 WebServer.AddWebService(serviceLocation, service);                 Console.WriteLine("Sample service 2 running.   "+          Environment.NewLine +          "Press <return> to quit");                 Console.ReadLine();  }  
Amigo IST-2004-004182  
 
4/54 
June 2007
Confidential 
2 System and software requirements For the tutorial you need a PC compatible system with the following properties:  running Windows XP, Vista or Windows Server 2003. PC  Aworking network connection if server and client applications shall be executed on different machines. For the tutorial you need an installed version of the Java Development Kit, including the javac compiler and the jar tools (Java Version 1.5.x). If your are using Java, then the following software is needed: general package needed for Java software Java Software Development Kit. This is a development. The package is available fromtth//:pavajnus.moc..  Oscar. Oscar is a open source OSGi framework. This software is available from http://amigo.gforge.inria.fr/obr/tools/. Policy Files for the used JRE. These can be Unlimited Strength Jurisdiction  JCE downloaded from the normal JRE/JDK download pages. For JDK1.5 see for example http://java.sun.com/javase/downloads/index_jdk5.jsp, near the bottom (‘Other Downloads). Cryptography provider (e.g. BouncyCastle) if none is installed, see Install section  below. Normally, Sun’s JRE/JDK provides a default cryptography provider.
 For the .Net Security Service, following software components should be installed:  Microsoft .Net Framework 3.0 Download: ps?xsla.teiasdd/nloa/dow.comsoftorcim.www//:ptth-B0C=140C3miFaIDly F857-4A14-83F5-25634C3BF043&displaylang=en   HomeFx Security Microsoft Download: inrirge./frsa.frhttg/ofsp/:/c76poomntneip.zwod/aolnhp.d13/p  Management Console Microsoft Download: .padlowndos/frr/nenopmoc/3713/phtps:htaif.i.rnroeg//fgt.zip  A set of template files have been prepared in order to help you running the practical parts of this tutorial. It is recommended that you use these templates. A package that includes this template along with some other files can be downloaded from https://gforge.inria.fr/frs/?group_at a path names that are referred to in this id=160. Note th ll document are relative to the folder the package has been extracted to. Note further, that there is a separate directory names “Code_Solution” whichcontains the complete programs.
2.1 Installation of the security Java environment Setup a default Amigo deployment environment without any export and binding factories. Install the ‘amigo_security’ bundle. Installation instructions for the policy files are provided in the download archive. How to install BouncyCastle is described under the following link: http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation The short form is: 1. Go to http://www.bouncycastle.org/latest_releases.html and download the release specific for the JVM version you have, e.g. bcprov-jdk15-136.jar
Amigo IST-2004-004182  
5/54 
June 2007
Confidential 
2. Copy this file to <JDK_HOME>/jre/lib/ext - This folder contains the default global libraries for your JVM. If you have a separate JRE installed copy it there as well: <JRE HOME>/lib/ext _ Other than suggested in various installation instructions; DO NOT EDIT the file <JDK_HOME>/jre/lib/security/java.security.  
2.1.1 Configure Since the implementation of the security framework is compatible with the storage directory structure of the .Net counterpart, a system property named ‘amigo-security-persisting-dir’ should be set up. This is preferably done in the ‘system.properties’ of the Oscar distribution, e.g. amigo-security-persisting-dir=C:\\Documents and Settings\\%USER%\\Local Settings\\ApplicationData\\HomeFx\\Security\\ 
2.1.2 Compile Compile & build using either ‘build.xml’ (JRE >= 5.0) or ‘build-jre13.xml’. Note that in the build target ‘CompileWSDL’ a HTTP proxy is set which should be changed or removed according to the network configuration. The output files of the build process are stored in a directory which can be set in the ‘build.properties’ file under the property name ‘amigo.repository’. An Oscar repository file at the specified location will be automatically created or updated. When the projects are checked out using Eclipse, there are some compile errors initially. This is due to the fact that some of the classes are generated from WSDL descriptions (e.g. the proxy of the EMIC security service). That is why, after building the projects (using one of the build files), they should be refreshed (select the corresponding project in the Eclipse workspace and press F5).
2.2 Installation of the .Net security environment Installing the needed .Net components is straight-forward. After the .Net Framework 3.0 has been installed, run the setup files from the two download packages. Note, that administrative privileges are needed in order to set up and run the EMIC security service and the EMIC management console. After installation, the program menu ‘EMIC - Microsoft is created. From there, you can start the ‘Security Control Center’ and the ‘Device Registrar’ applications. In addition, the solution with the .Net version of the presented examples in this tutorial can be accessed under the menu entry ‘HomeFx Security.sln’. The management console can be started from its installation folder, e.g. ‘C:\Program Files\EMIC - Microsoft\Management Console\Management Console Application’.   
Amigo IST-2004-004182  
 
6/54 
June 2007
3 Amigo security
3.1 Overview
Confidential 
3.1.1 Objectives The Amigo security framework is responsible of securing access to the services in the home. The Amigo security model is based on the Kerberos protocol, with shared secrets to establish mutual authentication. The security service is the mutually trusted Kerberos authority and acts as a trust broker between users and services inside the home and grants or denies access to services. The employed access control scheme in Amigo is role based with few, well-known user, device, and service roles, thus enabling non-technical users to setup a secure system easily. As usual with Kerberos, access is granted or denied centrally by the security service and is relayed to users and services with encrypted tickets.
3.1.2 Principles Accordingly, the implementation of Amigo security is split into two major components: the security service, which needs to be deployed in the home to enable secure use of services, and the security API that enables secure communication with the security service and between clients and services in the home. The security service as such is, from the service developer’s point of view, a fixed service that is only communicated with via the security API. Thus, the security service is irrelevant for the purposes of this document. The security API is available both as a Java OSGi bundle and as a .Net library, and uses lower level middleware functionality like WS-Discovery. Before we go into more details though, it will help to quickly recapitulate the principles of Kerberos [Kerberos]. In Kerberos, security and privacy are achieved via a mutually trusted authority that shares a secret – a key for a symmetric cipher like AES, Triple DES, or Blowfish – with each of the participants of the security scheme. Using some coarse simplification1, a typical exchange that enables secure and authorized of a client to a service has the following steps: 1. The client C requests a ticket granting ticket from the authority A; this request is sent unencrypted. 2. If the client is known, then A sends a ticket granting ticket TGT, which is encrypted with the secret KC, which is known only to C and A. 3. C decrypts the TGT with KC, which proves that it really came from A (because only A and C know KC). 4. C uses information from TGT to create a ticket request for the service S that it wants to use and sends it to A. 5. A checks that the ticket request has been sent from C. It determines if A has permission to use S. 6. A sends a ticket TS to C, which contains information that is encrypted with KS, the key that is shared between A and S. 7. C uses TS to prove to S that is has A’s authorization to access S. 8. S attempts to decrypt TS with KS, and if it does so successfully, grants access to C.
                                               1This simplification is here only for didactic purposes; the implementation does not use this simplification. Amigo IST-2004-0041827/54  
June 2007
Confidential 
In addition to this protocol, we need a way to initially establish the keys that are shared between the C (or S) and A. This is part of the registration procedure, which is covered in the subsequent sections. In the remainder of this chapter, we will discuss how to use the .Net and Java version of the security API to implement and consume secure services. Note that .NET and Java implementation use the same object model so that the principles are the same for both domains.
3.1.3 Assessment The Amigo security libraries enable authenticated and authorized service use in the Amigo home, based on a simple, role-based, security concept. Using the API presented in this chapter, use of these mechanisms is significantly simplified, because the security protocol is abstracted into a comprehensive API that supports easy service and client implementation.
A
 
mgi oI TS-2004-040182  
8/54 
June 2007
Confidential 
3.2 How to develop a simple secure service for .NET: example 1 In the following, we will describe the necessary steps to develop a secure Amigo service. We do this by walking through the code sample that is installed as part of installing the Amigo security package. All relevant files for the .NET example are found in the directory tree starting at “Using Amigo Security Services\Code\DOT_NET\”. If you are using Visual Studio, then double-click on the Microsoft Visual Studio Solution project file “Using Amigo Security Services\Code\DOT_NET\HomeFx Security.sln” to load the entire sample environment into Visual Studio.
3.2.1 Service implementation As a first step, we are going to develop a secured service. This is done by adding secured methods to a web service. The appropriate templates are in “Using Amigo Security _ p es\Service”. Services\Code\DOT NET\Sam l The following C# example shows the code that is necessary to implement a web service with secured methods. Hosting, registration, and persisting are handled in the next section. Detailed API documentation is available from the help files installed with the security package.  // ==++== // // // Copyright (c) 2006 Microsoft Corporation. All rights reserved. // // The use and distribution terms for this software are contained in the // file named license.txt, which can be found in the root of this // distribution. // By using this software in any fashion, you are agreeing to be bound by // the terms of this license. // // You must not remove this notice, or any other, from this software. // // // ==--==  usingSystem; usingSystem.Web.Services; usingEMIC.HomeFx.Security; usingEMIC.WSDiscovery.Server;  These declarations import the necessary namespaces – note that we are also importing the EMIC.WSDiscovery.Server namespace, which contains the .Net implementation of WS-Discovery. namespaceSecuredServiceSample1 {  [Scope("urn:amigo-security-sample")]  [Type("sample-service1,urn:amigo-security-sample1")] " "     public class Service: EMIC.HomeFx.Security.Service{  The service implementations inherits from EMIC.HomeFx.Security.Service, which contains the necessary primitives to validate incoming requests. EMIC.HomeFx.Security.Service in turn inherits from EMIC.WSDiscovery.Server.Discoverable service, which enables automatic discovery of our service. The Type and Scope attribute specify the WS-Discovery type and scope for this service. First, let us define the constructor of our Service. The C# code is: Amigo IST-2004-0041829/54  
June 2007
Confidential 
        publicService(EMIC.HomeFx.Security.ServicesecuredService)  :base(securedService){}   The only means of creating an EMIC.HomeFx.Security.Service is by copying from another instance of that class. Such an instance can be created by either registering a service with the security authority or by deserializing a persisted instance. Both possibilities are discussed in the next section. We now define our first secured method. As it is a web service, its declaration must be prepended with[WebMethod]:  [WebMethod]         public SecuredResult<string> Hello(SecuredRequest<string> request) {  A secure service has one of several web methods, which will be reachable once the service is hosted by the web server. In the current version, security has to be added explicitly to the service behaviour as shown in the example above. For this, the web method accepts one generic argument of type SecuredRequest<T0, T2, …, Tn>. The types T0,…,Tn are instantiated with the actual types of the unsecured version of the web method. Currently, up to five arguments are supported. Return type of the function is SecuredResult<T>, where T is the return type of the unsecured function.             return   ValidateAndDispatchRequest<string,string>(request, Hello);  } Inside the secured function, the request is dispatched to the unsecured, private version of the secured function via the ValidateAndDispatchRequest<T, T0, …, Tn> member function of EMIC.HomeFx.Security.Service. Based on the result of the validation of the incoming secured request, this function will either decrypt the encrypted parameters, pass them to the unsecured function, and return the encrypted result, or – in case of an unsuccessful validation – will return an error result. In either case, the return value of this dispatched function can directly be passed to the invoker of the secure web method.          private stringHello(stringname) {             return String.Format("Hello {0} ({1}@{2})!",  name,  InvocationContext.User ==null?"<unknown>":  InvocationContext.User.ToString(),  InvocationContext.Device);  }  } }  The unsecured version of the function can assume that the caller has been successfully authenticated and authorized to use the service. If necessary, access to the authentication information, i.e., identity of the calling user and device, are available via the InvocationContex.User and InvocationContext.Device properties. This finishes the code of our first simple secured service. For your convenience, the entire secure service example code in C# is given below: usingSystem; usingSystem.Web.Services; usingEMIC.HomeFx.Security; usingEMIC.WSDiscovery.Server;  namespaceSecuredServiceSample1 {  [Scope("urn:amigo-security-sample")] Amigo IST-2004-004182  
10/54 
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents