0

As I understand, then public and private key files generated by e.g. https://travistidwell.com/jsencrypt/demo/ is the standard format for RSA keys.

I am trying to generate just the same format keys with Turbo LockBox 3. I am generating keys according to this tutorial http://lockbox.seanbdurkin.id.au/Generate+an+RSA+key and I am saving the generated keys using the code:

procedure TMainForm.GenerateKeysBtnClick(Sender: TObject);
var FStream: TFileStream;
begin
  Signatory.GenerateKeys;
  FStream:=TFileStream.Create('D:\Cryptic\keys\keys.txt', fmOpenReadWrite);
  try
    Signatory.StoreKeysToStream(FStream, [PartPublic, PartPrivate]);
  finally
    FStream.Free;
  end;
end;

But the content of the generated file is incomprehensible - I am putting only part of it here due to being afraid that it may contain some sensitive data as I can not clearly see what it contains exactly:

3   @   GŹŁīÖŅŠŖ,‡?«ą
˙ßN1?ą›1ź‡&4’C_hsÉųVŻKŖa¸AtāøB īMnSę>Xć|

Is this content somehow encoded or password-protected. It may be. But I did not specified any passwrod. I expect that file will contain private and public keys clearly separated and using the basic characters only (even more - documentation says that the file will contain 2 pairs of keys, separate key pair for the encryption/decryption), but there is no such recognisable content.

How to save LockBox 3 keys in the readable format? E.g. that I can use as a strings for encryption/decryption later?

TomR
  • 2,696
  • 6
  • 34
  • 87
  • 1
    It's base64 encoded. See [here](https://stackoverflow.com/a/29707204/327083). – J... Feb 11 '22 at 13:58
  • 1
    The keys are stored in binary format, not text. If you want a text version (and why? that would have no benefit), apply base 64 encoding. – Sean B. Durkin Feb 12 '22 at 05:46
  • 1
    @SeanB.Durkin There are circumstances where plain text is the natural medium of transmission and, [in those cases](https://security.stackexchange.com/q/220560/133870), a base64 encoding is commonly used (see the formats in the link I provided above, as an example). – J... Feb 12 '22 at 13:29

0 Answers0