Example #1
0
        protected static void LoadPrivate(RsaKeyPair keys, string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new InvalidOperationException("The specified filePath was not found");
            }

            keys.PrivateKeyXml = File.ReadAllText(filePath);
        }
Example #2
0
        public static RsaKeyPair Load(string directory, string fileName)
        {
            RsaKeyPair result  = new RsaKeyPair();
            string     pubFile = Path.Combine(directory, string.Format("{0}.pub", fileName));

            LoadPublic(result, pubFile);
            string privFile = Path.Combine(directory, string.Format("{0}.priv", fileName));

            LoadPrivate(result, privFile);
            return(result);
        }