‪Black Box
Static Public Member Functions | Static Private Attributes
BBThermostatDataEncryptor.BBThermostatDataDecryption Class Reference

Static Public Member Functions

static string DecryptData (string SensorData)
 ‪This method decrypt the saved thermostat data More...
 

Static Private Attributes

static string pSensor = ""
 
static string SensorKey = BBThermostatDataEncypDecrypKey.sKey()
 
static string SensorIV = BBThermostatDataEncypDecrypKey.sIV()
 
static byte [] SensorIVByte = { }
 
static byte [] SensorKeyByte = { }
 
static byte [] inputByteArray
 
static MemoryStream ms = null
 
static CryptoStream cs = null
 

Detailed Description

Definition at line 16 of file BBThermostatDataDecryption.cs.

Member Function Documentation

◆ DecryptData()

static string BBThermostatDataEncryptor.BBThermostatDataDecryption.DecryptData ( string  SensorData)
static

‪This method decrypt the saved thermostat data

Parameters
SensorData
Returns

Definition at line 35 of file BBThermostatDataDecryption.cs.

36  {
37  ‪SensorIVByte = Encoding.UTF8.GetBytes(‪SensorIV.Substring(0, 8));
38  ‪SensorKeyByte = Encoding.UTF8.GetBytes(‪SensorKey.Substring(0, 8));
39 
40  ‪inputByteArray = new byte[SensorData.Replace(" ", "+").Length];
41  ‪inputByteArray = Convert.FromBase64String(SensorData.Replace(" ", "+"));
42  using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
43  {
44  ‪ms = new MemoryStream();
45  ‪cs = new CryptoStream(‪ms, des.CreateDecryptor(‪SensorKeyByte, ‪SensorIVByte), CryptoStreamMode.Write);
46  ‪cs.Write(‪inputByteArray, 0, ‪inputByteArray.Length);
47  ‪cs.FlushFinalBlock();
48  Encoding encoding = Encoding.UTF8;
49  ‪pSensor = encoding.GetString(‪ms.ToArray());
50  }
51 
52  return ‪pSensor;
53  }

Field Documentation

◆ cs

CryptoStream BBThermostatDataEncryptor.BBThermostatDataDecryption.cs = null
staticprivate

◆ inputByteArray

byte [] BBThermostatDataEncryptor.BBThermostatDataDecryption.inputByteArray
staticprivate

◆ ms

MemoryStream BBThermostatDataEncryptor.BBThermostatDataDecryption.ms = null
staticprivate

◆ pSensor

string BBThermostatDataEncryptor.BBThermostatDataDecryption.pSensor = ""
staticprivate

◆ SensorIV

string BBThermostatDataEncryptor.BBThermostatDataDecryption.SensorIV = BBThermostatDataEncypDecrypKey.sIV()
staticprivate

◆ SensorIVByte

byte [] BBThermostatDataEncryptor.BBThermostatDataDecryption.SensorIVByte = { }
staticprivate

◆ SensorKey

string BBThermostatDataEncryptor.BBThermostatDataDecryption.SensorKey = BBThermostatDataEncypDecrypKey.sKey()
staticprivate

◆ SensorKeyByte

byte [] BBThermostatDataEncryptor.BBThermostatDataDecryption.SensorKeyByte = { }
staticprivate

The documentation for this class was generated from the following file: