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