Code: Select all
https://forums.devart.com/viewtopic.php?f=27&t=39126&p=139889&hilit=TScMemoryStorage#p139889
Code: Select all
https://forums.devart.com/viewtopic.php?f=27&t=34258&p=118717&hilit=TScMemoryStorage#p118717
It showed the following code snippet to load from a string into a TscKey object
Code: Select all
Key := TScKey.Create(ScMemoryStorage.Keys);
SStream:=TStringStream.Create(Private_Key);
Key.ImportFrom(SStream);
Given code like the following, can anyone please show me exactly what the code would be to get the public and private keys held as constants to be stored in TScMemoryStorage at run time in such a way that the TScSSHClient can access them using the names 'ThePublicKey' and 'ThePrivateKey'. as assigned to its HostKeyName and PrivateKeyName properties.
Code: Select all
Const
PUBLIC_KEY = 'ABCDEF'; //hard coded public key
PRIVATE_KEY = 'HIJKLM'; //hard coded private key
var
SSHClient : TScSSHClient;
MemoryStorage : TScMemoryStorage;
Key: TscKey;
Private_Key: String;
SStream: TStringStream;
begin
...
SSHClient.KeyStorage := MemoryStorage ;
SSHClient.HostKeyName := 'ThePublicKey'; //name given to public key
SSHClient.PrivateKeyName := 'ThePrivateKey'; //name given to private key
...
end