aboutsummaryrefslogtreecommitdiff
path: root/plugins/openpgp/src/file_transfer/file_encryptor.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-10-04 14:42:16 +0200
committerMarvin W <git@larma.de>2026-10-23 16:59:59 +0200
commitdba577f39c489b9db29960f2bf5cc78ac4f29d7b (patch)
treea8354c9fc328c1442d5e8c5c2adec4b428c92f44 /plugins/openpgp/src/file_transfer/file_encryptor.vala
parent2413442905e31f34cb0f77c9167003b3725760fe (diff)
Move OMEMO, OpenPGP and RTP plugins into main/libdino
Diffstat (limited to 'plugins/openpgp/src/file_transfer/file_encryptor.vala')
-rw-r--r--plugins/openpgp/src/file_transfer/file_encryptor.vala45
1 files changed, 0 insertions, 45 deletions
diff --git a/plugins/openpgp/src/file_transfer/file_encryptor.vala b/plugins/openpgp/src/file_transfer/file_encryptor.vala
deleted file mode 100644
index 66e93bd9..00000000
--- a/plugins/openpgp/src/file_transfer/file_encryptor.vala
+++ /dev/null
@@ -1,45 +0,0 @@
-using Dino.Entities;
-
-namespace Dino.Plugins.OpenPgp {
-
-public class PgpFileEncryptor : Dino.FileEncryptor, Object {
-
- StreamInteractor stream_interactor;
-
- public PgpFileEncryptor(StreamInteractor stream_interactor) {
- this.stream_interactor = stream_interactor;
- }
-
- public bool can_encrypt_file(Conversation conversation, FileTransfer file_transfer) {
- return conversation.encryption == Encryption.PGP;
- }
-
- public FileMeta encrypt_file(Conversation conversation, FileTransfer file_transfer) throws FileSendError {
- FileMeta file_meta = new FileMeta();
-
- try {
- GPG.Key[] keys = stream_interactor.get_module(Manager.IDENTITY).get_key_fprs(conversation);
- uint8[] enc_content = GPGHelper.encrypt_file(file_transfer.get_file().get_path(), keys, GPG.EncryptFlags.ALWAYS_TRUST, file_transfer.file_name);
- file_transfer.input_stream = new MemoryInputStream.from_data(enc_content, GLib.free);
- file_transfer.encryption = Encryption.PGP;
- file_transfer.server_file_name = Xmpp.random_uuid() + ".pgp";
- file_meta.size = enc_content.length;
- } catch (Error e) {
- throw new FileSendError.ENCRYPTION_FAILED("PGP file encryption error: %s".printf(e.message));
- }
- debug("Encrypting file %s as %s", file_transfer.file_name, file_transfer.server_file_name);
-
- return file_meta;
- }
-
- public FileSendData? preprocess_send_file(Conversation conversation, FileTransfer file_transfer, FileSendData file_send_data, FileMeta file_meta) {
- HttpFileSendData? send_data = file_send_data as HttpFileSendData;
- if (send_data == null) return null;
-
- send_data.encrypt_message = false;
-
- return file_send_data;
- }
-}
-
-}