vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
sevDataGrid - Gönnen Sie Ihrem SQL-Kommando diesen krönenden Abschluß!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Re: AES Entschlüsselung 
Autor: Melkor
Datum: 05.06.08 11:12

Ich würde die Routine vielleicht so (wesentlich kürzer) schreiben, mit zusätzlicher padding Option.
    Public Function EncryptOrDecryptBytes(ByVal inp As Byte(), _
                ByVal bytKey() As Byte, _
                ByVal bytIV() As Byte, _
                ByVal Direction As CryptoAction, _
                ByVal padding As Security.Cryptography.PaddingMode, _
                ByVal mode As System.Security.Cryptography.CipherMode) As Byte()
 
        Dim fsOutput As New System.IO.MemoryStream()
        Dim csCryptoStream As Security.Cryptography.CryptoStream
        Dim cspRijndael As New System.Security.Cryptography.AesManaged
        Dim ict As ICryptoTransform = Nothing
 
        cspRijndael.Mode = mode
        cspRijndael.Padding = padding
 
        Select Case Direction
            Case CryptoAction.ActionEncrypt
                ict = cspRijndael.CreateEncryptor(bytKey, bytIV)
            Case CryptoAction.ActionDecrypt
                ict = cspRijndael.CreateDecryptor(bytKey, bytIV)
            Case Else
                Return Nothing
        End Select
 
        Try
            csCryptoStream = New Security.Cryptography.CryptoStream(fsOutput, _
                   ict, _
                   Security.Cryptography.CryptoStreamMode.Write)
            csCryptoStream.Write(inp, 0, inp.Length)
            csCryptoStream.FlushFinalBlock()
            csCryptoStream.Close()
        Catch ex As Exception
            MsgBox(ex.ToString())
        End Try
 
        Return fsOutput.ToArray()
 
    End Function

Those people who think they know everything are a great annoyance to those of us who do - Isaac Asimov

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
AES Entschlüsselung5.035HyP3r9203.06.08 18:16
Re: AES Entschlüsselung3.525Melkor03.06.08 19:37
Re: AES Entschlüsselung3.733HyP3r9204.06.08 21:28
Re: AES Entschlüsselung3.439Melkor04.06.08 21:48
Re: AES Entschlüsselung3.476HyP3r9204.06.08 21:58
Re: AES Entschlüsselung3.388Melkor05.06.08 08:26
Re: AES Entschlüsselung3.724Melkor05.06.08 11:12
Re: AES Entschlüsselung4.233HyP3r9205.06.08 13:41
Re: AES Entschlüsselung3.486Melkor05.06.08 14:04
Re: AES Entschlüsselung3.369HyP3r9205.06.08 14:11
Re: AES Entschlüsselung3.344Melkor05.06.08 14:30
Re: AES Entschlüsselung3.456HyP3r9205.06.08 14:46
Re: AES Entschlüsselung3.522Melkor05.06.08 15:20
Re: AES Entschlüsselung3.348HyP3r9205.06.08 18:49
Re: AES Entschlüsselung3.377Melkor05.06.08 19:02
Re: AES Entschlüsselung3.321HyP3r9205.06.08 19:20
Re: AES Entschlüsselung3.413Melkor05.06.08 19:44
Re: AES Entschlüsselung3.291HyP3r9205.06.08 19:54
Re: AES Entschlüsselung3.589Melkor06.06.08 08:47
Re: AES Entschlüsselung3.256HyP3r9206.06.08 13:20
Re: AES Entschlüsselung3.324Melkor06.06.08 13:35
Re: AES Entschlüsselung3.346HyP3r9206.06.08 13:48
Re: AES Entschlüsselung3.315HyP3r9206.06.08 14:30
Re: AES Entschlüsselung3.338Melkor06.06.08 14:52
Re: AES Entschlüsselung3.340HyP3r9206.06.08 16:51
Re: AES Entschlüsselung2.945Slayers19.03.12 19:29
Re: AES Entschlüsselung3.011ModeratorDaveS19.03.12 20:03
Re: AES Entschlüsselung2.982Melkor19.03.12 20:06
Re: AES Entschlüsselung3.255Slayers19.03.12 20:17
Re: AES Entschlüsselung3.036ModeratorDaveS19.03.12 20:37
Re: AES Entschlüsselung2.984Slayers19.03.12 20:45
Re: AES Entschlüsselung2.981pc-freack19.03.12 21:02
Re: AES Entschlüsselung2.936Slayers19.03.12 21:34
Re: AES Entschlüsselung2.972Slayers20.03.12 10:46
Re: AES Entschlüsselung2.895Melkor20.03.12 19:32
Re: AES Entschlüsselung2.950Slayers20.03.12 19:59
Re: AES Entschlüsselung2.971ModeratorDaveS20.03.12 20:11
Re: AES Entschlüsselung2.894Slayers20.03.12 20:39
Re: AES Entschlüsselung2.971ModeratorDaveS20.03.12 20:51

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel