Coder Social home page Coder Social logo

merge request about xml-crypto HOT 13 CLOSED

node-saml avatar node-saml commented on July 28, 2024
merge request

from xml-crypto.

Comments (13)

cherchyk avatar cherchyk commented on July 28, 2024 2

this is all you have in module export

module.exports = require('./lib/signed-xml')
module.exports.xpath = require('xpath.js')

can you please also add

module.exports = require('./lib/signed-xml')
module.exports.xpath = require('xpath.js')
module.exports.exclusivecanonicalization. = require('./lib/exclusive-canonicalization')
...

??

I ended doing this

xmlCrypto.SignedXml.CanonicalizationAlgorithms['http://www.w3.org/TR/2001/REC-xml-c14n-20010315'] = 
        xmlCrypto.SignedXml.CanonicalizationAlgorithms['http://www.w3.org/2001/10/xml-exc-c14n#'];

but I'm not sure if will work correct.

from xml-crypto.

cherchyk avatar cherchyk commented on July 28, 2024

Here is XML I need to parse with
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />

<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="_04b8c30f-b89c-4d01-a569-67883a78d05d" Version="2.0" IssueInstant="2016-02-09T04:05:50.6492946Z" Destination="http://localhost:5000/sso/callback">
   <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://internal.zzz.com/idp</Issuer>
   <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
      <SignedInfo>
         <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
         <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
         <Reference URI="#_04b8c30f-b89c-4d01-a569-67883a78d05d">
            <Transforms>
               <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
               <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>a/BxxUeoPDZGbxqZ+eHadGh2q8M=</DigestValue>
         </Reference>
      </SignedInfo>
      <SignatureValue>RvOwXnebic/xfpUGt2kMscZEGNig5ibw2Og9SG1B9rfD9n6/pAfmTKwYWIMOxHjjBlveyIt9Ui3jB60MZRD1q5TZXY0+v+mjuYw36FHVBYrqBj8tA3a53JGFMP+63LO27dmy2dgzYsEabkG1RA1aNEX/jJUHpn78U49J5Cb3dg0=</SignatureValue>
      <KeyInfo>
         <X509Data>
            <X509Certificate>MIIBqzC.............Eq0cEItLlrhifbv838=</X509Certificate>
         </X509Data>
      </KeyInfo>
   </Signature>
   <Status>
      <StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
   </Status>
   <Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_a6f80e9d-6adc-4354-b643-c47e57cd95d2" IssueInstant="2016-02-09T04:05:50.6512329Z">
      <Issuer>https://internal.zzz.com/idp</Issuer>
      <Subject>
         <NameID NameQualifier="https://zzz.exrrrrr.com/saml/sp" Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">6200005628</NameID>
         <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
            <SubjectConfirmationData NotOnOrAfter="2016-02-09T04:10:50.6522489Z" Recipient="http://localhost:5000/sso/callback" />
         </SubjectConfirmation>
      </Subject>
      <Conditions NotBefore="2016-02-09T03:15:50.6512329Z" NotOnOrAfter="2016-02-09T04:55:50.6512329Z">
         <AudienceRestriction>
            <Audience>https://zzz.exeqweqwe.com/saml/sp</Audience>
         </AudienceRestriction>
      </Conditions>
      <AuthnStatement AuthnInstant="2016-02-09T04:05:50.6512329Z">
         <AuthnContext>
            <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos</AuthnContextClassRef>
         </AuthnContext>
      </AuthnStatement>
      <AttributeStatement>
         <Attribute Name="Lang" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <AttributeValue xsi:type="xsd:string">En</AttributeValue>
         </Attribute>
         <Attribute Name="ReturnedD" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <AttributeValue xsi:type="xsd:string">www1.ssss.com</AttributeValue>
         </Attribute>
         <Attribute Name="OFMSID" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <AttributeValue xsi:type="xsd:string">1200000055</AttributeValue>
         </Attribute>
         <Attribute Name="CenterCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <AttributeValue xsi:type="xsd:string">OCC</AttributeValue>
         </Attribute>
      </AttributeStatement>
   </Assertion>
</Response>

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

That commit is not enough to support xml c14n, exclusive c14n (exc14n) is mostly identical to c14n but have some extra details. It could work on some cases but it not spec compliant

from xml-crypto.

cherchyk avatar cherchyk commented on July 28, 2024

my project is really depends on it to be available. What can I do to make this feature available in module? Maybe it's stupid question but Is it a lot of work to add this support?

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

If you need to fake the support for c14n (just like that commit) you can register a custom transformation algorithm that uses the exc14n that is implemented in xml-crypto.

FYI We have plans to support c14n but we need to find the time to work on it

from xml-crypto.

cherchyk avatar cherchyk commented on July 28, 2024

when do you think you may have time? Is it a week or a month? I can wait some time :)

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

@cherchyk for c14n support what it needs to be done is basically read the W3C spec of c14n compare it against the exc14n spec (implemented in xml-crypto), identify the required changes and based on the ExclusiceCanonicalization code just support it

from xml-crypto.

cherchyk avatar cherchyk commented on July 28, 2024

probably it sounds easy to you but for me it's a new universe I will need to discover...

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

@cherchyk hahaha it is not easy for me too, i've spend the last week reading the c14n spec.. Trying to understand it, xml things are not my specialty

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

I'm going to close this because it is a duplicate of #68 , feel free to keep comment on that issue

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

I agree you can get the same effect with something like:

SignedXml.CanonicalizationAlgorithms['http://www.w3.org/TR/2001/REC-xml-c14n-20010315'] = SignedXml.ExclusiveCanonicalization

from xml-crypto.

cherchyk avatar cherchyk commented on July 28, 2024

thanks very much !

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

Yes, this should have the same effect.

from xml-crypto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.