• Stars
    star
    228
  • Rank 175,267 (Top 4 %)
  • Language
    C++
  • License
    BSD 3-Clause "New...
  • Created about 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool/lib to encrypt/decrypt Microsoft Office Document

Environment

  • 64-bit Windows Visual Studio 2012 or later
  • gcc 4.6, clang 3.0 or later
  • libssl
    • sudo apt install libssl-dev

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

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

  • Encrypt test.xlsx with a password test.
bin/msoffice-crypt.exe -e -p test test.xlsx enc.xlsx
  • Decrypt enc.xlsx with a password test.
bin/msoffice-crypt.exe -d -p test enc.xlsx dec.xlsx
  • Other options
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

  • 0 success
  • 1 not support formart
  • 2 already encrypted with -e or decrypted with -d
  • 3 bad password with -d

Support format

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

DLL for Windows

  • msoc.dll (Microsoft Office Crypto)

  • msoc.dll

  • msoc.h

  • Encrypt inFile with pass and make outFile.

MSOC_encrypt(outFile, inFile, pass, NULL);
  • Decrypt inFile with pass and make outFile.
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

  • libmsoc.lib

  • Encrypt inFile with pass and make outFile.

MSOC_encryptA(outFile, inFile, pass, NULL);
  • Decrypt inFile with pass and make outFile.
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

More Repositories

1

xbyak

a JIT assembler for x86(IA-32)/x64(AMD64, x86-64) MMX/SSE/SSE2/SSE3/SSSE3/SSE4/FPU/AVX/AVX2/AVX-512 by C++ header
C++
1,949
star
2

mcl

a portable and fast pairing-based cryptography library
C++
431
star
3

prml

TeX
367
star
4

bls

C++
284
star
5

fmath

fast log and exp functions for x86/x64 SSE
C++
210
star
6

ate-pairing

C++
132
star
7

ango-src

TeX
87
star
8

cybozulib

a tiny library for C++
C++
63
star
9

she-wasm

Two-level homomorphic encryption for Node.js by WebAssembly
JavaScript
62
star
10

bls-eth-go-binary

Go
61
star
11

mcl-wasm

TypeScript
58
star
12

ango

51
star
13

misc

C++
51
star
14

bls-wasm

BLS signature for Node.js by WebAssembly
JavaScript
46
star
15

emcjp

C++
44
star
16

x86opti

37
star
17

blog

C++
36
star
18

bls-eth-wasm

JavaScript
30
star
19

opti

C++
29
star
20

xbyak_riscv

C++
26
star
21

bls-go-binary

Go
21
star
22

bls-eth-rust

Rust
20
star
23

simdgen

A library to generate a SIMD code for AVX-512/SVE from a given function string.
C++
19
star
24

ecdsa-motoko

Motoko
14
star
25

mie_string

C++
13
star
26

mie

C++
11
star
27

s_xbyak

ASM generation tool for GAS/NASM/MASM with Xbyak-like syntax in Python
Python
11
star
28

ecdsa-wasm

ECDSA/secp256k1 + SHA-256
JavaScript
9
star
29

fmindex

forked fmindex-plus-plus
C++
7
star
30

anninbon

HTML
7
star
31

ahe-demo

additive homomorphic encryption demo to compute an edge of an image
C++
5
star
32

add_he

additive homomorphic encryption demo using lifted ElGamal encryption
C++
5
star
33

test-picotls

C
4
star
34

mcl-rust

Rust
4
star
35

edit-dist

C++
4
star
36

gogo

obsolete
4
star
37

pairing-doc

TeX
4
star
38

faster-csidh

The original is https://gitlab.cs.hs-rm.de/pqcrypto/faster-csidh
C
4
star
39

walb-tools

C
3
star
40

mcl-android

sample of mcl on Android
CMake
3
star
41

l2-to-l1

C++
3
star
42

obsolete-bls-all-in-one

Assembly
2
star
43

gmp-android

C++
2
star
44

mcl-ff

arithmetic operations of a finite field
Python
2
star
45

ot-by-l2he

Oblivious Transfer demo by L2-HE
C++
2
star
46

she-rust

Rust
2
star
47

test-harmony-bls

test of harmony-bls for jaa
C++
2
star
48

cybozulib_ext

a collection for cybozulib
C
2
star
49

debug_mcl

debug mcl for travis
Assembly
1
star
50

mcladt

Java
1
star
51

test-bls-go-binary

Go
1
star
52

sample-wasm-cpp

JavaScript
1
star