Home

Awesome

A tool/lib to encrypt/decrypt Microsoft Office Document

Environment

How to make bin/msoffice-crypt.exe

Linux

    mkdir work
    git clone https://github.com/herumi/cybozulib
    git clone https://github.com/herumi/msoffice
    cd msoffice
    make -j RELEASE=1

If you use an old OpenSSL library, then make OLD_OPENSSL=1.

Windows

    mkdir work
    git clone https://github.com/herumi/cybozulib
    git clone https://github.com/herumi/msoffice
    git clone https://github.com/herumi/cybozulib_ext # for openssl
    cd msoffice
    mk.bat ; or open msoffice12.sln and build

How to use

bin/msoffice-crypt.exe -e -p test test.xlsx enc.xlsx
bin/msoffice-crypt.exe -d -p test enc.xlsx dec.xlsx
usage:msoffice-crypt.exe [opt] input output
  -h : show this message
  -p password in only ascii
  -encMode 0:use AES128(default), 1: use AES256 for encoding
  -ph8 password in utf8 hex. ex. 68656C6C6F for 'hello'
  -ph16 password in utf16 hex. ex. u3042u3044u3046 for 'aiu' in hiragana
  -k (experimental) secret key in hex. ex. 0123456789ABCDEF0123456789ABCDEF
  -by (experimental) extract secret key from this file
  -e encode
  -d decode
  -c spin count
  -psk print secret key
  -v print debug info
  -vv print debug info and save binary data

Return code

Support format

Office 2010 or later Office Document format which suffix is pptx, docx, xlsx.

DLL for Windows

MSOC_encrypt(outFile, inFile, pass, NULL);
MSOC_decrypt(outFile, inFile, pass, NULL);

Remark

The type of inFile, outFile and pass are const wchar_t*(UTF-16 string). See Csample code and Python sample code.

lib for Linux

MSOC_encryptA(outFile, inFile, pass, NULL);
MSOC_decryptA(outFile, inFile, pass, NULL);

Remark

The type of inFile, outFile and pass are const char*(ascii string). See mini C sample code.

License

BSD 3-Clause License

Copyright (c) 2015 Cybozu Labs, Inc. All rights reserved.

References