Load method
Loads keys from the file.
Type
NoneSyntax
- Basic
object.Load Filename, [Password]
The Load(object,Filename,Password) syntax has these parts:
The Load(object,Filename,Password) syntax has these parts:
object | An expression evaluating to an object of type Keys. |
Filename | Required. A String value. Full path to file where key is stored, or full key provided as string value. |
Password | Optional. A Variant value. Secret password used to protect the key. |
Remarks
Load method will try to load in memory previously saved key using Save method, or saved using external programs such as ssh-keygen included in OpenSSH package. File should be accessible and readable by yourself in the time when Load is requested.If Load is successful, wodKeys.NET will recognize key type from SSHKeyTypes enumeration, and overwrite old one from memory (if any). If you use more than one key, you should call Load method more than once, specifying different file in each call.
Saved key should be in new OpenSSH key format, which is simply base64 encoded data surrounded by header lines (this is the format that is used in Save method) and is widely supported by different SSH implementations. Typical structure looks like this (for RSAKey):
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz
....
MDI1MDIwNQECAwQFBgcICQoL
-----END OPENSSH PRIVATE KEY-----
If loading fails, an error will be generating describing the error. Most common error when loading the key will occur if password does not match one that was used when key was saved.
Filename can contain string key data instead of filename, so you can load key from the string directly.
NOTE: besides its own 'openssh-key-v1' format used by wodKeys.NET internally, we also support PEM encoded formats PKCS#1 for all the keys, with and without the password. We also support Putty generated PPK format, but version 3 is not supported with the password. Note, however, importing these "alien" keys is provided 'as is'. Since these are foreign formats, it's possible wodKeys.NET will fail to load them.