summary refs log tree commit diff
path: root/crypto/src/tls/BasicTlsSrpIdentity.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/tls/BasicTlsSrpIdentity.cs')
-rw-r--r--crypto/src/tls/BasicTlsSrpIdentity.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/crypto/src/tls/BasicTlsSrpIdentity.cs b/crypto/src/tls/BasicTlsSrpIdentity.cs
new file mode 100644
index 000000000..9a527a705
--- /dev/null
+++ b/crypto/src/tls/BasicTlsSrpIdentity.cs
@@ -0,0 +1,36 @@
+using System;
+
+using Org.BouncyCastle.Utilities;
+
+namespace Org.BouncyCastle.Tls
+{
+    /// <summary>A basic SRP Identity holder.</summary>
+    public class BasicTlsSrpIdentity
+        : TlsSrpIdentity
+    {
+        protected readonly byte[] m_identity;
+        protected readonly byte[] m_password;
+
+        public BasicTlsSrpIdentity(byte[] identity, byte[] password)
+        {
+            this.m_identity = Arrays.Clone(identity);
+            this.m_password = Arrays.Clone(password);
+        }
+
+        public BasicTlsSrpIdentity(string identity, string password)
+        {
+            this.m_identity = Strings.ToUtf8ByteArray(identity);
+            this.m_password = Strings.ToUtf8ByteArray(password);
+        }
+
+        public virtual byte[] GetSrpIdentity()
+        {
+            return m_identity;
+        }
+
+        public virtual byte[] GetSrpPassword()
+        {
+            return m_password;
+        }
+    }
+}