Back to product page

Load method


Loads keys from the file.

Syntax

  • Basic
object.Load Filename, (Password)  
The Load(object,FIlename,Password) syntax has these parts:
objectAn expression evaluating to an object of type SSHKeyPair.
FIlenameRequired. A String value. Full path to file where key is saved.
PasswordOptional. A Variant value. Secret password that was 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 (and thus the server) in a time when Load is requested.

If Load is successful, wodSSHD will recognize key type (RSAkey, DSAkey or ECDSAkey) and overwrite old one from memory (if any). If you use multiple keys for your server, you should call Load method more than once, specifying different file in each call.

Saved key should be in PEM format. PEM format 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. Load additionally transparently handle PKCS#8 format encrypted and unencrypted keys too. Typical structure looks like this (for RSAKey):


 
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CFB,33E78EDBC3F91072
 
bKxPNDjHoqW4wT46OnYnDWtJnhwhqRIh81o9IAjjrrlRRDQf9kefDFuciKBrJCqK
................................................................
                         (...more...)
................................................................
ViWBhtNOV1Wzm3Ifv9ekm6cd1TjPO2UP/Vi5/Xz4PQ+maA7c1QXbdXGF29fc2VFI
JQKZxKKEfirZntyOH6chDQGeYnB7mXLpRNnNb7g=
-----END RSA 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.


Platforms

Windows