public CngHostAlgorithm(String providerName, String keyName)
     : base("ssh-rsa")
 {
     using (NCryptStorageProvider provider = new NCryptStorageProvider(providerName))
     {
         key = provider.OpenKey(keyName);
     }
     hashAlgorithm = new BCryptAlgorithmProvider("SHA1");
 }
示例#2
0
 private void DeleteKey()
 {
     using (NCryptStorageProvider provider = new NCryptStorageProvider(SelectProvider()))
     {
         using (NCryptKey key = provider.OpenKey(SelectKey(provider)))
         {
             key.Delete();
         }
     }
 }
示例#3
0
 private void ExportKey()
 {
     using (NCryptStorageProvider provider = new NCryptStorageProvider(SelectProvider()))
     {
         using (NCryptKey key = provider.OpenKey(SelectKey(provider)))
         {
             Console.WriteLine(key.ExportToOpenSSHFormat("ssh-rsa", ""));
         }
     }
 }