Exemplo n.º 1
0
 public static Profile DecryptProfile(Profile profile)
 {
     try
     {
         profile.FirstName     = StringCipher.Decrypt(profile.FirstName, EncryptKey);
         profile.LastName      = StringCipher.Decrypt(profile.LastName, EncryptKey);
         profile.HomeLatitude  = StringCipher.Decrypt(profile.HomeLatitude, EncryptKey);
         profile.HomeLongitude = StringCipher.Decrypt(profile.HomeLongitude, EncryptKey);
         profile.FullName      = StringCipher.Decrypt(profile.FullName, EncryptKey);
         return(profile);
     }
     catch (FormatException)
     {
         return(profile);
     }
     catch (CryptographicException)
     {
         return(profile);
     }
 }
Exemplo n.º 2
0
 public static Profile DecryptProfile(Profile profile)
 {
     try
     {
         profile.FirstName     = StringCipher.Decrypt(profile.FirstName, EncryptKey);
         profile.LastName      = StringCipher.Decrypt(profile.LastName, EncryptKey);
         profile.HomeLatitude  = StringCipher.Decrypt(profile.HomeLatitude, EncryptKey);
         profile.HomeLongitude = StringCipher.Decrypt(profile.HomeLongitude, EncryptKey);
         profile.FullName      = StringCipher.Decrypt(profile.FullName, EncryptKey);
         return(profile);
     }
     catch (FormatException fe)
     {
         //This should be logged when ILogger is enabled
         Console.WriteLine($"Class Encryptor, FormatException DecryptProfile() i Encryptor= {fe.Message}, HomeLatitude: {profile.HomeLatitude}, HomeLongitude: {profile.HomeLongitude}, ID: {profile.Id}");
         return(profile);
     }
     catch (CryptographicException ce)
     {
         //This should be logged when ILogger is enabled
         Console.WriteLine($"Class Encryptor, CryptographicException DecryptProfile() i Encryptor= {ce.Message}, HomeLatitude: {profile.HomeLatitude}, HomeLongitude: {profile.HomeLongitude}, ID: {profile.Id}");
         return(profile);
     }
 }
Exemplo n.º 3
0
 public static AppLogin DecryptAppLogin(AppLogin appLogin)
 {
     appLogin.GuId     = StringCipher.Decrypt(appLogin.GuId, EncryptKey);
     appLogin.UserName = StringCipher.Decrypt(appLogin.UserName, EncryptKey);
     return(appLogin);
 }
Exemplo n.º 4
0
 public static Token DecryptToken(Token token)
 {
     token.GuId        = StringCipher.Decrypt(token.GuId, EncryptKey);
     token.TokenString = StringCipher.Decrypt(token.TokenString, EncryptKey);
     return(token);
 }
Exemplo n.º 5
0
 public static GPSCoordinate DecryptGPSCoordinate(GPSCoordinate gpscoord)
 {
     gpscoord.Latitude  = StringCipher.Decrypt(gpscoord.Latitude, EncryptKey);
     gpscoord.Longitude = StringCipher.Decrypt(gpscoord.Longitude, EncryptKey);
     return(gpscoord);
 }
Exemplo n.º 6
0
 public static string DecryptUser(string encryptedUser)
 {
     return(StringCipher.Decrypt(encryptedUser, EncryptKey));
 }