Show/Hide Toolbars

Inventu Viewer+ Single Signon Server Extension

This file contains the Credentials class which handles reading and writing encrypted Credential files.  Files use the .NET AesCryptoServiceProvider and keys unique to each customer's installation, from the MyKeys.cs file.

 

All methods are static and include:

 

GetFileName

static string GetFileName(string hostName, string userid, string userHostID)

 

Constructs a file name (hostName/userid[_userHostID].cred) inside CredentialsPath

 

SaveCredentials

public static void SaveCredentials(string hostName, string userid, string

                         userHostID, string hostID, string pw, bool isGenerated = false)

 

Calls GetFileName and then encrypts and saves the userName, HostID and HostPW using a simple tab delimiter.

 

GetCredentials

public static bool GetCredentials(string hostName, string userid, string userHostID,

                                         out string hostID, out string pw, out string errorMessage)

 

Calls GetFileName and if the File Exists, will decrypt, split, verify userID and set the HostID and HostPW values and return true.

 

GenPW

public static string GenPW(string activePW, int maxLength = 10, string specialChars = null, string removeChars = null)

 

Generates a complex password and if the activePW is not null, will ensure that no characters match!  See @GenPW Function for how it works...