Coder Social home page Coder Social logo

peculiarventures / xadesjs Goto Github PK

View Code? Open in Web Editor NEW
139.0 17.0 49.0 1.76 MB

A pure Typescript/Javascript implementation of XAdES based on XMLDSIGjs. (Keywords: WebCrypto, XMLDSIG, XADES, eIDAS, Trust List, X.509, CRL, OCSP)

Home Page: https://xadesjs.com

License: MIT License

TypeScript 98.58% JavaScript 1.42%
xmldsig ades xades-bes webcrypto javascript typescript electronic-signatures node-webcrypto-ossl web-crypto

xadesjs's People

Contributors

alexey-pelykh avatar blaskurain avatar eidins avatar microshine avatar rmhrisk avatar victorlaskurain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xadesjs's Issues

Error: SignedXml constructor

Error on new SignedXml(el: Element)

// constructor(node: Element)
this.envdoc = new DOMParser().parseFromString(node.outerHTML, xadesjs.APPLICATION_XML);

throw error on NodeJs from DOMParser. It seems that xmldom node.outerHTML is ubdefined

XADES-BES signing

Hi,
would you like to show example how to sign XML document using XADES-BES?
There is only XMLSIG example. I found xadesjs very useful but I don't know how to use it.

Thank you in advance for any help you can provide.

http://www.w3.org/TR/2001/REC-xml-c14n-20010315

Hi, @rmhrisk @microshine! I'm having some trouble validating signatures canonicalize by xml-c14n using xml-crypto lib. I know you build on top of it and added some features, among other c14n support. So maybe I could use you're help
I have this signature and i can't validate it. I'm sure the dif is in the canonicalization method

<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="">
    <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>txO/Q5rCzp2FMT3FgOQfVzwCcFk=</DigestValue>
  </Reference>
</SignedInfo>
    <SignatureValue>wpnU9yX9RDxQsMYPAdiqR14EObYvsboXgXFatyPC7g3rcgSIT5VQdAdgKtUeKMpXi0hWDK/wyIsp53E0Jl9T46ooLFDZMuTYs7UAyiXX/MsvPGCYCmRK7uf0Cv3Wuu6bSCyzBgjQQ/sP130nYUGEXG9w4TxT7BAyanYhS4Fxl5A=</SignatureValue><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName>CN=Correo Uruguayo - CA, OU=SERVICIOS ELECTRONICOS, O=ADMINISTRACION NACIONAL DE CORREOS, C=UY</X509IssuerName><X509SerialNumber>155761856642617054135126896023459966393</X509SerialNumber></X509IssuerSerial></X509Data></KeyInfo></Signature>

I can' t verify this signature! I think it have something to do with the canonicalization process. The cannonXml (excC14N) would be:

<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
  <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod>
  <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod>
  <Reference URI="">
    <Transforms>
      <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform>
      <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform>
    </Transforms>
    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
    <DigestValue>txO/Q5rCzp2FMT3FgOQfVzwCcFk=</DigestValue>
  </Reference>
</SignedInfo>

Would c14N cannon be the same?

Thanks for any data, advice you could offer me

how to add custom KeyInfo clause?

in xml-crypto i can add a custom KeyInfo implementation to customize the output and it seems like in xadesjs it is supported too -> signedXml.KeyInfo.AddClause(keyInfoClause); is that correct? if so, do you have some guide how the implementation would look like?

Add decorator for Xml objects

Add decorator for member of Xml objects which must switch flag for GetXml compilation

if object is filled from Xml it has internal member element. But if change objects's member value it must be recompiled on GetXml

Maybe it must be resolved in XmlJs layer

Error installing: remote invalid username or password when cloning repo

npm ERR! git clone --template=/home/dir/.npm/_git-remotes/_templates --mirror https://github.com/PeculiarVentures/asn1js-es6.git /home/dir/.npm/_git-remotes/git-https-github-com-PeculiarVentures-asn1js-es6-git-f4b3f41f: Cloning into bare repository '/home/dir/.npm/_git-remotes/git-https-github-com-PeculiarVentures-asn1js-es6-git-f4b3f41f'...

npm ERR! git clone --template=/home/dir/.npm/_git-remotes/_templates --mirror https://github.com/PeculiarVentures/asn1js-es6.git /home/dir/.npm/_git-remotes/git-https-github-com-PeculiarVentures-asn1js-es6-git-f4b3f41f: remote: Invalid username or password.

