Tsckey export
Posted: Mon 05 Aug 2019 16:18
Hello,
Playing around with Tsckey.ExportTo;
ScSSHClient.PrivateKeyName is the name of a valid working key stored in MyStorage.
But regardless if i put a filename or a stream in the parameter i get error "Key not ready". I also attach the project (without key, i assume you have test keys at hand).
https://www.dropbox.com/s/oiwohi106cm2g ... n.rar?dl=0
procedure TForm1.Button2Click(Sender: TObject);
var
aKey : Tsckey;
PrivKey : String;
s : String;
ss : TStringStream;
ts : TMemoryStream;
iFPubKey : Boolean;
psw : String;
Cipher : TScSymmetricAlgorithm;
KeyFormat: TScKeyFormat;
comment : String;
begin
PrivKey:=ScSSHClient.PrivateKeyName;
aKey:=MyStorage.Keys.FindKey(PrivKey);
ss:=TStringStream.Create;
ts :=TMemoryStream.Create;
if aKey<>Nil then Begin
psw:='';
aKey.ExportTo('myKeyFile', False, '');
// m.Lines.Add(ts.DataString);
End;
ts.Free;
ss.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
aKey : Tsckey;
PrivKey : String;
s : String;
ss : TStringStream;
ts : TMemoryStream;
iFPubKey : Boolean;
psw : String;
Cipher : TScSymmetricAlgorithm;
KeyFormat: TScKeyFormat;
comment : String;
begin
PrivKey:=ScSSHClient.PrivateKeyName;
aKey:=MyStorage.Keys.FindKey(PrivKey);
ss:=TStringStream.Create;
ts :=TMemoryStream.Create;
if aKey<>Nil then Begin
psw:='';
aKey.ExportTo(ss, False, '');
// m.Lines.Add(ts.DataString);
End;
ts.Free;
ss.Free;
end;
Playing around with Tsckey.ExportTo;
ScSSHClient.PrivateKeyName is the name of a valid working key stored in MyStorage.
But regardless if i put a filename or a stream in the parameter i get error "Key not ready". I also attach the project (without key, i assume you have test keys at hand).
https://www.dropbox.com/s/oiwohi106cm2g ... n.rar?dl=0
procedure TForm1.Button2Click(Sender: TObject);
var
aKey : Tsckey;
PrivKey : String;
s : String;
ss : TStringStream;
ts : TMemoryStream;
iFPubKey : Boolean;
psw : String;
Cipher : TScSymmetricAlgorithm;
KeyFormat: TScKeyFormat;
comment : String;
begin
PrivKey:=ScSSHClient.PrivateKeyName;
aKey:=MyStorage.Keys.FindKey(PrivKey);
ss:=TStringStream.Create;
ts :=TMemoryStream.Create;
if aKey<>Nil then Begin
psw:='';
aKey.ExportTo('myKeyFile', False, '');
// m.Lines.Add(ts.DataString);
End;
ts.Free;
ss.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
aKey : Tsckey;
PrivKey : String;
s : String;
ss : TStringStream;
ts : TMemoryStream;
iFPubKey : Boolean;
psw : String;
Cipher : TScSymmetricAlgorithm;
KeyFormat: TScKeyFormat;
comment : String;
begin
PrivKey:=ScSSHClient.PrivateKeyName;
aKey:=MyStorage.Keys.FindKey(PrivKey);
ss:=TStringStream.Create;
ts :=TMemoryStream.Create;
if aKey<>Nil then Begin
psw:='';
aKey.ExportTo(ss, False, '');
// m.Lines.Add(ts.DataString);
End;
ts.Free;
ss.Free;
end;