void ShowKey(object obj) { if (rsaxml is null) { rsaxml = new RSAXML(); } if (Manual) { Modulus = Convert.ToBase64String(rsaxml.Modulus); Exponent = Convert.ToBase64String(rsaxml.Exponent); } else { Modulus = BuildHexString(rsaxml.Modulus); Exponent = BuildHexString(rsaxml.Exponent); } P = BuildHexString(rsaxml.P); Q = BuildHexString(rsaxml.Q); D = BuildHexString(rsaxml.D); DP = BuildHexString(rsaxml.DP); DQ = BuildHexString(rsaxml.DQ); InverseQ = BuildHexString(rsaxml.InverseQ); }
void GenerateKeys(object obj) { NewKeys = "Working..."; if (rsaxml is null) { rsaxml = new RSAXML(); } rsaxml.GenerateKeyToXML("."); NewKeys = "Success"; }
void Decrypt(object obj) { if (rsaxml is null) { rsaxml = new RSAXML(); } ShowKey(obj); CipherBytes = "Done"; string temp = File.ReadAllText(FileChoice); byte[] toDecrypt = Convert.FromBase64String(temp); byte[] decrypted = rsaxml.Decrypt(toDecrypt); PlainText = Encoding.ASCII.GetString(decrypted); }