npm ERR! git clone --template=/home/dir/.npm/_git-remotes/_templates --mirror https://github.com/PeculiarVentures/asn1js-es6.git /home/dir/.npm/_git-remotes/git-https-github-com-PeculiarVentures-asn1js-es6-git-f4b3f41f: fatal: Authentication failed for 'https://github.com/PeculiarVentures/asn1js-es6.git/'

I get the above error when trying to install from npm (simply running npm install xadesjs), is there something I should change? Or is there a problem with the repo?

error in node-webcrypto-ossl installation

As xadesjs npm page (https://www.npmjs.com/package/xadesjs) node-webcrypto-ossl installation as following:

npm install node-webcrypto-ossl

However this seems to raise error. My error log is following:

sudo npm install -g node-webcrypto-ossl
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/
> [email protected] install /opt/local/lib/node_modules/node-webcrypto-ossl
> tsd install && tsc && node-gyp rebuild

sh: tsd: command not found
npm ERR! Darwin 14.5.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install" "-g" "node-webcrypto-ossl"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] install: `tsd install && tsc && node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script 'tsd install && tsc && node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-webcrypto-ossl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsd install && tsc && node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-webcrypto-ossl
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls node-webcrypto-ossl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/user1/z/npm-debug.log

As node-webcrypto-ossl npm page (https://www.npmjs.com/package/node-webcrypto-ossl), installation described as following:

git clone https://github.com/PeculiarVentures/node-webcrypto-ossl
cd node-webcrypto-ossl
npm install node-gyp -g
npm install typescript -g
npm install tsd -g
npm install mocha -g
npm install
tsd install
tsc
node-gyp configure build

How can I install node-webcrypto-ossl properly?

Thanks

Readme node example outdated or not tested?

I'm not sure at all how to use this package, the examples seem to be incorrect in the readme.
I ran
npm install xadesjs --save

to install the package. (there are no install instructions in the readme, I hope this is all that's required)

According to the readme the example code should just work since it doesn't say you need to separately install anything else, however the example code is a fail:

First line:
var xadesjs = require("xades");
Error: Cannot find module 'xades'
at Function.Module._resolveFilename (module.js:325:15)

I think this is probably a typo and should be xadesjs? I assumed so and changed it

var xadesjs = require("xadesjs");
var DOMParser = require("xmldom").DOMParser;

and then I get this:
Error: Cannot find module 'xmldom'
at Function.Module._resolveFilename (module.js:325:15)

But when I check under xadesjs in modules it contains xmldom in it's node_modules!?

And that's as far as I'm willing to waste time on this.

Is the example code just completely wrong and needs to be re-written or ....

PFX File

Can I use PFX cert?
Have one example?

Any standalone browser example?

Hi. Can you provide any standalone browser example? I've seen HTML files in test directory but they don't seem to work because of file path or something. Thanks.

xadesjs.com demo not work at mobile browsers

Hi.

xadesjs.com demo page seems not to work on mobile browsers such like mobile chrome, mobile firefox and mobile safari. Can you provide supported browser list for it?

Thanks.

Multiple signers - how to?

I'm new to electronic signature and I'm interested on xadesjs.

I need an advice, or strategy recommendation.
Some documents require to be signed by two or more users. Maybe thousands.
What would be the right way to do this?
Perhaps I should generate a PDF file for up to 20 users and embed each user's signature in the same file?

how to add custom attributes to the signature node?

congrats for the release!

a minor question.. in xml-crypto i can specify custom attribute for the resulting <Signature />

example in xml-crypto:

signGenerator.computeSignature(xmlStr, {
    prefix: 'ds',
    attrs: {
      Id: 'customIdPerSignatureInMyApplication'
    },
    // .. other options here ..
  });

result -> <Signature Id="customIdPerSignatureInMyApplication"> <!-- signature content here --></Signature>,

how this can be done in xadesjs?

Failing Travis builds on linux

It is unclear why on earth this is happening but Travis on linux insists on picking up xmldom vs xmldom-alpha which is what package.json says. OSX, on the other hand, does the right thing. I have a bug open with the xmldom author asking them to release a regular xmldom but it is unclear when/if that will happen.

If it doesnt happen soon maybe we just release our own npm of the xmldom package, I just would rather not do that due to creating confusion for others.

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.