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 cc94157683
Add BytesToPemFile
22 hours ago
.github/workflows Update CI.yml 3 weeks ago
commands Add commands.go 24 hours ago
cryptography Add BytesToPemFile 22 hours ago
log Add methods for formatted output 2 weeks ago
testdata Update testdata path 2 weeks ago
util Add parameter to indicate ReadBytesToWriter to pass size 1 day ago
.gitignore Ignore pub/priv key pair 2 weeks ago
Readme.md Update Readme.md 2 weeks ago
go.mod Add WriteConfig 2 weeks ago
go.sum Add WriteConfig 2 weeks 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