C# Class SebWindowsClient.ConfigurationUtils.SEBConfigFileManager

Show file Open project: SafeExamBrowser/seb-win Class Usage Examples

Public Properties

Property Type Description
sebPasswordDialogForm SebPasswordDialogForm

Public Methods

Method Description
DecryptSEBSettings ( byte sebData, bool forEditing, string &sebFilePassword, bool &passwordIsHash, X509Certificate2 &sebFileCertificateRef ) : Dictionary,System.Collections.Generic

Decrypt and deserialize SEB settings When forEditing = true, then the decrypting password the user entered and/or certificate reference found in the .seb file is returned

EncryptDataUsingIdentity ( byte data, X509Certificate2 certificateRef ) : byte[]

Encrypt preferences using a certificate

EncryptDataUsingPassword ( byte data, string password, bool passwordIsHash, SEBSettings configPurpose ) : byte[]

Encrypt preferences using a password

EncryptSEBSettingsWithCredentials ( string settingsPassword, bool passwordIsHash, X509Certificate2 certificateRef, SEBSettings configPurpose, bool forEditing ) : byte[]

Show SEB Password Dialog Form.

Read SEB settings from UserDefaults and encrypt them using provided security credentials

GetPrefixDataFromData ( byte &data, int prefixLength ) : byte[]

Helper method for stripping (and returning) a prefix byte array of prefixLength from a data byte array which is returned without the stripped prefix

GetPrefixStringFromData ( byte &data ) : string

Helper method for returning a prefix string (of PREFIX_LENGTH, currently 4 chars) from a data byte array which is returned without the stripped prefix

StoreDecryptedSEBSettings ( byte sebData ) : bool

Decrypt, parse and use new SEB settings

Private Methods

Method Description
DecryptDataWithPasswordForConfiguringClient ( byte sebData, bool forEditing, string &sebFilePassword, bool &passwordIsHash ) : Dictionary,System.Collections.Generic

Helper method which decrypts the byte array using an empty password, or the administrator password currently set in SEB or asks for the password used for encrypting this SEB file for configuring the client

DecryptDataWithPublicKeyHashPrefix ( byte sebData, bool forEditing, X509Certificate2 &sebFileCertificateRef ) : byte[]

Helper method which fetches the public key hash from a byte array, retrieves the according cryptographic identity from the certificate store and returns the decrypted bytes

GetPreferencesDictFromConfigData ( byte sebData, bool forEditing ) : Dictionary,System.Collections.Generic

Helper method: Get preferences dictionary from decrypted data. In editing mode, users have to enter the right SEB administrator password before they can access the settings contents and returns the decrypted bytes

askForPasswordAndCompareToHashedPassword ( string sebFileHashedAdminPassword, bool forEditing ) : bool

Ask user to enter password and compare it to the passed (hashed) password string Returns true if correct password was entered

Method Details

DecryptSEBSettings() public static method

Decrypt and deserialize SEB settings When forEditing = true, then the decrypting password the user entered and/or certificate reference found in the .seb file is returned
public static DecryptSEBSettings ( byte sebData, bool forEditing, string &sebFilePassword, bool &passwordIsHash, X509Certificate2 &sebFileCertificateRef ) : Dictionary,System.Collections.Generic
sebData byte
forEditing bool
sebFilePassword string
passwordIsHash bool
sebFileCertificateRef System.Security.Cryptography.X509Certificates.X509Certificate2
return Dictionary,System.Collections.Generic

EncryptDataUsingIdentity() public static method

Encrypt preferences using a certificate
public static EncryptDataUsingIdentity ( byte data, X509Certificate2 certificateRef ) : byte[]
data byte
certificateRef System.Security.Cryptography.X509Certificates.X509Certificate2
return byte[]

EncryptDataUsingPassword() public static method

Encrypt preferences using a password
public static EncryptDataUsingPassword ( byte data, string password, bool passwordIsHash, SEBSettings configPurpose ) : byte[]
data byte
password string
passwordIsHash bool
configPurpose SEBSettings
return byte[]

EncryptSEBSettingsWithCredentials() public static method

Show SEB Password Dialog Form. Read SEB settings from UserDefaults and encrypt them using provided security credentials
public static EncryptSEBSettingsWithCredentials ( string settingsPassword, bool passwordIsHash, X509Certificate2 certificateRef, SEBSettings configPurpose, bool forEditing ) : byte[]
settingsPassword string
passwordIsHash bool
certificateRef System.Security.Cryptography.X509Certificates.X509Certificate2
configPurpose SEBSettings
forEditing bool
return byte[]

GetPrefixDataFromData() public static method

Helper method for stripping (and returning) a prefix byte array of prefixLength from a data byte array which is returned without the stripped prefix
public static GetPrefixDataFromData ( byte &data, int prefixLength ) : byte[]
data byte
prefixLength int
return byte[]

GetPrefixStringFromData() public static method

Helper method for returning a prefix string (of PREFIX_LENGTH, currently 4 chars) from a data byte array which is returned without the stripped prefix
public static GetPrefixStringFromData ( byte &data ) : string
data byte
return string

StoreDecryptedSEBSettings() public static method

Decrypt, parse and use new SEB settings
public static StoreDecryptedSEBSettings ( byte sebData ) : bool
sebData byte
return bool

Property Details

sebPasswordDialogForm public static property

public static SebPasswordDialogForm sebPasswordDialogForm
return SebPasswordDialogForm