# node-xml-encryption
**Repository Path**: mirrors_wickedest/node-xml-encryption
## Basic Information
- **Project Name**: node-xml-encryption
- **Description**: W3C XML Encryption implementation for node.js (http://www.w3.org/TR/xmlenc-core/)
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-19
- **Last Updated**: 2025-06-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://travis-ci.org/auth0/node-xml-encryption)
W3C XML Encryption implementation for node.js (http://www.w3.org/TR/xmlenc-core/)
## Usage
npm install xml-encryption
### encrypt
~~~js
var xmlenc = require('xmlenc');
var options = {
rsa_pub: fs.readFileSync(__dirname + '/your_rsa.pub'),
pem: fs.readFileSync(__dirname + '/your_public_cert.pem'),
encryptionAlgorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc',
keyEncryptionAlgorighm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p'
};
xmlenc.encrypt('content to encrypt', options, function(err, result) {
console.log(result);
}
~~~
Result:
~~~xml
MIIEDzCCAveg... base64 cert... q3uaLvlAUo=
sGH0hhzkjmLWYYY0gyQMampDM... encrypted symmetric key ...gewHMbtZafk1MHh9A==
V3Vb1vDl055Lp92zvK..... encrypted content.... kNzP6xTu7/L9EMAeU
~~~
### decrypt
~~~js
var options = {
key: fs.readFileSync(__dirname + '/your_private_key.key'),
};
xmlenc.decrypt('', options, function(err, result) {
console.log(result);
}
// result
decrypted content
~~~
## Supported algorithms
Currently the library supports:
* EncryptedKey to transport symmetric key using:
* http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
* http://www.w3.org/2001/04/xmlenc#rsa-1_5
* EncryptedData using:
* http://www.w3.org/2001/04/xmlenc#aes128-cbc
* http://www.w3.org/2001/04/xmlenc#aes256-cbc
* http://www.w3.org/2001/04/xmlenc#tripledes-cbc
However, you can fork and implement your own algorithm. The code supports adding more algorithms easily
## Issue Reporting
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
## Author
[Auth0](auth0.com)
## License
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.