I'm using MBS example, that is:

Function DecryptAES(key as string, sourcefile as FolderItem, destfile as 
FolderItem) As Boolean
// decrypt file with AES and CFB

dim a as AESMBS = NewAES(key)
if a = nil then Return false

dim bi as BinaryStream = BinaryStream.Open(sourcefile,false)
if bi = nil then Return false

dim bo as BinaryStream = BinaryStream.Create(destfile)
if bo = nil then Return false

dim IVectorOffset as integer = 0
dim IVector as new MemoryBlock(16)

dim data as string = bi.Read(1000000)
while lenb(data)>0

dim idata as MemoryBlock = data
a.DecryptCFB128(idata, lenb(data), IVectorOffset, IVector, nil, 0, 0)

bo.Write idata

data = bi.Read(1000000)
wend


bo.Close
bi.Close

Return true

// exception handler for newer Real Studio version
'Exception io as ioexception

if bo<>nil then
destfile.Delete
end if

End Function


Function EncryptAES(key as string, sourcefile as FolderItem, destfile as 
FolderItem) As Boolean
// encrypt file with AES and CFB

dim a as AESMBS = NewAES(key)
if a = nil then Return false

dim bi as BinaryStream = BinaryStream.Open(sourcefile,false)
if bi = nil then Return false

dim bo as BinaryStream = BinaryStream.Create(destfile)
if bo = nil then Return false

dim IVectorOffset as integer = 0
dim IVector as new MemoryBlock(16)

dim data as string = bi.Read(1000000)
while lenb(data)>0

dim idata as MemoryBlock = data
a.EncryptCFB128(idata, lenb(data), IVectorOffset, IVector, nil, 0, 0)

bo.Write idata

data = bi.Read(1000000)
wend


bo.Close
bi.Close

Return true

// exception handler for newer Real Studio version
'Exception io as ioexception

if bo<>nil then
destfile.Delete
end if

End Function


Jean-Luc

Le 17/03/2014 17:53, Tim Jones a écrit :
> What function are you calling for the pass?
>
> Tim
>
> On Mar 17, 2014, at 9:45 AM, Jean-Luc Arnaud <[email protected]> wrote:
>
>> Ok, Thanks Christian and  Tim.
>>
>> So, I have another question.
>> When decrypting a file that is already decrypted, it seems like the
>> result is an encrypted file.
>> Then, encrypting this resulting file, I'm getting back my original file,
>> that is not encrypted.
>>
>> Is this a normal behavior?
>>
> _______________________________________________
> Mbsplugins_monkeybreadsoftware.info mailing list
> [email protected]
> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
>
>


-- 
Jean-Luc Arnaud
Directeur Technique


Centre Direct du Multimedia

BP 80032
5 rue du 8 Mai 1945
91470 - LIMOURS - FRANCE

Siret 403 860 034 000 20 / Evry

  

Tel : 33 (0)1 64 91 46 24
Fax : 33 (0)1 64 91 46 87
mailto:[email protected]
http://www.cdmultimedia.fr

Notre spécialité : Transfert de tous formats vidéo vers un format numérique 
DVD, AVI, QuickTime, …
Montage et authoring de DVD, archivage de vidéo et audio.
Duplication de petites séries et de grandes séries de CD et DVD
Matériel et prestation de duplication de clés USB, FlashCards, disquettes, …
Développement Mac et PC à façon.


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to