GithubHelp home page GithubHelp logo

maxlaverse / synocrypto Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 2.0 759 KB

Portable encryption/decryption CLI and Go library, compatible with Synology CloudSync

License: GNU General Public License v3.0

Go 99.32% Makefile 0.68%
synology decryption cloud-sync encryption

synocrypto's Introduction

Synology Cloud Sync encryption/decryption in Go

GoDoc test Go Report Card GitHub tag (latest SemVer)

Overview

A Go library to decrypt/encrypt Synology Cloud Sync files on various Operating Systems (Linux, macOS, Windows).

The file format was originally discovered by @marnix and is summarized in this document.

Command line tool

Installation

Assuming you have the go toolchain installed:

go install github.com/maxlaverse/synocrypto/cli/synocrypto

You can also download pre-compiled binaries from the releases page.

Usage

NAME:
   synocrypto - A cli for encrypting and decrypting Synology Cloud Sync files

USAGE:
   synocrypto [global options] command [command options] [arguments...]

COMMANDS:
   decrypt, d   Decrypts a file
   encrypt, e   Encrypts a file
   metadata, m  Displays the metadata of a file
   version      Prints the version
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug     outputs additional debug lines (default: false)
   --help, -h  show help (default: false)

Library

Decryption Usage

encFile, err := os.Open("./my-encrypted-file.jpg")
if err != nil {
      panic(err)
}
defer encFile.Close()

decFile, err := os.OpenFile("./my-decrypted-file.jpg", os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
      panic(err)
}
defer decFile.Close()

decrypter := synocrypto.NewDecrypter(synocrypto.DecrypterOptions{
      Password: "synocrypto",
})

err = decrypter.Decrypt(encFile, decFile)
if err != nil {
      panic(err)
}

Encryption Usage

plainFile, err := os.Open("./my-plain-file.jpg")
if err != nil {
      panic(err)
}
defer plainFile.Close()

encFile, err := os.OpenFile("./my-encrypted-file.jpg", os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
      panic(err)
}
defer encFile.Close()

privateKey, err := ioutil.ReadFile("private.pem")
if err != nil {
      panic(err)
}

encrypter := synocrypto.NewEncrypter(synocrypto.EncrypterOptions{
      Password: "synocrypto",
      PrivateKey: privateKey,
})

err = encrypter.Encrypt(plainFile, encFile)
if err != nil {
      panic(err)
}

synocrypto's People

Contributors

maxlaverse avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.