Exemple #1
0
 public void SetKey(string name, RSAKey key)
 {
     if (string.IsNullOrEmpty(name))
     {
         name = defName;
     }
     dicKeys[name] = key;
 }
Exemple #2
0
        public RSAKey GetRSAKey(string path)
        {
            RSAKey key = new RSAKey();

            if (File.Exists(Path.Combine(path, publicKeyFileName)))
            {
                key.PublicKey = Convert.ToBase64String(File.ReadAllBytes(Path.Combine(path, publicKeyFileName)));
            }
            if (File.Exists(Path.Combine(path, privateKeyFileName)))
            {
                key.PrivateKey = Convert.ToBase64String(File.ReadAllBytes(Path.Combine(path, privateKeyFileName)));
            }
            return(key);
        }