You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jaeha Choi ac56f49368
Merge commit 'cc941576830d85880737d386064b721156dfe82b' into wip-main-ui
2 months ago
..
.github/workflows Merge commit 'ee870b78c8608a4e84a96b84927ddc750ee618be' into wip-client-encryption 2 months ago
commands Merge commit '1f326adca51ffe087f0d8528a4685f833ed1353d' into wip-main-ui 2 months ago
cryptography Merge commit 'cc941576830d85880737d386064b721156dfe82b' into wip-main-ui 2 months ago
log Merge commit '9bd0595074309225f480cf31a97a55c73d0a48f3' into wip-conn 2 months ago
testdata Merge commit 'ee870b78c8608a4e84a96b84927ddc750ee618be' into wip-client-encryption 2 months ago
util Merge commit 'bb9b3f5d52d2d8cc9b1bfd2a50cc5546e68c9f34' into wip-main-ui 2 months ago
.gitignore Merge commit 'ee870b78c8608a4e84a96b84927ddc750ee618be' into wip-client-encryption 2 months ago
Readme.md Merge commit '20f125e46877cb13705a5ae9b79e1a930c646915' 2 months ago
go.mod Merge commit '9bd0595074309225f480cf31a97a55c73d0a48f3' into wip-conn 2 months ago
go.sum Merge commit '9bd0595074309225f480cf31a97a55c73d0a48f3' into wip-conn 2 months ago

Readme.md

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