aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2018-03-17 15:33:00 +0100
committermarcinzelent <zelent.marcin@gmail.com>2018-03-17 15:33:00 +0100
commitf68bb1864b40c69d12b44db5aa33125aef39e150 (patch)
treebb11f3714a2aa99708f5cca2feec3ff68d3e5b88 /DistributedPasswordCracker.Client/Models
parent7e2a8dbd051b94115672cf22cc66ef09ba8376ca (diff)
Restructuring
Diffstat (limited to 'DistributedPasswordCracker.Client/Models')
-rw-r--r--DistributedPasswordCracker.Client/Models/UserInfo.cs38
-rw-r--r--DistributedPasswordCracker.Client/Models/UserInfoClearText.cs32
2 files changed, 70 insertions, 0 deletions
diff --git a/DistributedPasswordCracker.Client/Models/UserInfo.cs b/DistributedPasswordCracker.Client/Models/UserInfo.cs
new file mode 100644
index 0000000..d05d03e
--- /dev/null
+++ b/DistributedPasswordCracker.Client/Models/UserInfo.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace DistributedPasswordCracker.Client.Models
+{
+ /// <summary>
+ /// username + encrypted password.
+ /// In the password file we store username + encrypted password.
+ /// The encrypted password is a byte array (cannot be written to the password file)
+ /// This must be Base64 encoded (converted to a string) before written to the file
+ /// </summary>
+ [Serializable]
+ class UserInfo
+ {
+ public String Username { get; set; }
+ public String EntryptedPasswordBase64 { get; set; }
+ public byte[] EntryptedPassword { get; set; }
+
+ public UserInfo(String username, String entryptedPasswordBase64)
+ {
+ if (username == null)
+ {
+ throw new ArgumentNullException("username");
+ }
+ if (entryptedPasswordBase64 == null)
+ {
+ throw new ArgumentNullException("entryptedPasswordBase64");
+ }
+ Username = username;
+ EntryptedPasswordBase64 = entryptedPasswordBase64;
+ EntryptedPassword = Convert.FromBase64String(entryptedPasswordBase64);
+ }
+
+ public override string ToString()
+ {
+ return Username + ":" + EntryptedPasswordBase64;
+ }
+ }
+} \ No newline at end of file
diff --git a/DistributedPasswordCracker.Client/Models/UserInfoClearText.cs b/DistributedPasswordCracker.Client/Models/UserInfoClearText.cs
new file mode 100644
index 0000000..e83b29c
--- /dev/null
+++ b/DistributedPasswordCracker.Client/Models/UserInfoClearText.cs
@@ -0,0 +1,32 @@
+using System;
+
+namespace DistributedPasswordCracker.Client.Models
+{
+ /// <summary>
+ /// Username + password in clear text (that is human readable)
+ /// </summary>
+ public class UserInfoClearText
+ {
+ public String UserName { get; set; }
+ public String Password { get; set; }
+
+ public UserInfoClearText(string username, string password)
+ {
+ if (username == null)
+ {
+ throw new ArgumentNullException("username");
+ }
+ if (password == null)
+ {
+ throw new ArgumentNullException("password");
+ }
+ UserName = username;
+ Password = password;
+ }
+
+ public override string ToString()
+ {
+ return UserName + ": " + Password;
+ }
+ }
+} \ No newline at end of file