44
Java Security Web Services Security (Overview) Lecture 9

Java Security Web Services Security (Overview)

  • Upload
    zulema

  • View
    52

  • Download
    1

Embed Size (px)

DESCRIPTION

Java Security Web Services Security (Overview). Lecture 9. Java 2 Cryptography. Java provides API + SPI for crypto functions Java Cryptography Architecture Security related core classes Access control and cryptography Java Cryptography Extension Other core classes - PowerPoint PPT Presentation

Citation preview

Page 1: Java Security  Web Services Security (Overview)

Java Security Web Services Security

(Overview)

Lecture 9

Page 2: Java Security  Web Services Security (Overview)

Java 2 Cryptography

Java provides API + SPI for crypto functions Java Cryptography Architecture

Security related core classes Access control and cryptography

Java Cryptography Extension Other core classes

Message digest, digital signatures, certificate management Key exchange, MAC

Page 3: Java Security  Web Services Security (Overview)

JCA + JCE Engine

Abstract cryptographic service: E.g., message digest, digital signatures To provide cryptographic operations To generate or supply the crypto material To generate and manage data objects (certificates or keys

– keystores) Use instances of engine class for crypto operations

Algorithm Implementation of an engine: Eg. MD5 for MessageDigest

Provider (set of) packages that supply concrete implementation of a

subset of the cryptographic services (DS, MD, etc.)

Page 4: Java Security  Web Services Security (Overview)

JCA + JCE Principles

Provider based architecture Vendors can register

implementations of algorithms Providers can be configured

declaratively so the application code does not need to change

Allows different implementations to be found at runtime

Implementation independenceImplementation independence Algorithm IndependenceAlgorithm Independence

Engine Class SPI class implemented by Ps

Implementations expose the same API

MessageDigest.getIntance(MD5)

Page 5: Java Security  Web Services Security (Overview)

JCA + JCE Principles

Algorithm ExtensibilityAlgorithm Extensibility

Implementation interoperabilityImplementation interoperability

Various implementation can work with one another Use one another’s keys Verify one another’s messages

New algorithms can be easily plugged in Has to be compliant with the

MessageDigest API

Page 6: Java Security  Web Services Security (Overview)

Providers

SPI is Key to pluggability, extensibility and module

independence It is a set of Java-language interfaces and abstract

classes for cryptographic services A Provider is a pluggable module

Provides concrete implementations of some SPI methods

java.security and javax.crypto and their subpackages contain many SPI interfaces that JCA and JCE providers can implement

Page 7: Java Security  Web Services Security (Overview)

Providers Implementation

Concept of provider class Provider class in java.security – abstract class Must be subclassed by providers Constructor sets the values to help look up algorithms main provider – if it implements all the SPI methods

Every provider should have one master class –must have a default constructor so as to be loaded when JVM starts up

Property/value (SPI label, corresponding class that implements it)

For cryptographic service getInstance() of the corresponding Engine class is

called, optionally Provider is indicated

Page 8: Java Security  Web Services Security (Overview)

Providers getInstance() relies on java.security.Security class to search the registered providers in

java.security file

security.provider.1=com.ibm.jsse.IBMJSSEProvider security.provider.2=com.ibm.crypto.provider.IBMJCE security.provider.3=com.ibm.security.jgss.IBMJGSSProvider security.provider.4=com.ibm.security.cert.IBMCertPath

Page 9: Java Security  Web Services Security (Overview)

Configuration and Management

Copy the provider pakckage JAR file in application/boot/extension class path

Configure the Provider Static: in java.security file; order is important

Effective in Java runtime – read once. Dynamic: addProvider() insertProvederAt()

To change position – removeProvider() then add Need permission “insertProvider.name”

Page 10: Java Security  Web Services Security (Overview)

Engine and SPI

Engine classes are the interfaces between the user code and the implementations

Implementations are found at runtime

Page 11: Java Security  Web Services Security (Overview)

Engine and SPI

The engine class calls the SPI class methods SPI class method names begins with “engine” Implementation of abstract SPI done by providers

Encapsulated as private field

Page 12: Java Security  Web Services Security (Overview)
Page 13: Java Security  Web Services Security (Overview)

Enterprise Security for Web Services XML

Simplicity and flexibility Facilitates B2B messaging Security is a big concern

Structured semantics and schema-driven nature

XML security technologies are available Encryption

Elements, sections Digital signatures

All or parts – by one or more entities Access control

Page 14: Java Security  Web Services Security (Overview)

Web Service

Web service Is a an interface that describes a collection of

network-accessible operations based on open internet standards

