Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derived Key support #9

Open
robrichards opened this issue Jun 24, 2015 · 11 comments
Open

Derived Key support #9

robrichards opened this issue Jun 24, 2015 · 11 comments

Comments

@robrichards
Copy link
Owner

Hello!

I know that you maintain this wonderful xmlseclib library which I am currently using.

And I have a question about it, maybe you could help me with finding a proper soultion.

Here is a problem:

This is the WS-POLICY for the service:

<wsp:Policy wsu:Id="CustomBinding_IServiceCustomer_policy">
<wsp:ExactlyOne>
  <wsp:All>
    <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:ProtectionToken>
          <wsp:Policy>
            <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
              <wsp:Policy>
                <sp:RequireDerivedKeys/>
                <sp:RequireThumbprintReference/>
                <sp:WssX509V3Token10/>
              </wsp:Policy>
            </sp:X509Token>
          </wsp:Policy>
        </sp:ProtectionToken>
        <sp:AlgorithmSuite>
          <wsp:Policy>
            <sp:Basic128Rsa15/>
          </wsp:Policy>
        </sp:AlgorithmSuite>
        <sp:Layout>
          <wsp:Policy>
            <sp:Strict/>
          </wsp:Policy>
        </sp:Layout>
        <sp:IncludeTimestamp/>
        <sp:OnlySignEntireHeadersAndBody/>
      </wsp:Policy>
    </sp:SymmetricBinding>
    <sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
          <wsp:Policy>
            <sp:RequireThumbprintReference/>
            <sp:WssX509V3Token10/>
          </wsp:Policy>
        </sp:X509Token>
      </wsp:Policy>
    </sp:EndorsingSupportingTokens>
    <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:MustSupportRefThumbprint/>
        <sp:MustSupportRefEncryptedKey/>
        <sp:RequireSignatureConfirmation/>
      </wsp:Policy>
    </sp:Wss11>
    <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:MustSupportIssuedTokens/>
        <sp:RequireClientEntropy/>
        <sp:RequireServerEntropy/>
      </wsp:Policy>
    </sp:Trust10>
    <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <wsp:Policy>
        <sp:TransportToken>
          <wsp:Policy>
            <sp:HttpsToken RequireClientCertificate="false"/>
          </wsp:Policy>
        </sp:TransportToken>
        <sp:AlgorithmSuite>
          <wsp:Policy>
            <sp:Basic256/>
          </wsp:Policy>
        </sp:AlgorithmSuite>
        <sp:Layout>
          <wsp:Policy>
            <sp:Strict/>
          </wsp:Policy>
        </sp:Layout>
        <sp:IncludeTimestamp/>
      </wsp:Policy>
    </sp:TransportBinding>
    <wsaw:UsingAddressing/>
  </wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>

The problem is following:

According to POLICY (RequireDerivedKeys), user needs 2 DerivedKeyTokens (one for signing, other for encrypting).
And soap-wsse.php, unfortunatelly, lacks this functionality.
Therefore I added my own functions to cover that.
To create keys, I use following p-sha1 function: http://stackoverflow.com/questions/19590675/implementation-of-p-sha1-algorithm-in-php

According to POLICY (EndorsingSupportingTokens), we need to sign already created signature.
This implementation is also missing in soap-wssse.php.
I created my own function for that, but I'm not sure if it works correctly.

As a result, I receive following response after I send generated XML:

CryptographicException: Unable to resolve the '#...' URI in the signature to compute the digest.

Can you please help me with those tokens? Do you find it reasonable to add such support for DerivedKeyToken into your class?

Thank you!

@robrichards
Copy link
Owner Author

@griga3k Can you try the code from the derived_key branch. For your function can you add the following directly after the call to $objWSSE->finalChangesDKT();

file_put_contents("derivkey.xml", $objWSSE->saveXML());

tar that up and send it to me. I need to see what your document looks like before transmission to work on the URI issue. If you happen to have the raw XML which you can get doing similar but at the beginning of the function, that would also be helpful

@griga3k
Copy link

griga3k commented Jun 24, 2015

@robrichards I did as requested.
Here is a generated by me XML and working sample XML, that I received from their support team:
https://gist.github.com/anonymous/3075eb734ef408240a39

Thank you!

@griga3k
Copy link

griga3k commented Aug 7, 2015

Maybe You need more information?

@robrichards
Copy link
Owner Author

@griga3k hoping to get some time this week to look more into it

@griga3k
Copy link

griga3k commented Sep 15, 2015

@robrichards Can I help you somehow to speed up the process?

@robrichards
Copy link
Owner Author

@griga3k I just need to find some time. 3 more weeks until I free up a little

@griga3k
Copy link

griga3k commented Dec 7, 2015

@robrichards Hey! How it is going? :) Any progress on this or news? Thanks!

@griga3k
Copy link

griga3k commented Apr 20, 2016

@robrichards Hello! Sorry to bother you again, but do you know if my problem can be solved? Maybe you can give me some hints how to accomplish this with your library.

@griga3k
Copy link

griga3k commented Jan 5, 2017

@robrichards Hi! Is there any chance that we will achieve results? Thanks!

@christiandavilakoobin
Copy link

@robrichards Hi! Is there any plans to implement the DerivedKeyTokens support? Thanks!

@robrichards
Copy link
Owner Author

I need to find a working system that uses derived keys it to be able to move forward on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants