L'auteur
Gregory Adam
Belgique Membre Actif (personne physique) # 0000001121 enregistré le 04/06/2006
Fiche personnelle
Note des membres
pas de note
|
Contributions > 01 - PRG : Programmation > Crypto - Hash - Compression
AES 128/192/256 classe compatible avec .Net
# 0000000826
ajouté le 18/06/2012 13:49:53 et modifié le 18/06/2012
consulté 621 fois

Niveau
initié
Version(s) Foxpro : VFP 9.0
Le téléchargement des pièces jointes est limité aux membres Veuillez vous identifier ou vous inscrire si vous n'avez pas encore de compte ...
|
| Description |
Classe qui permet de cypter/decrypter en AES
Utilise des API windows
Compatible .Net : restrictions
- CipherMode: CRYPT_MODE_CBC ou CRYPT_MODE_ECB
- PaddingMode : PADDINGMODE_PKCS7
1536 situations testees et comparees avec .Net AesManaged() - voir le fichier UnitTests.txt et la methode UnitTests()
|
| Code source : |
&& Create object
cipherMode = 1
paddingMode = 1
key = '1234567890123456' && 16, 24 or 32 bytes
iv = '1234567890123456' && 16 bytes - optional
obj = null
if( Aes_Object(@m.obj, m.cipherMode, m.paddingMode, m.key, m.iv) )
ok
endif
&& encrypt/decrypt strings
stringIn = '1234567'
stringOut = ''
if( m.obj.Encrypt_String(@m.stringOut, m.stringIn) )
?' encryted string: ', strconv(m.stringOut, 15)
endif
s = ''
if( m.obj.Decrypt_String(@m.s, m.stringOut) )
?' decryted string: ', m.s
endif
&& encrypt/decrypt files
if( m.obj.Encrypt_File(fileOut, fileIn) )
&& ok, fileOut contains encrypted fileIn
endif
if( m.obj.Decrypt_File(fileOut, fileIn) )
&& ok, fileOut contains decrypted fileIn
endif
&& support for binary ADO.Stream
if( m.obj.Encrypt_Stream(@m.streamOut, streamIn) )
ok
endif
if( m.obj.Decrypt_Stream(@m.streamOut, streamIn) )
ok
endif
|
| Commentaires |
Aucun commentaire enregistré ...
|