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

officecrypto-tool

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

officecrypto-tool

officeCrypto is a library for node.js that can be used to decrypt and encrypt excel files.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3K
decreased by-12.81%
Maintainers
1
Weekly downloads
 
Created
Source

officecrypto-tool

officeCrypto is a library for js that can be used to decrypt and encrypt office(excel/ppt/word) files..

Special Notes

The implementation of this library refers to xlsx and xlsx-populate, especially xlsx-populate, part of the source code reference and directly copied over.

Now it supports encryption and decryption of MS office and WPS xlsx suffix files, xls suffix encryption and decryption is not supported yet.

Contents

Install

npm/yarn/pnpm install officeCrypto

Examples

const officeCrypto = require('officeCrypto');
const fs = require('fs').promises;

//decrypt a file with a password
(async ()=>{
        const input = await fs.readFile(`pass_test.xlsx`);
        const output = await officeCrypto.decrypt(input, {password: '123456'});
        await fs.writeFile(`out_success.xlsx`, output);
})()

//Setting up encrypted files with passwords
(async ()=>{
        const input = await fs.readFile(`test.xlsx`);
        const output = officeCrypto.encrypt(input, {password: '123456'});
        await fs.writeFile(`standard_out_success.xlsx`, output);
})()

Supported encryption methods

OFFICECRYPTO specs

  • ECMA-376 (Agile Encryption/Standard Encryption)
    • MS-DOCX (OOXML) (Word 2007-2016)
    • MS-XLSX (OOXML) (Excel 2007-2016)
    • MS-PPTX (OOXML) (PowerPoint 2007-2016)
  • [] Office Binary Document RC4 CryptoAPI
    • [] MS-DOC (Word 2002, 2003, 2004)
    • [] MS-XLS (Excel 2002, 2003, 2004) (experimental)
    • [] MS-PPT (PowerPoint 2002, 2003, 2004) (partial, experimental)
  • [] Office Binary Document RC4
    • [] MS-DOC (Word 97, 98, 2000)
    • [] MS-XLS (Excel 97, 98, 2000) (experimental)
  • ECMA-376 (Extensible Encryption)
  • XOR Obfuscation

Other

  • Word 95 Encryption (Word 95 and prior)
  • Excel 95 Encryption (Excel 95 and prior)
  • PowerPoint 95 Encryption (PowerPoint 95 and prior)

PRs are welcome!

Tests

With Jest:

pnpm i 
pnpm run test

Todo

  • Add tests
  • Support decryption and encryption with passwords
  • Support older encryption schemes
  • Add decryption tests for various file formats
  • Support more encryption and decrytion
  • Support frontend

Resources

In other languages

Keywords

FAQs

Package last updated on 27 May 2023

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

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