Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxlaverse/synocrypto
Portable encryption/decryption CLI and Go library, compatible with Synology CloudSync
https://github.com/maxlaverse/synocrypto
cloud-sync decryption encryption synology
Last synced: about 2 months ago
JSON representation
Portable encryption/decryption CLI and Go library, compatible with Synology CloudSync
- Host: GitHub
- URL: https://github.com/maxlaverse/synocrypto
- Owner: maxlaverse
- License: gpl-3.0
- Created: 2021-04-06T20:09:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-17T15:12:24.000Z (over 2 years ago)
- Last Synced: 2024-06-21T20:10:09.258Z (6 months ago)
- Topics: cloud-sync, decryption, encryption, synology
- Language: Go
- Homepage:
- Size: 741 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Synology Cloud Sync encryption/decryption in Go
[![GoDoc](https://godoc.org/github.com/maxlaverse/synocrypto?status.svg)](https://godoc.org/github.com/maxlaverse/synocrypto)
[![test](https://github.com/maxlaverse/synocrypto/actions/workflows/workflow.yaml/badge.svg)](https://github.com/maxlaverse/synocrypto/actions/workflows/workflow.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/maxlaverse/synocrypto)](https://goreportcard.com/report/github.com/maxlaverse/synocrypto)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/maxlaverse/synocrypto.svg?style=social)](https://github.com/maxlaverse/synocrypto/tags)## 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](https://github.com/marnix)
and is summarized [in this document](ENCRYPTION.md).## 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 filesUSAGE:
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 commandGLOBAL OPTIONS:
--debug outputs additional debug lines (default: false)
--help, -h show help (default: false)
```## Library
### Decryption Usage
```go
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
```go
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)
}
```[releases]: https://github.com/maxlaverse/synocrypto/releases