Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@authenio/xml-encryption

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@authenio/xml-encryption - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

19

lib/xmlenc.js

@@ -5,3 +5,2 @@ var crypto = require('crypto');

var utils = require('./utils');
var pki = require('node-forge').pki;

@@ -13,7 +12,13 @@ const insecureAlgorithms = [

'http://www.w3.org/2001/04/xmlenc#tripledes-cbc'];
function encryptKeyInfoWithScheme(symmetricKey, options, scheme, callback) {
const padding = scheme === 'RSA-OAEP' ? crypto.constants.RSA_PKCS1_OAEP_PADDING : crypto.constants.RSA_PKCS1_PADDING;
const symmetricKeyBuffer = Buffer.isBuffer(symmetricKey) ? symmetricKey : Buffer.from(symmetricKey, 'utf-8');
try {
var rsa_pub = pki.publicKeyFromPem(options.rsa_pub);
var encrypted = rsa_pub.encrypt(symmetricKey.toString('binary'), scheme);
var base64EncodedEncryptedKey = Buffer.from(encrypted, 'binary').toString('base64');
var encrypted = crypto.publicEncrypt({
key: options.rsa_pub,
padding: padding
}, symmetricKeyBuffer);
var base64EncodedEncryptedKey = encrypted.toString('base64');

@@ -253,5 +258,5 @@ var params = {

function decryptKeyInfoWithScheme(encryptedKey, options, scheme) {
var key = Buffer.from(encryptedKey.textContent, 'base64').toString('binary');
var private_key = pki.privateKeyFromPem(options.key);
var decrypted = private_key.decrypt(key, scheme);
var padding = scheme === 'RSA-OAEP' ? crypto.constants.RSA_PKCS1_OAEP_PADDING : crypto.constants.RSA_PKCS1_PADDING;
var key = Buffer.from(encryptedKey.textContent, 'base64');
var decrypted = crypto.privateDecrypt({ key: options.key, padding: padding}, key);
return Buffer.from(decrypted, 'binary');

@@ -258,0 +263,0 @@ }

{
"name": "@authenio/xml-encryption",
"version": "1.3.0",
"version": "2.0.0",
"devDependencies": {

@@ -25,3 +25,2 @@ "mocha": "^7.1.2",

"escape-html": "^1.0.3",
"node-forge": "^0.10.0",
"xpath": "0.0.32"

@@ -37,4 +36,4 @@ },

"engines": {
"node": ">=8"
"node": ">=12"
}
}

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

Supports node >= 8
Supports node >= 12

@@ -8,0 +8,0 @@ ## Usage

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc