From eefbfce0af26be62ec3b329e4ef78f12f5f71c98 Mon Sep 17 00:00:00 2001 From: vnugent Date: Thu, 20 Jun 2024 21:38:00 -0400 Subject: push latest c-sharp changes --- .../dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs') diff --git a/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs b/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs index 82704db..c1906f0 100644 --- a/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs +++ b/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs @@ -14,6 +14,7 @@ // along with this program. If not, see . using System; +using System.Buffers.Text; using VNLib.Utils.Extensions; @@ -36,6 +37,14 @@ namespace VNLib.Utils.Cryptography.Noscrypt { throw new NotImplementedException(); } + + static readonly int MaxEncodedIvLength = Base64.GetMaxEncodedToUtf8Length(16); + + public static int CalcMessageBufferSize(int dataSize) + { + int bufSize = CalcBufferSize(dataSize); + return bufSize + "?iv=".Length + MaxEncodedIvLength; + } } } -- cgit