Potential to enable application integration at a higher level of the protocol stack based on Web Services standards

XML Simple Object Access Protocol (SOAP) Web Services Description Language (WSDL) Universal Description, Discovery and Integration (UDDI)

Page 15: Java Security  Web Services Security (Overview)

XML

XML Structured semantics and schema driven nature Policies can be expressed in XML by orgs for

Changed back to platform specific enforcement mechanism

Encryptions can be employed Sections, all parts signed, etc.

Trading Partner Agreements, SAML and XACML

Page 16: Java Security  Web Services Security (Overview)

SOAP

Simple, lightweight and extensible XML-based mechanism for exchanging structured data between network applications

Consists of: An envelop

What is in the message and who should deal with it A set of encoding rules

Serialization mechanism that can be used to exchange instances of application defined data types

Can be used in (re-enveloped) with other protocols such as HTTP

Page 17: Java Security  Web Services Security (Overview)

SOAP

It supports modular architecture Allows defining the following in separate documents

WS Addressing Specification (WS-Addressing) WS Security Specification (WS-Security)

A SOAP envelope is defined in Envelope XML element

Consists of two parts: Header: adds features to the messages

Meta information can be added to the message E.g., transaction IDs, message routing information,

message security Body: mechanism for exchanging information

Page 18: Java Security  Web Services Security (Overview)

Security Technologies XML Signature

Validation of the messages and non-repudiation SAML

AuthM + Security Srvices ML Authentication + Authorization profile information

Common language for sharing of security services between companies for B2B/B2C transacrtions

XML Encryption Encrypting of XML fragments

WS-Security Set of SOAP extensions that can be used when building

WS to implement integrity and confidentiality

Page 19: Java Security  Web Services Security (Overview)

XML Signature

IETF and W3C standard for digitally signing all or some part of the XML document

XML Signature Is itself a piece of XML – defined by a schema Contain references – URIs – to what is being

signed URIs – within the document or external to it

A single XML document may have multiple signatures

Page 20: Java Security  Web Services Security (Overview)

XML Signature Structure XML Signature contains four major

items: A set of pointers (references) to

things to be signed The actual signature (Optional) The key (or a way to look

up the key) for verifying the signature (Optional) An Object tag that can

contain miscellaneous items not included in the first three items

<Signature ID?> <SignedInfo>

(CanonicalizationMethod) (SignatureMethod)(<Reference (URI=)? >

(Transforms)? (DigestMethod) (DigestValue)

</Reference>)+ </SignedInfo> (SignatureValue) (KeyInfo)? (Object ID?)*

</Signature>

<Signature ID?> <SignedInfo>

(CanonicalizationMethod) (SignatureMethod)(<Reference (URI=)? >

(Transforms)? (DigestMethod) (DigestValue)

</Reference>)+ </SignedInfo> (SignatureValue) (KeyInfo)? (Object ID?)*

</Signature>

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <Reference URI="http://www.foo.com/secureDocument.html" /> </SignedInfo> <SignatureValue>...</SignatureValue> <KeyInfo>... </KeyInfo> </Signature>

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <Reference URI="http://www.foo.com/secureDocument.html" /> </SignedInfo> <SignatureValue>...</SignatureValue> <KeyInfo>... </KeyInfo> </Signature>

Page 21: Java Security  Web Services Security (Overview)

XML Signature:Enveloping Signature

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <Reference URI="#111" /> </SignedInfo>

<SignatureValue>...</SignatureValue> <KeyInfo>...</KeyInfo> <Object> <SignedItem id="111">Stuff to be

signed</SignedItem> </Object>

</Signature>

Page 22: Java Security  Web Services Security (Overview)

XML Signature:Enveloped Signature

<PurchaseOrder id="po1"> <SKU>125356</SKU> <Quantity>17</Quantity> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">

<SignedInfo> <Reference URI="#po1" /> </SignedInfo>

<SignatureValue>...</SignatureValue> <KeyInfo>...</KeyInfo>

</Signature> </PurchaseOrder>

Parent element

Page 23: Java Security  Web Services Security (Overview)

XML Signature:Detached Signature

<PurchaseOrderDocument> <PurchaseOrder id="po1">

<SKU>12366</SKU> <Quantity>17</Quantity>

</PurchaseOrder> <Signature xmlns=

"http://www.w3.org/2000/09/xmldsig#">

<SignedInfo> <Reference URI="#po1" />

</SignedInfo><SignatureValue>...</

SignatureValue><KeyInfo>...</KeyInfo>

</Signature> </PurchaseOrderDocument>

Page 24: Java Security  Web Services Security (Overview)

