mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-09-02 15:17:29 -04:00
Add RPC function for encrypting data
This commit is contained in:
+9
-2
@@ -16,15 +16,22 @@ type RCWService struct{}
|
||||
|
||||
// DecryptRequest is the RPC method that decrypts the incoming data using
|
||||
// the global passphrase and returns the decrypted data
|
||||
func (h *RCWService) DecryptRequest(request []byte, reply *[]byte) error {
|
||||
func (h *RCWService) DecryptRequest(encBytes []byte, reply *[]byte) error {
|
||||
var err error
|
||||
*reply, err = wrappers.Decrypt(request, globalPassphrase)
|
||||
*reply, err = wrappers.Decrypt(encBytes, globalPassphrase)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncryptRequest is the RPC method that encrypts the incoming data using
|
||||
// the global passphrase and returns the encrypted data
|
||||
func (h *RCWService) EncryptRequest(decBytes []byte, reply *[]byte) error {
|
||||
*reply = wrappers.Encrypt(decBytes, globalPassphrase)
|
||||
return nil
|
||||
}
|
||||
|
||||
// getFileHash returns the SHA256 hash of the file at the given path.
|
||||
func getFileHash(path string) []byte {
|
||||
file, _ := os.Open(path)
|
||||
|
||||
Reference in New Issue
Block a user