aboutsummaryrefslogtreecommitdiff
path: root/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-06-20 21:38:00 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-06-20 21:38:00 -0400
commiteefbfce0af26be62ec3b329e4ef78f12f5f71c98 (patch)
treea948724be366cdcbba022a6594dd32b01388c295 /wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs
parent0e0d7701979cd09e67cbd0137016ba6a5bb3b803 (diff)
push latest c-sharp changes
Diffstat (limited to 'wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs')
-rw-r--r--wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs9
1 files changed, 9 insertions, 0 deletions
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 <https://www.gnu.org/licenses/>.
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;
+ }
}
}