snmpsend.pas - added Privacy encryption support. Supported are DES, 3DES and AES.
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@142 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
17
synautil.pas
17
synautil.pas
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 004.014.000 |
|
||||
| Project : Ararat Synapse | 004.014.001 |
|
||||
|==============================================================================|
|
||||
| Content: support procedures and functions |
|
||||
|==============================================================================|
|
||||
@ -324,6 +324,9 @@ function GetTempFile(const Dir, prefix: AnsiString): AnsiString;
|
||||
smaller, string is padded by Pad character.}
|
||||
function PadString(const Value: AnsiString; len: integer; Pad: AnsiChar): AnsiString;
|
||||
|
||||
{:XOR each byte in the strings}
|
||||
function XorString(Indata1, Indata2: AnsiString): AnsiString;
|
||||
|
||||
{:Read header from "Value" stringlist beginning at "Index" position. If header
|
||||
is Splitted into multiple lines, then this procedure de-split it into one line.}
|
||||
function NormalizeHeader(Value: TStrings; var Index: Integer): string;
|
||||
@ -1781,6 +1784,18 @@ end;
|
||||
|
||||
{==============================================================================}
|
||||
|
||||
function XorString(Indata1, Indata2: AnsiString): AnsiString;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
Indata2 := PadString(Indata2, length(Indata1), #0);
|
||||
Result := '';
|
||||
for i := 1 to length(Indata1) do
|
||||
Result := Result + AnsiChar(ord(Indata1[i]) xor ord(Indata2[i]));
|
||||
end;
|
||||
|
||||
{==============================================================================}
|
||||
|
||||
function NormalizeHeader(Value: TStrings; var Index: Integer): string;
|
||||
var
|
||||
s, t: string;
|
||||
|
Reference in New Issue
Block a user