public bool Load() { try { TextReader tr = new StreamReader(FQFilename); string json = tr.ReadToEnd(); tr.Close(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json)); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(KeyRegression)); KeyRegression kr = (KeyRegression)ser.ReadObject(ms); ms.Close(); MW = kr.MW; current = kr.current; keys = kr.keys; return(true); } catch (Exception e) { Console.WriteLine("Failed to load keyregression file: " + FQFilename); Console.WriteLine("{0} Exception caught.", e); return(false); } }
public static uint GetKeyVersion(string target_dir) { KeyRegression kr = new KeyRegression(target_dir); return kr.GetKeyVersion(); }
public static Byte[] GetNewKey(string target_dir) { KeyRegression kr = new KeyRegression(target_dir); return kr.GetKey(); }
public static void GenFreshKeychain(string target_dir) { KeyRegression kr = new KeyRegression(1000, target_dir); kr.Flush(); }
public static Byte[] KeyDer(Byte[] key) { return(KeyRegression.KeyDer(key)); }
public static Byte[] GetSpecificKey(Byte[] key, uint cur_version, uint new_version) { return(KeyRegression.GetSpecific(key, cur_version - new_version)); }
public static uint GetKeyVersion(string target_dir) { KeyRegression kr = new KeyRegression(target_dir); return(kr.GetKeyVersion()); }
public static Byte[] GetNewKey(string target_dir) { KeyRegression kr = new KeyRegression(target_dir); return(kr.GetKey()); }