aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicco Mandahl Jørgensen <riccojorgensen@gmail.com>2018-03-13 12:53:24 +0100
committerRicco Mandahl Jørgensen <riccojorgensen@gmail.com>2018-03-13 12:53:24 +0100
commit54749b4012cddd9e80f26971dcf45fc352aead26 (patch)
treed7b08ab3ff8c0196a0041fa10abeed1a769a514d /PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs
First Commit
Diffstat (limited to 'PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs')
-rw-r--r--PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs b/PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs
new file mode 100644
index 0000000..4432ee0
--- /dev/null
+++ b/PasswordCrackerDistributed/PasswordCrackerServer/UserInfo.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace PasswordCrackerServer
+{
+ /// <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;
+ }
+ }
+}