|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
| Débuté par François Dussuet, 21 mar. 2026 09:42 - Aucune réponse |
| |
| | | |
|
| |
| Posté le 21 mars 2026 - 09:42 |
Bonjour
Est-ce que quelqu'un peut me traduire le code VB en Windev? Merci d'avance pour votre aide
- Indications sur le cryptage Algorythme AES (Rijndael) Longueur Key 128 Bit Longueur Bloc 128 Bit Mode CBC Padding PKCS7
- Déroulement du décryptage 1. Décoder le string Base64 2. Séparer le vecteur d'initialisation et les données: - Vecteur d'initialisation: les premiers 16 bytes - Données: les bytes restants 3. Décrypter les données
- Function: Public Function AutoiDecryption(ByVal InputStr As String, ByVal CryptKey As String) As String 'Décrypter les données Auto-i Web Service Daten 'Advanced Encryption Standard (Rijndael) Dim AES As RijndaelManaged Dim Buffer() As Byte Dim EncryptedBytes() As Byte Dim EncryptedBytesWithIV() As Byte Dim IVBytes As Byte() Const KEY_LENGTH As Integer = 16 Const IV_LENGTH As Integer = 16 AutoiDecryption = "" Try If CryptKey.Length = KEY_LENGTH Then 'Décoder Base64 EncryptedBytesWithIV = Convert.FromBase64String(InputStr)
'Séparer vecteur d'initialisation et données IVBytes = New Byte(IV_LENGTH - 1) {} EncryptedBytes = New Byte(EncryptedBytesWithIV.Length - IVBytes.Length - 1) {} Array.Copy(EncryptedBytesWithIV, 0, IVBytes, 0, IVBytes.Length) Array.Copy(EncryptedBytesWithIV, IVBytes.Length, EncryptedBytes, 0, EncryptedBytes.Length) 'Initialiser le Crypto Provider AES = New RijndaelManaged AES.Mode = CipherMode.CBC AES.KeySize = 128 AES.BlockSize = 128 AES.Padding = PaddingMode.PKCS7 AES.Key = System.Text.Encoding.Default.GetBytes(CryptKey) AES.IV = IVBytes
'Décrypter les données Buffer = AES.CreateDecryptor().TransformFinalBlock(EncryptedBytes, 0, EncryptedBytes.Length) AutoiDecryption = System.Text.Encoding.UTF8.GetString(Buffer) End If Catch ex As Exception AutoiDecryption = "" End Try End Function |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|