Proj_Coconut_Utility

module
v0.0.0-...-afbecfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2022 License: BSD-3-Clause

README

Utility for Project Coconut Server/Desktop

CI codecov

log package

Contains simple wrapper methods to support level-based logging.

Usage
import "github.com/jaeha-choi/Proj_Coconut_Utility/log"

// Initialize logger
log.Init(os.Stdout, log.Error) 

log.Debug("Debug msg") // Won't print; Mode is set to log.Error
log.Error(err)
util package

Contains utility methods for sending/receiving packets and defined status codes.

cryptography package

Note: I am not a cryptographer. Use this package at your own risk. If you notice any security issue, please email me.

Provide functions to encrypt/decrypt large files in chunks using AES-GCM and RSA.

Usage
  • Encryption (AES-GCM + RSA):
... 
streamEncrypt, err := cryptography.EncryptSetup(testFileN)
// Error handling
err = streamEncrypt.Encrypt(writer, client1PublicKey, client2PrivKey)
// Error handling
err := streamEncrypt.Close()
...
  • Decryption (AES-GCM + RSA):
...
streamDecrypt, err := cryptography.DecryptSetup()
// Error handling
err = streamDecrypt.Decrypt(reader, client2PublicKey, client1PrivKey)
// Error handling
err := streamDecrypt.Close()
...
  • Encryption (RSA):
cryptography.EncryptSignMsg(msg, client1PublicKey, client2PrivKey)
  • Decryption (RSA):
cryptography.DecryptVerifyMsg(encryptedMsg, client2PublicKey, client1PrivKey)
  • Open RSA PEM blocks:
pubPem, privPem, err := OpenKeys("./path/to/keys/")
  • PEM blocks to PrivateKey struct:
privKey, err := PemToKeys(privPem)

privKey             // Private key
privKey.PublicKey   // Public key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL