<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I have try with this code but not work, I have test the function
give me the same result:<br>
<br>
var<br>
Cipher: TDCP_des;<br>
KeyStr: string;<br>
TextIn, TextOut : String;<br>
Hash: TDCP_sha1;<br>
Digest: array[0..19] of byte;<br>
Vector : array of Byte;<br>
<br>
src, enc, b64: TBytes;<br>
index, lunghezza, blocksize, paddingsize: integer; <br>
<br>
begin<br>
SetLength(Vector, 8);<br>
<br>
Vector[0] := 1;<br>
Vector[1] := 2;<br>
Vector[2] := 3;<br>
Vector[3] := 4;<br>
Vector[4] := 5;<br>
Vector[5] := 6;<br>
Vector[6] := 7;<br>
Vector[7] := 8;<br>
<br>
Cipher := TDCP_des.Create(Self); <br>
Cipher.Init('cicciob1',Length('cicciob1')*8, addr(Vector[0]));<br>
TextIn := Edit1.Text;<br>
lunghezza := Length(TextIn);<br>
index := SizeOf(TextIn);<br>
blocksize := Cipher.BlockSize div 8;<br>
paddingsize:= blocksize - (lunghezza mod blocksize);<br>
Inc(lunghezza, paddingsize);<br>
SetLength(TextIn, lunghezza);<br>
for index:=paddingsize downto 1 do<br>
begin<br>
TextIn[lunghezza - index] := char(0); <br>
end;<br>
index := Length(TextOut);<br>
SetLength(TextOut, lunghezza);<br>
Cipher.EncryptCBC(TextIn[1], TextOut[1], length(TextIn));<br>
Edit2.Text:=EncodeStringBase64(TextOut); <br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Il 15/11/2015 11:59, Sven Barth ha
scritto:<br>
</div>
<blockquote
cite="mid:CAFMUeB8P_xRyngTUFNqM7ew40WbZs8OkwC1vkqu0NdxhcHFraA@mail.gmail.com"
type="cite">
<p>Am 15.11.2015 06:31 schrieb "Gabriele Cappelletto" <<a
moz-do-not-send="true"
href="mailto:cappellettogabriele@yahoo.it"><a class="moz-txt-link-abbreviated" href="mailto:cappellettogabriele@yahoo.it">cappellettogabriele@yahoo.it</a></a>>:<br>
><br>
><br>
><br>
> Il 14/11/2015 18:11, Graeme Geldenhuys ha scritto:<br>
> > On 2015-11-14 09:44, Gabriele Cappelletto wrote:<br>
> >> the .net DESCryptoServiceProvider.<br>
> > Please show how the data was encrypted... The exact
code snippet would<br>
> > be useful. I could then show you how to use DCPCrypt
with the same<br>
> > settings to decrypt it.<br>
> ><br>
> > Without knowing how it was encrypted, there is no way
anybody can show<br>
> > you code on how to decrypt it.<br>
> ><br>
> > Regards,<br>
> > - Graeme -<br>
> > Ok thanks. We start from the opposite. cryptographer a
string with <a moz-do-not-send="true" href="http://vb.net">vb.net</a>
with the following code, what's the code to decrypt it with
DCPCrypt?<br>
><br>
> Ok thanks. We start from the opposite. cryptographer a
string with<br>
> <a moz-do-not-send="true" href="http://vb.net">vb.net</a>
with the following code, what's the code to decrypt it with
DCPCrypt?<br>
><br>
> Dim Key() As Byte = {}<br>
> Dim IV() As Byte = {1, 2, 3, 4, 5, 6, 7, 8}<br>
><br>
> Dim KeyStr As String = "cicciob1"<br>
> Dim vector As String = "12345678"<br>
> Dim inputByteArray(TextBox3.Text.Length) As Byte<br>
> Dim des As New DESCryptoServiceProvider<br>
> 'des.Mode = CipherMode.CBC<br>
> 'des.Padding = PaddingMode.Zeros<br>
> Key = System.Text.Encoding.UTF8.GetBytes(KeyStr)<br>
> inputByteArray =
Encoding.UTF8.GetBytes(TextBox3.Text)<br>
><br>
> Dim ms As New MemoryStream<br>
> Dim cs As New CryptoStream(ms,
des.CreateEncryptor(Key, IV),<br>
> CryptoStreamMode.Write)<br>
> cs.Write(inputByteArray, 0, inputByteArray.Length)<br>
> cs.FlushFinalBlock()<br>
><br>
> TextBox4.Text = Convert.ToBase64String(ms.ToArray)</p>
<p>What did you try in the Pascal side (code please)? Did you
decode the Base64 stream before passing the data to the
decryption?</p>
<p>Regards,<br>
Sven</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<br>
</body>
</html>