Beispiel #1
0
        static RsaKey()
        {
            var text = RSAEncrypt.GeneratePrivateKey();

            keyData = RSAEncrypt.ConvertToBlob(text, true);
            pubKey  = RSAEncrypt.ConvertToBlob(text, false);
        }
Beispiel #2
0
 /// <summary>
 /// 从指定路径加载密钥文件
 /// </summary>
 /// <param name="path"></param>
 public static void ReadFrom(string path)
 {
     lock (lockObj)
     {
         if (System.IO.File.Exists(path))
         {
             keyData = System.IO.File.ReadAllBytes(path);
             var text = RSAEncrypt.ConvertToXml(keyData, false);
             pubKey = RSAEncrypt.ConvertToBlob(text, false);
         }
     }
 }