cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > XML Key Management Service (XKMS)
Date Fri, 03 May 2013 15:26:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/XML+Key+Management+Service+%28XKMS%29">XML
Key Management Service (XKMS)</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~ashakirin">Andrei
Shakirin</a>
    </h4>
        <br/>
                         <h4>Changes (10)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. XKMS Specification <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >W3C specifies <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">standard</span>
protocol to distribute and register public keys, certificates and CAs that can be used for
XML-based cryptography, including signature and encryption: [XML Key Management Specification|http://www.w3.org/TR/xkms2/]
(XKMS 2.0). <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">XKMS
can be used as standardized frontend to Public Key Infrastructure (PKI).</span> <br></td></tr>
            <tr><td class="diff-changed-lines" >The XKMS Specification comprises
two parts – the XML Key Information Service Specification (XKISS) describing the runtime
aspects of key lookup and certificate validation and the XML Key Registration Service Specification
(XKRSS) describing the administrative aspects of registering, renewing, revoking and recovering
certificates. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">XKMS
Service implements both parts of specification.</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">XKMS
Service implements both parts of specification. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">XKMS
SOAP interface can be used as standard frontend to access Public Key Infrastructure (PKI).
Using XKMS message encryption scenario  message encryption picture will change in following
way: <br> <br>!classic-message-encryption-PKI-XKMS.jpg! <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. XKMS Design <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >!XKMS-cxf.jpg! <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">XKMS
Service exposes standardized XKISS and XKRSS SOAP interfaces.  <br>Input and output
parameters as well as samples of SOAP messages are described in the specification [XKMS 2.0|http://www.w3.org/TR/xkms2/].
 <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">XKMS
Service exposes SOAP interface specified in [XKMS 2.0|http://www.w3.org/TR/xkms2/].  <br></td></tr>
            <tr><td class="diff-changed-lines" >XKMS implementation <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">supports</span>
<span class="diff-added-words"style="background-color: #dfd;">realizes</span>
chain of responsibility design pattern [chain-of-responsibility | http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern].
<br></td></tr>
            <tr><td class="diff-unchanged" >Each XKMS operation defines handler
interface and provides one or more implementations of this interface. Handler implementations
are connected into chain.  <br>Operation implementation invokes handlers one after another
from pre-configured chain until either all handlers will be processed or critical error will
occur.  <br></td></tr>
            <tr><td class="diff-changed-lines" >This design <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">decision</span>
makes XKMS internal implementation quite flexible: it is easy to add/remove handlers, change
their order, introduce handlers supporting new backends, etc. <br></td></tr>
            <tr><td class="diff-unchanged" >For example certificate can be searched
firstly in the LDAP repository by LDAP lookup handler and, if it is not found there, additionally
looked in remote PKI using appropriate lookup handler. Logic validation operation is organized
in chain is well: first validation handler checks format and expire date of X509 certificate,
next one checks certificate trust chain. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Currently
XKMS Service supports simple file based and LDAP backends. <br>Sample spring configuration
of XKMS handlers for file backend looks like: <br>{code:xml} <br>   &lt;bean
id=&quot;dateValidator&quot; class=&quot;org.apache.cxf.xkms.x509.validator.DateValidator&quot;
/&gt; <br> <br>   &lt;bean id=&quot;x509FileLocator&quot; class=&quot;org.apache.cxf.xkms.x509.locator.FileLocator&quot;&gt;
<br>      &lt;constructor-arg value=&quot;../conf/certs&quot; /&gt;
<br>   &lt;/bean&gt; <br> <br>   &lt;bean id=&quot;fileRegisterHandler&quot;
class=&quot;org.apache.cxf.xkms.x509.handlers.FileRegisterHandler&quot;&gt; <br>
     &lt;constructor-arg value=&quot;../conf/certs&quot; /&gt; <br>
  &lt;/bean&gt; <br> <br>   &lt;bean id=&quot;xkmsProviderBean&quot;
class=&quot;org.apache.cxf.xkms.service.XKMSService&quot;&gt; <br>     
&lt;property name=&quot;validators&quot;&gt; <br>         &lt;list&gt;
<br>            &lt;ref bean=&quot;dateValidator&quot; /&gt; <br>
        &lt;/list&gt; <br>      &lt;/property&gt; <br>      &lt;property
name=&quot;locators&quot;&gt; <br>         &lt;list&gt; <br>
           &lt;ref bean=&quot;x509FileLocator&quot; /&gt; <br>     
   &lt;/list&gt; <br>      &lt;/property&gt; <br>      &lt;property
name=&quot;keyRegisterHandlers&quot;&gt; <br>         &lt;list&gt;
<br>            &lt;ref bean=&quot;fileRegisterHandler&quot; /&gt; <br>
        &lt;/list&gt; <br>      &lt;/property&gt; <br>   &lt;/bean&gt;
<br> <br>   &lt;jaxws:endpoint id=&quot;XKMSService&quot; xmlns:serviceNamespace=&quot;http://www.w3.org/2002/03/xkms#wsdl&quot;
<br>      serviceName=&quot;serviceNamespace:XKMSService&quot; endpointName=&quot;serviceNamespace:XKMSPort&quot;
<br>      implementor=&quot;#xkmsProviderBean&quot; address=&quot;/XKMS&quot;&gt;
<br>   &lt;/jaxws:endpoint&gt; <br>{code} <br> <br>h4. Integration
XKMS client into CXF security. <br> <br>XKMS client can be integrated into CXF
and WSS4J using custom Crypto provider implementation. In this case XKMS service will be automatically
invoked when WSS4J requires or validates certificate. Details are described in [blog|http://ashakirin.blogspot.de/2013/04/cxf-security-getting-certificates-from.html].
<br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h4. Data Formats <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >| TooManyResponses| The request resulted
in the number of responses that exceeded limit determined by the service. | <br>| TimeInstantNotSupported|
The receiver has refused the operation because it does not support the TimeInstant element.
| <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br> <br>h4. Deployment <br> <br>XKMS Service can be deployed into
web and OSGi containers. It was tested with Tomcat and Karaf. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="XMLKeyManagementService%28XKMS%29-XMLKeyManagementService%28XKMS%29"></a>XML
Key Management Service (XKMS)</h1>

<h2><a name="XMLKeyManagementService%28XKMS%29-Usecase"></a>Use case</h2>

<p>CXF security uses asymmetric algorithms for different purposes: encryption of symmetric
keys and payloads, signing security tokens and messages, proof of possession.<br/>
Normally the public keys (in form of X509 certificates) are stored in java keystores.</p>

<p>For example, if sender encrypts the message payload sending to the receiver, he should
have access to receiver certificate saved in local keystore. <br/>
The sender uses this certificate for message encryption and receiver decrypts request with
corresponded own private key:</p>


<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/31820321/classic-message-encryption.jpg?version=1&amp;modificationDate=1367436712000"
style="border: 0px solid black" /></span></p>


<p>Seems to be OK? Imagine now that you have production environment with 100 different
clients of this service and service certificate is expired. You should reissue and replace
certificate in ALL client keystores! Even more, if keystores are packaged into war files or
OSGi bundles – they should be unpackaged and updated. Not really acceptable for enterprise
environments.</p>

<p>Therefore large service landscapes support central certificates management. It means
that X509 certificates are not stored locally in keystores, but are provided and administrated
centrally.</p>

<p>Normally it is a responsibility of <a href="http://en.wikipedia.org/wiki/Public-key_infrastructure"
class="external-link" rel="nofollow">Public Key Infrastructure</a> (PKI) established
in organization. PKI is responsible to create, manage, store, distribute, synchronize and
revoke public certificates and certification authorities (CAs).</p>

<h2><a name="XMLKeyManagementService%28XKMS%29-XKMSSpecification"></a>XKMS
Specification</h2>

<p>W3C specifies protocol to distribute and register public keys, certificates and CAs
that can be used for XML-based cryptography, including signature and encryption: <a href="http://www.w3.org/TR/xkms2/"
class="external-link" rel="nofollow">XML Key Management Specification</a> (XKMS 2.0).
<br/>
The XKMS Specification comprises two parts – the XML Key Information Service Specification
(XKISS) describing the runtime aspects of key lookup and certificate validation and the XML
Key Registration Service Specification (XKRSS) describing the administrative aspects of registering,
renewing, revoking and recovering certificates. <br/>
XKMS Service implements both parts of specification.</p>

<p>XKMS SOAP interface can be used as standard frontend to access Public Key Infrastructure
(PKI). Using XKMS message encryption scenario  message encryption picture will change in following
way:</p>

<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/31820321/classic-message-encryption-PKI-XKMS.jpg?version=1&amp;modificationDate=1367593577737"
style="border: 0px solid black" /></span></p>

<h3><a name="XMLKeyManagementService%28XKMS%29-XKMSDesign"></a>XKMS Design</h3>

<p>Internal structure of XKMS service is represented on the following figure:</p>

<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/31820321/XKMS-cxf.jpg?version=1&amp;modificationDate=1367512345000"
style="border: 0px solid black" /></span></p>

<p>XKMS Service exposes SOAP interface specified in <a href="http://www.w3.org/TR/xkms2/"
class="external-link" rel="nofollow">XKMS 2.0</a>. <br/>
XKMS implementation realizes chain of responsibility design pattern <a href="http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern"
class="external-link" rel="nofollow">chain-of-responsibility </a>. <br/>
Each XKMS operation defines handler interface and provides one or more implementations of
this interface. Handler implementations are connected into chain. <br/>
Operation implementation invokes handlers one after another from pre-configured chain until
either all handlers will be processed or critical error will occur. <br/>
This design makes XKMS internal implementation quite flexible: it is easy to add/remove handlers,
change their order, introduce handlers supporting new backends, etc. <br/>
For example certificate can be searched firstly in the LDAP repository by LDAP lookup handler
and, if it is not found there, additionally looked in remote PKI using appropriate lookup
handler. Logic validation operation is organized in chain is well: first validation handler
checks format and expire date of X509 certificate, next one checks certificate trust chain.</p>

<p>Currently XKMS Service supports simple file based and LDAP backends.<br/>
Sample spring configuration of XKMS handlers for file backend looks like:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
   <span class="code-tag">&lt;bean id=<span class="code-quote">"dateValidator"</span>
class=<span class="code-quote">"org.apache.cxf.xkms.x509.validator.DateValidator"</span>
/&gt;</span>

   <span class="code-tag">&lt;bean id=<span class="code-quote">"x509FileLocator"</span>
class=<span class="code-quote">"org.apache.cxf.xkms.x509.locator.FileLocator"</span>&gt;</span>
      <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"../conf/certs"</span>
/&gt;</span>
   <span class="code-tag">&lt;/bean&gt;</span>

   <span class="code-tag">&lt;bean id=<span class="code-quote">"fileRegisterHandler"</span>
class=<span class="code-quote">"org.apache.cxf.xkms.x509.handlers.FileRegisterHandler"</span>&gt;</span>
      <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"../conf/certs"</span>
/&gt;</span>
   <span class="code-tag">&lt;/bean&gt;</span>

   <span class="code-tag">&lt;bean id=<span class="code-quote">"xkmsProviderBean"</span>
class=<span class="code-quote">"org.apache.cxf.xkms.service.XKMSService"</span>&gt;</span>
      <span class="code-tag">&lt;property name=<span class="code-quote">"validators"</span>&gt;</span>
         <span class="code-tag">&lt;list&gt;</span>
            <span class="code-tag">&lt;ref bean=<span class="code-quote">"dateValidator"</span>
/&gt;</span>
         <span class="code-tag">&lt;/list&gt;</span>
      <span class="code-tag">&lt;/property&gt;</span>
      <span class="code-tag">&lt;property name=<span class="code-quote">"locators"</span>&gt;</span>
         <span class="code-tag">&lt;list&gt;</span>
            <span class="code-tag">&lt;ref bean=<span class="code-quote">"x509FileLocator"</span>
/&gt;</span>
         <span class="code-tag">&lt;/list&gt;</span>
      <span class="code-tag">&lt;/property&gt;</span>
      <span class="code-tag">&lt;property name=<span class="code-quote">"keyRegisterHandlers"</span>&gt;</span>
         <span class="code-tag">&lt;list&gt;</span>
            <span class="code-tag">&lt;ref bean=<span class="code-quote">"fileRegisterHandler"</span>
/&gt;</span>
         <span class="code-tag">&lt;/list&gt;</span>
      <span class="code-tag">&lt;/property&gt;</span>
   <span class="code-tag">&lt;/bean&gt;</span>

   &lt;jaxws:endpoint id=<span class="code-quote">"XKMSService"</span> <span
class="code-keyword">xmlns:serviceNamespace</span>=<span class="code-quote">"http://www.w3.org/2002/03/xkms#wsdl"</span>
      serviceName=<span class="code-quote">"serviceNamespace:XKMSService"</span>
endpointName=<span class="code-quote">"serviceNamespace:XKMSPort"</span>
      implementor=<span class="code-quote">"#xkmsProviderBean"</span> address=<span
class="code-quote">"/XKMS"</span>&gt;
   <span class="code-tag">&lt;/jaxws:endpoint&gt;</span>
</pre>
</div></div>

<h4><a name="XMLKeyManagementService%28XKMS%29-IntegrationXKMSclientintoCXFsecurity."></a>Integration
XKMS client into CXF security.</h4>

<p>XKMS client can be integrated into CXF and WSS4J using custom Crypto provider implementation.
In this case XKMS service will be automatically invoked when WSS4J requires or validates certificate.
Details are described in <a href="http://ashakirin.blogspot.de/2013/04/cxf-security-getting-certificates-from.html"
class="external-link" rel="nofollow">blog</a>.</p>


<h4><a name="XMLKeyManagementService%28XKMS%29-DataFormats"></a>Data Formats</h4>

<p>Input and output data formats are specified in XML Key Management Service Specification
Version 2.0 (see <a href="/confluence/pages/createpage.action?spaceKey=CXF20DOC&amp;title=XKMS+2.0&amp;linkCreation=true&amp;fromPageId=31820321"
class="createlink">XKMS 2.0</a>). Anyway XKMS service supports only subset of specified
requests and responses.<br/>
Restrictions of formats for request and responses are described in following table:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Element XPath</th>
<th class='confluenceTh'>Supporting values</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'>RootElement/QueryKeyBinding/UseKeyWith@Application </td>
<td class='confluenceTd'> urn:ietf:rfc:2459 </td>
<td class='confluenceTd'> Application specifies X509 SubjectDN in Identifier attribute.
Used for normal users certificates</td>
</tr>
<tr>
<td class='confluenceTd'>RootElement/QueryKeyBinding/UseKeyWith@Application </td>
<td class='confluenceTd'> urn:apache:cxf:service:soap </td>
<td class='confluenceTd'> Application specifies Service Id in Identifier attribute as
{SERVICE_ NAMESPACE}SERVICE_NAME. Used for service certificates</td>
</tr>
<tr>
<td class='confluenceTd'>RootElement/QueryKeyBinding/UseKeyWith@Identifier </td>
<td class='confluenceTd'> X509 Subject DN or Service name as {SERVICE_ NAMESPACE}SERVICE_NAME
</td>
<td class='confluenceTd'> Depending on Application attribute public key is identified
as X509 Subject DN or Service nameservice certificates</td>
</tr>
<tr>
<td class='confluenceTd'>RootElement/UnverifiedKeyBinding/KeyInfo </td>
<td class='confluenceTd'> X509Data/X509Certificate </td>
<td class='confluenceTd'> Only X509Data with X509Certificate is supported</td>
</tr>
</tbody></table>
</div>



<h4><a name="XMLKeyManagementService%28XKMS%29-ErrorHandling"></a>Error
Handling</h4>

<p>Success and Fault Response formats are specified in <a href="/confluence/pages/createpage.action?spaceKey=CXF20DOC&amp;title=XKMS+2.0&amp;linkCreation=true&amp;fromPageId=31820321"
class="createlink">XKMS 2.0</a>. Error conditions in XKMS service are reported using
ResultMajor and ResultMinor attributes in root response element.<br/>
XKMS Service uses following values for response codes:</p>

<p>ResultMajor</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Value</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'> Success</td>
<td class='confluenceTd'> The operation succeeded. </td>
</tr>
<tr>
<td class='confluenceTd'> Receiver</td>
<td class='confluenceTd'> An error occurred at the receiver. </td>
</tr>
<tr>
<td class='confluenceTd'> Sender</td>
<td class='confluenceTd'> An error occurred that was due to the message sent by the
sender. </td>
</tr>
</tbody></table>
</div>



<p>ResultMinor</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Value</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'> Failure</td>
<td class='confluenceTd'> The service attempted to perform the request but the operation
failed. </td>
</tr>
<tr>
<td class='confluenceTd'> NoMatch</td>
<td class='confluenceTd'> No match was found for the search prototype provided. </td>
</tr>
<tr>
<td class='confluenceTd'> TooManyResponses</td>
<td class='confluenceTd'> The request resulted in the number of responses that exceeded
limit determined by the service. </td>
</tr>
<tr>
<td class='confluenceTd'> TimeInstantNotSupported</td>
<td class='confluenceTd'> The receiver has refused the operation because it does not
support the TimeInstant element. </td>
</tr>
</tbody></table>
</div>



<h4><a name="XMLKeyManagementService%28XKMS%29-Deployment"></a>Deployment</h4>

<p>XKMS Service can be deployed into web and OSGi containers. It was tested with Tomcat
and Karaf.</p>


    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/XML+Key+Management+Service+%28XKMS%29">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=31820321&revisedVersion=7&originalVersion=6">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/XML+Key+Management+Service+%28XKMS%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message