XML Signature:Detached Signature

Can also reference external source

<Signature xmlns= "http://www.w3.org/2000/09/xmldsig#"> <SignedInfo>

<Reference URI="http://www.foo.com/Lion.jpg" />

</SignedInfo> <SignatureValue>...</SignatureValue> <KeyInfo>...</KeyInfo>

</Signature>

Page 25: Java Security  Web Services Security (Overview)

XML Encryption Structure

<EncryptedData Id? Type? MimeType? Encoding?> <EncryptionMethod/>? <ds:KeyInfo>

<EncryptedKey>? <AgreementMethod>? <ds:KeyName>? <ds:RetrievalMethod>? <ds:*>?

</ds:KeyInfo>? <CipherData>

<CipherValue>? <CipherReference URI?>?

</CipherData> <EncryptionProperties>?

</EncryptedData>

- Could encompass an entire document of other XML structure (similar to Enveloping structure)

- Could contain a pointer to a detached resource

Page 26: Java Security  Web Services Security (Overview)

XML Encryption: Example

<Employee> <Name>Dave Remy</Name> <SocialSecurityNumber>

<EncryptedData Type= "http://www.w3.org/2000/09/xmldsig#content">

<EncryptionMethod Algorithm=". . ."><CipherData><CipherValue>. . .</CipherValue></CipherData>

</EncryptedData> </SocialSecurityNumber> <Salary>

<EncryptedData Type="http://www.w3.org/2000/09/xmldsig#content">

<EncryptionMethod Algorithm=". . ."> <CipherData><CipherValue>. . .</CipherValue></CipherData>

</EncryptedData> </Salary>

</Employee>

Page 27: Java Security  Web Services Security (Overview)

XML Encryption: Example<Employee>

<Name>Dave Remy</Name> <SocialSecurityNumber>

<EncryptedData id="socsecnum" Type="http://www.w3.org/2000/09/ xmldsig#content">

<EncryptionMethod Algorithm=". . ." /> <CipherData><CipherValue>. . .</CipherValue></CipherData>

</EncryptedData> </SocialSecurityNumber> <Salary>

<EncryptedData id="salary" Type="http://www.w3.org/2000/09/ xmldsig#content">

<EncryptionMethod Algorithm=". . ."> <CipherData><CipherValue>. . .</CipherValue></CipherData>

</EncryptedData> </Salary> <EncryptedKey>

<EncryptionMethod Algorithm=". . ." /> <CipherData> <CipherValue>. . .</CipherValue> </CipherData> <ReferenceList>

<DataReference URI="#socsecnum" /> <DataReference URI="#salary" /> </ReferenceList>

</EncryptedKey> </Employee>

Page 28: Java Security  Web Services Security (Overview)

SAML

Enables portable identities and the assertions that these identities want to make Assertion: authentication; authorization

SAML is important for WS is a standard XML format – all normal XML tools apply to

SAML Includes a standard message exchange protocol Specifies the rules for how it is transported – making

interoperability explicit at the specification level Expression of security in the form of assertions about

subjects (different from Certification authority based approach) – facilitated Single-Sign ON

Page 29: Java Security  Web Services Security (Overview)

SAML - scenario

Federated identity

Page 30: Java Security  Web Services Security (Overview)

SAML

Defines three types of assertions Authentication

States that a particular authentication authority has authenticated the subject Using a particular process At a particular time (+ validity)

Authorization States that a particular authority has granted/denied

permissions on particular resource (+time) Attributes

Provides qualifying information about either an authentication or authorization assertion

Page 31: Java Security  Web Services Security (Overview)

SAML – how it works

Three XML based mechanisms and their relationship

XML schema + definition

Rules on using assertions

Page 32: Java Security  Web Services Security (Overview)

SAML Example

<saml:Assertion> MajorVersion="1" MinorVersion="0" AssertionID="192.168.0.1.12345" Issuer="Company.com" IssueInstant="2004-01-21T10:02:00Z"> <saml:Conditions> NotBefore="2004-01-21T10:02:00Z" NotAfter="2004-01-21T10:09:00Z" /> <saml:AuthenticationStatement> AuthenticationMethod="password" AuthenticationInstant="2004-01-21T10:02:00Z"> <saml:Subject> <saml:NameIdentifier SecurityDomain="Company.com" Name="jothy" /> </saml:Subject> </saml:AuthenticationStatement></saml:Assertion>

Page 33: Java Security  Web Services Security (Overview)

SAML protocol

SAML assertions are sent to the authentication and authorization authorities

Page 34: Java Security  Web Services Security (Overview)

