public static ServerBitLockerUnlock FromString(string str, CryptoProvider decryptor) { string[] datas = str.Split(','); byte[] password = Convert.FromBase64String(datas.Last()); byte[] decryptPassword = new byte[password.Length]; decryptor.CryptoStream.Write(password, 0, password.Length); decryptor.CryptoStream.Decrypt(decryptPassword, 0, decryptPassword.Length); return(new ServerBitLockerUnlock(DriveInformation.FromString(str), Encoding.UTF8.GetString(decryptPassword, 0, decryptPassword.Length), decryptor)); }
public static ClientDrive FromString(string str) { int splitIdx = str.IndexOf(','); string[] ip = str.Substring(0, splitIdx).Split(':'); return(new ClientDrive(new IPEndPoint(IPAddress.Parse(ip[0]), int.Parse(ip[1])), DriveInformation.FromString(str.Substring(splitIdx + 1)))); }