Beholfen habe ich mir jetzt dadurch das ich in der
Unit 'uTPLb_StreamUtils' von LockBox in der Funktion 'Stream_to_Base64' die Bereichsprüfung deaktiviert habe.
Delphi-Quellcode:
function Stream_to_Base64(ASource: TStream; const ATransform: TBytes = nil): TBytes;
var
pThreeBytes: packed array[ 0..2 ] of byte;
iBytesRead: integer;
P, j, i: integer;
pBase64Transform: TBytes;
begin
{$IFDEF DEBUG}
{$RANGECHECKS OFF}
{$ENDIF}
pBase64Transform := ATransform;
if pBase64Transform = nil then
pBase64Transform := AnsiBytesOf(Base64Chars);
SetLength(Result, (ASource.Size + 2) div 3 * 4);
ASource.Position := 0;
P := 0;
repeat
iBytesRead := ASource.Read( pThreeBytes, 3);
if iBytesRead = 0 then break;
for j := iBytesRead to 2 do
pThreeBytes[j] := 0;
for j := 0 to iBytesRead do
begin
result[ P ] := pBase64Transform[ ( pThreeBytes[0] shr 2) + 0];
Inc( P);
for i := 0 to 1 do
pThreeBytes[i] := (pThreeBytes[i] shl 6) + (pThreeBytes[i+1] shr 2);
pThreeBytes[ 2] := pThreeBytes[ 2] shl 6
end
until iBytesRead < 3;
if iBytesRead > 0 then
for j := iBytesRead to 2 do
begin
result[P] := Ord('=');
Inc( P)
end
{$IFDEF DEBUG}
{$RANGECHECKS ON}
{$ENDIF}
end;