In the CryptographyLib class library project, add the following code to the Protector class:
public static string PublicKey; public static string ToXmlStringExt(this RSA rsa, bool includePrivateParameters) { var p = rsa.ExportParameters(includePrivateParameters); XElement xml; if (includePrivateParameters) { xml = new XElement("RSAKeyValue" , new XElement("Modulus", Convert.ToBase64String(p.Modulus)) , new XElement("Exponent", Convert.ToBase64String(p.Exponent)) , new XElement("P", Convert.ToBase64String(p.P)) , new XElement("Q", Convert.ToBase64String(p.Q)) , new XElement("DP", Convert.ToBase64String(p.DP)) , new XElement("DQ", Convert.ToBase64String(p.DQ)) , new XElement("InverseQ", Convert.ToBase64String(p.InverseQ))); ...