Jan Doggen
Jan Doggen

Reputation: 9096

E2134 Error in Turbopower LockBox code when building with runtime type information

I have to build my program with runtime type information, so compiler option Emit runtime type information is checked.
But with this set the LockBox3 unit uTPLb_codecIntf.pas gives error E2134 Type has no type info on the line containing Implementation (see bottom of source).

The LockBox3\run\ (source) folders are in my library path (as specified by the installation).
LockBox DCU's are in d:\LockBox3\packages\Sydney\Delphi\Win32\Release\ and date from the time of installation.

How can I get rid of the error message yet have RTTI available?

Edit FWIW, these are the contents of uTPLb_codecIntf.pas:

interface
uses SysUtils, Classes, uTPLb_StreamCipher, uTPLb_BlockCipher,
     uTPLb_CryptographicLibrary;

type
TCodecMode = (cmUnitialized, cmIdle, cmEncrypting, cmDecrypting);

TOnEncDecProgress = function ( Sender: TObject; CountBytesProcessed: int64): boolean of object;

TGenerateAsymetricKeyPairProgress = procedure (
  Sender: TObject; CountPrimalityTests: integer;
  var doAbort: boolean) of object;


ICodec = interface
  ['{48B3116A-5681-4E79-9013-8EC89BAC5B35}']
    procedure SetStreamCipher( const Value: IStreamCipher);
    procedure SetBlockCipher ( const Value: IBlockCipher);
    procedure SetChainMode   ( const Value: IBlockChainingModel);
    function  GetMode: TCodecMode;
    function  GetStreamCipher: IStreamCipher;
    function  GetBlockCipher : IBlockCipher;
    function  GetChainMode   : IBlockChainingModel;
    function  GetOnProgress  : TOnEncDecProgress;
    procedure SetOnProgress( Value: TOnEncDecProgress);
    function  GetAsymetricKeySizeInBits: cardinal;
    procedure SetAsymetricKeySizeInBits( value: cardinal);
    function  GetAsymGenProgressEvent: TGenerateAsymetricKeyPairProgress;
    procedure SetAsymGenProgressEvent( Value: TGenerateAsymetricKeyPairProgress);
    function  GetKey: TSymetricKey;

    function  GetCipherDisplayName( Lib: TCryptographicLibrary): string;

    procedure Init(const Key: string; AEncoding: TEncoding);
    procedure SaveKeyToStream( Store: TStream);
    procedure InitFromStream( Store: TStream);
    procedure InitFromKey( Key: TSymetricKey);   // Transfers ownership.
    procedure Reset;
    procedure Burn( doIncludeBurnKey: boolean);

    // Asymetric support
    function  isAsymetric: boolean;
    procedure InitFromGeneratedAsymetricKeyPair;

    procedure Sign(
      Document, Signature: TStream;
      ProgressSender: TObject;
      ProgressEvent: TOnEncDecProgress;
      SigningKeys_PrivatePart: TObject;  // Must be uTPLb_Asymetric.TAsymtricKeyPart
      var wasAborted: boolean);

    function VerifySignature(
      Document, Signature: TStream;
      ProgressSender: TObject;
      ProgressEvent: TOnEncDecProgress;
      SigningKeys_PublicPart: TObject; // Must be uTPLb_Asymetric.TAsymtricKeyPart
      var wasAborted: boolean): boolean;


    procedure Begin_EncryptMemory( CipherText{out}: TStream);
    procedure EncryptMemory(const Plaintext: TBytes; PlaintextLen: Integer);
    procedure End_EncryptMemory;

    procedure Begin_DecryptMemory( PlainText{out}: TStream);
    procedure DecryptMemory( const CipherText{in}; CiphertextLen: integer);
    procedure End_DecryptMemory;

    procedure EncryptStream( Plaintext, CipherText: TStream);
    procedure DecryptStream( Plaintext, CipherText: TStream);

    procedure EncryptFile( const Plaintext_FileName, CipherText_FileName: string);
    procedure DecryptFile( const Plaintext_FileName, CipherText_FileName: string);

    procedure EncryptString(const Plaintext: string; var CipherText_Base64: string; AEncoding: TEncoding);
    procedure DecryptString(var Plaintext: string; const CipherText_Base64: string; AEncoding: TEncoding);

    procedure EncryptAnsiString(const Plaintext: string; var CipherText_Base64: string);
    procedure DecryptAnsiString(var Plaintext: string; const CipherText_Base64: string);

    function  GetAborted: boolean;
    procedure SetAborted( Value: boolean);
    function  GetAdvancedOptions2 : TSymetricEncryptionOptionSet;
    procedure SetAdvancedOptions2( Value: TSymetricEncryptionOptionSet);
    function  GetOnSetIV: TSetMemStreamProc;
    procedure SetOnSetIV( Value: TSetMemStreamProc);

    property  Mode: TCodecMode                   read GetMode;
    property  Key: TSymetricKey                  read GetKey;
    property  StreamCipher: IStreamCipher        read GetStreamCipher write SetStreamCipher;
    property  BlockCipher : IBlockCipher         read GetBlockCipher  write SetBlockCipher;
    property  ChainMode   : IBlockChainingModel  read GetChainMode    write SetChainMode;
    property  OnProgress  : TOnEncDecProgress    read GetonProgress   write SetOnProgress;
    property  AsymetricKeySizeInBits: cardinal   read GetAsymetricKeySizeInBits
                                                 write SetAsymetricKeySizeInBits;
    property  OnAsymGenProgress: TGenerateAsymetricKeyPairProgress
                                           read GetAsymGenProgressEvent write SetAsymGenProgressEvent;
    property isUserAborted: boolean              read GetAborted write SetAborted;
  end;


implementation

end.

Upvotes: 1

Views: 184

Answers (2)

Jan Doggen
Jan Doggen

Reputation: 9096

The fact that the LockBox writers suggest to place the source folders in your library path, does not mean you have to. It's handy for tracing into their code, but not required.

Just remove them from that list and add the .dcu directory d:\LockBox3\packages\Sydney\Delphi\Win32\Release\ to it.

This makes the error go away, and I don't need RTTI in the LockBox sources.

Upvotes: 2

Dsm
Dsm

Reputation: 6013

You need to rebuild the dcus with run time information. The simplest way to do this (which also only includes the dcu in this project, not all projects) is to include the source file uTPLb_codecIntf.pas in you project and build the project. You may need to repeat the process for other source files depending on what RTTI you need.

Upvotes: 1

Related Questions