🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

xml-encryption

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
n

xml-encryption

[![Build Status](https://travis-ci.org/auth0/node-xml-encryption.png)](https://travis-ci.org/auth0/node-xml-encryption)

3.1.0
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

85

Maintenance

100

License

Version published
Weekly downloads
462K
-21.79%
Maintainers
43
Weekly downloads
 
Created
Issues
15

What is xml-encryption?

The xml-encryption npm package provides tools for encrypting and decrypting XML data. It supports various encryption algorithms and allows for the secure handling of XML documents.

What are xml-encryption's main functionalities?

Encrypting XML Data

This feature allows you to encrypt XML data using a specified encryption algorithm and keys. The code sample demonstrates how to encrypt an XML string using RSA and AES256-CBC.

const xmlenc = require('xml-encryption');
const xml = '<root><name>John Doe</name></root>';
const options = { rsa_pub: 'public_key.pem', pem: 'private_key.pem', encryptionAlgorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' };
xmlenc.encrypt(xml, options, function(err, result) {
  if (err) console.error(err);
  console.log('Encrypted XML:', result);
});

Decrypting XML Data

This feature allows you to decrypt previously encrypted XML data using the appropriate private key. The code sample demonstrates how to decrypt an encrypted XML string.

const xmlenc = require('xml-encryption');
const encryptedXml = '...'; // Encrypted XML string
const options = { key: 'private_key.pem' };
xmlenc.decrypt(encryptedXml, options, function(err, result) {
  if (err) console.error(err);
  console.log('Decrypted XML:', result);
});

Other packages similar to xml-encryption

FAQs

Package last updated on 21 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts