Jump to content
softtouch

Lockbox 3 GenerateKeys = Range Check Error

Recommended Posts

Delphi 12.2, I installed LockBox 3 via GetIt. So far so good.

 

I try to generate public and private keys, but I get all the time a range check error.

 

Here is the example code:


 

  CryptoLib := TCryptographicLibrary.Create(nil);
  CodecRSA := TCodec.Create(nil);
  Signatory := TSignatory.Create(nil);

  CodecRSA.CryptoLibrary := CryptoLib;
  CodecRSA.StreamCipherId := 'native.RSA';
  CodecRSA.AsymetricKeySizeInBits := 1024;
  Signatory.Codec := CodecRSA;

  Signatory.GenerateKeys;  // <== Range Check Error

  Signatory.Free;
  CodecRSA.Free;
  CryptoLib.Free;

 

What am I doing wrong?

Share this post


Link to post
54 minutes ago, softtouch said:

Delphi 12.2, I installed LockBox 3 via GetIt. So far so good.

 

I try to generate public and private keys, but I get all the time a range check error.

 

Here is the example code:


 


  CryptoLib := TCryptographicLibrary.Create(nil);
  CodecRSA := TCodec.Create(nil);
  Signatory := TSignatory.Create(nil);

  CodecRSA.CryptoLibrary := CryptoLib;
  CodecRSA.StreamCipherId := 'native.RSA';
  CodecRSA.AsymetricKeySizeInBits := 1024;
  Signatory.Codec := CodecRSA;

  Signatory.GenerateKeys;  // <== Range Check Error

  Signatory.Free;
  CodecRSA.Free;
  CryptoLib.Free;

 

What am I doing wrong?

Probably nothing :). The default setting for range checking changed to "on" and the Lockbox version in GetIt may not reflect that yet. Try to use the latest version from github instead: https://github.com/TurboPack/LockBox3

Share this post


Link to post

I just installed the latest version from github, it does exactly the same.

Share this post


Link to post
-                b8_1  := P8^ shl ShiftAmnt; 
+                b8_1  := Byte(P8^ shl ShiftAmnt); //(3 shl 7) do not fit into Byte

-                b8_1 := P8^ shl ShiftComp8;
+                b8_1 := Byte(P8^ shl ShiftComp8);

-  PoweredFactor, Power, iFactor: integer;
+  PoweredFactor, Power, iFactor: uint32;

After some changes in /run/utilities/uTPLb_HugeCardinal.pas no more errors... but it works?

If it worked with range checking OFF then probably it will work.

Edited by Cristian Peța

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×