aboutsummaryrefslogtreecommitdiff
path: root/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/Nip04Util.cs
diff options
context:
space:
mode:
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;
+ }
}
}