Discuss this help topic in SecureBlackbox Forum

TElSSHKey.LoadPrivateKey

TElSSHKey     See also     


Filter: C#  VB.NET  Pascal  C++  PHP  Java  


This method loads the private key from file or buffer.

Declaration

[C#]
    int LoadPrivateKey(string PrivateKeyFile, string Passphrase);
    int LoadPrivateKey(byte[] Buffer, int Size, string Passphrase);

[VB.NET]
    Function LoadPrivateKey(ByVal PrivateKeyFile As String, ByVal Passphrase As String) As Integer
    Function LoadPrivateKey(ByVal Buffer As Byte(), ByVal Size As Integer, ByVal Passphrase As String) As Integer

[Pascal]
    function LoadPrivateKey(const PrivateKeyFile : string; const Passphrase : string = '') : integer;
    function LoadPrivateKey(Buffer : pointer; Size : integer; const Passphrase : string = '') : integer;

[C++]
    int32_t LoadPrivateKey(const std::string &PrivateKeyFile, const std::string &Passphrase);
    int32_t LoadPrivateKey(void * Buffer, int32_t Size, const std::string &Passphrase);

[PHP]
    integer LoadPrivateKey(string $PrivateKeyFile, string $Passphrase)
    integer LoadPrivateKey(TSBPointer|array of byte|string|NULL $Buffer, integer $Size, string $Passphrase)

[Java]
    int loadPrivateKey(byte[] Buffer, int Size, String Passphrase);
    int loadPrivateKey(String PrivateKeyFile, String Passphrase);

Parameters

  • PrivateKeyFile - file which contains private key
  • Passphrase - password of the file with private key
  • Buffer - buffer which contains private key
  • Size - size of the buffer from which the data is loaded

Return value

    Returns 0 on success, and error code otherwise.

Error codes

Description

    Use this method to load RSA/DSA private key from file or buffer.
    If the key is stored in Putty format (the file contains both public and private keys; only the private key is protected), and SB_ERROR_SSH_KEYS_INVALID_PASSPHRASE is returned, the public part of the key will be loaded anyway.

See also:     LoadPublicKey     SavePrivateKey     SavePublicKey    

Discuss this help topic in SecureBlackbox Forum