Discuss this help topic in SecureBlackbox Forum

Load an SSH key from a file

To load a key (public or private) stored on external media, use LoadPublicKey() or LoadPrivateKey() method respectively. You can load keys from files or from memory buffers. For private keys you may need to specify a password. All private key formats supported by SSHBlackbox also carry the public part of the key, so you do not need to load the corresponding public part separately after loading the private part.

C#:


TElSSHKey key = new TElSSHKey();
int r = key.LoadPublicKey(@"C:\Keys\sshkey.pub");

The loading procedures detect key format automatically. If the key has been loaded successfully, the methods return zero value. Otherwise, a non-zero error code is returned. Error constants (0x0dXY) are defined in SBSSHKeyStorage namespace.

After loading the key you can read its properties via Algorithm, Bits, KeyFormat, IsPublic, IsPrivate, and other properties of TElSSHKey class.

How To articles about SSH keys

Discuss this help topic in SecureBlackbox Forum