How to use the xml-crypto/lib/c14n-canonicalization.C14nCanonicalization function in xml-crypto

To help you get started, we’ve selected a few xml-crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-ebics / node-ebics-client / lib / orders / H004 / signer.js View on Github external
const sign = (doc, key) => {
	const nodeSignatureValue = doc.getElementsByTagName('ds:SignatureValue')[0];

	if (nodeSignatureValue) {
		const select = xpath.useNamespaces({ ds: 'http://www.w3.org/2000/09/xmldsig#' });
		const contentToSign = (new C14n().process(select('//ds:SignedInfo', doc)[0])).replace('xmlns:ds="http://www.w3.org/2000/09/xmldsig#"', 'xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"');

		nodeSignatureValue.textContent = Crypto.privateSign(key, contentToSign); // this.keys.x().key.sign(contentToSign, 'base64');
	}

	return doc;
};
github node-ebics / node-ebics-client / lib / versions / H004 / Signer.js View on Github external
sign() {
		const nodeSignatureValue = this.doc.getElementsByTagName('ds:SignatureValue')[0];

		if (nodeSignatureValue) {
			const select = xpath.useNamespaces({ ds: 'http://www.w3.org/2000/09/xmldsig#' });
			const contentToSign = (new C14n().process(select('//ds:SignedInfo', this.doc)[0])).replace('xmlns:ds="http://www.w3.org/2000/09/xmldsig#"', 'xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"');

			nodeSignatureValue.textContent = Crypto.privateSign(this.keys.x(), contentToSign); // this.keys.x().key.sign(contentToSign, 'base64');
		}

		return this;
	}

xml-crypto

Xml digital signature and encryption library for Node.js

MIT
Latest version published 10 months ago

Package Health Score

83 / 100
Full package analysis