SAML Authorization/Attribute Assertions

<saml:Assertion ...> <saml:AttributeStatement> <saml:Subject>...</saml:Subject> <saml:Attribute AttributeName="PaidStatus" AttributeNamespace="http://smithco.com"> <saml:AttributeValue> PaidUp </saml:AttributeValue> </saml:Attribute> <saml:Attribute AttributeName="CreditLimit" AttributeNamespace="http://smithco.com"> <saml:AttributeValue xsi:type="my:type"> <my:amount currency="USD">500.00 </my:amount> </saml:AttributeValue> </saml:Attribute> </saml:AttributeStatement></saml:Assertion>

<saml:Assertion ...> <saml:AuthorizationStatement Decision="Permit" Resource="http://jonesco.com/doit.cgi"> <saml:Subject>...</saml:Subject> <saml:Action Namespace="urn:oasis:names:tc:SAML:1.0:action:rwedc">Execute </saml:Action> </saml:AuthorizationStatement></saml:Assertion>

Page 35: Java Security  Web Services Security (Overview)

SAML Architecture

Page 36: Java Security  Web Services Security (Overview)

SAML Protocol

Authentication Query<samlp:Request

MajorVersion="1" MinorVersion="0" RequestID="128.14.234.20.12345678"

IssueInstant="2001-12-03T10:02:00Z"> <samlp:RespondWith>saml:AuthenticationStatement</samlp:RespondWith>

<ds:Signature>...</ds:Signature> <samlp:AuthenticationQuery>

<saml:Subject> <saml:NameIdentifier

SecurityDomain="Company.com" Name="jothy" />

</saml:Subject> </samlp:AuthenticationQuery>

</samlp:Request>

Page 37: Java Security  Web Services Security (Overview)

SAML Protocol

Attribute Query

<samlp:Request ... > <samlp:AttributeQuery> <saml:Subject>...</saml:Subject> <saml:AttributeDesignator AttributeName="PaidStatus" AttributeNamespace="http://smithco.com"/> </samlp:AttributeQuery></samlp:Request>

Page 38: Java Security  Web Services Security (Overview)

SAML Protocol

Authorization Assertion<samlp:Request ...> <samlp:AuthorizationDecisionQuery Resource="http://ChosenTravel.com/reserve_hotel.cgi"> <saml:Subject> <saml:NameIdentifier SecurityDomain="Company.com" Name="joeuser" /> </saml:Subject> <saml:Actions Namespace="urn:oasis:names:tc:SAML: 1.0:action:rwedc"> <saml:Action>Execute</saml:Action> </saml:Actions> <saml:Evidence> <saml:Assertion>...</saml:Assertion> </saml:Evidence> </samlp:AuthorizationDecisionQuery></samlp:Request>

Page 39: Java Security  Web Services Security (Overview)

SAML Binding Requires SOAP over HTTP

as one binding SOAP Binding

SAML information is contained inside the SOAP

SAML Profile Describes how SAML

assertions are embedded into and extracted from a framework/protocol Browser profile of SAML SAML profile SOAP WS-Security

- Binding: is a mapping of SAML request/response message exchanges into standard comm protocols;

- to transport SAML messages to SAML authorities

Page 40: Java Security  Web Services Security (Overview)

WS-Security

Focuses on applying existing security technologies to SOAP message

X.509 certificates SAML assertions XML Signatures XML Encryption

GOAL: Secure the SOAP No matter where it goes No matter how long it lives

Page 41: Java Security  Web Services Security (Overview)

HTTP Transport Security Versus Message Security

HTTP Transport Layer Security Authentication at the time secure pipe is created Confidentiality/Integrity in the pipe only

Page 42: Java Security  Web Services Security (Overview)

HTTP-TSPros and Cons

Pros

Mature: Tried and true Support: Supported by

most servers and clients Understood: Understood

by most system administrators

Simpler: Generally simpler than message-level security alternatives

Cons

Point to Point: Messages are in the clear after reaching SSL endpoint

Waypoint visibility: Cannot have partial visibility into the message

Granularity: Cannot have different security for messages in and messages out

Transport dependent: Applies only to HTTP

Page 43: Java Security  Web Services Security (Overview)

Message SecurityPros and Cons

Pros

Persistent: Allows the message to be self-protecting

Selective: Portions of the message can be secured to different parties

Flexible: Different security policy can be applied to request and response - Transport independent

Cons

Immature: standard, tools Complex: encompasses many

other standards including XML Encryption, XML Signature, X.509 certificates, and many more

Page 44: Java Security  Web Services Security (Overview)

Web Services Security Stack