Skip to content
Snippets Groups Projects
Commit fd9f1b27 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Added filename to attachment and calculated attachment hash in subscriber

parent d49f4613
No related branches found
No related tags found
1 merge request!3Feature/440 mvp net sdk part 1
using System.Buffers.Text;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using FitConnect.Models;
using FitConnect.Services;
......@@ -107,8 +108,12 @@ public class FluentSubscriber : Subscriber, IFluentApi<FluentSubscriber> {
var encryptedAttachment = SubmissionService.GetAttachment(Submission.Id, id);
var content = Encryption.DecryptData(Convert.FromBase64String(encryptedAttachment));
// TODO Where to get the HASH from?
attachments.Add(new Attachment(id, content, "HASH"));
// TODO where do I get the hash from the server to verify the attachment?
var hash = MD5.Create(HashAlgorithmName.SHA512.ToString())?.ComputeHash(content) ??
Array.Empty<byte>();
attachments.Add(new Attachment(id, content, Convert.ToBase64String(hash), "dummy.pdf"));
}
Submission.Attachments = attachments;
......
namespace FitConnect.Models;
public record Attachment(string Id, byte[] Content, string Hash);
public record Attachment(string Id, byte[] Content, string Hash, string Filename);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment