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