Click here to Skip to main content
15,900,362 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: Session Array Problem Pin
Brendan Vogt16-Aug-07 0:12
Brendan Vogt16-Aug-07 0:12 
AnswerRe: Session Array Problem Pin
Christian Graus16-Aug-07 0:28
protectorChristian Graus16-Aug-07 0:28 
GeneralRe: Session Array Problem Pin
Tom Deketelaere16-Aug-07 1:11
professionalTom Deketelaere16-Aug-07 1:11 
Questionvb.net Pin
rampraba15-Aug-07 23:27
rampraba15-Aug-07 23:27 
AnswerRe: vb.net Pin
Zia Ul Haq Soofi15-Aug-07 23:49
Zia Ul Haq Soofi15-Aug-07 23:49 
AnswerRe: vb.net Pin
Taylor Kobani15-Aug-07 23:55
Taylor Kobani15-Aug-07 23:55 
AnswerRe: vb.net Pin
Christian Graus15-Aug-07 23:56
protectorChristian Graus15-Aug-07 23:56 
QuestionPadding is invalid and cannot be removed. Pin
WhiteGirl2315-Aug-07 22:50
WhiteGirl2315-Aug-07 22:50 
I have an error : Padding is invalid and cannot be removed.

I want to decrypt a file but I receive that error.
My code looks like this:
Sub DecryptTextFromFile(ByVal Key() As Byte, ByVal IV() As Byte)<br />
        Dim var As String = My.Application.Info.DirectoryPath + "\text.txt"<br />
<br />
        Try<br />
            ' Create or open the specified file. <br />
            Dim fStream As FileStream = File.Open(var, FileMode.OpenOrCreate)<br />
<br />
<br />
            ' Create a new Rijndael object.<br />
            Dim RijndaelAlg As Rijndael = Rijndael.Create<br />
<br />
            ' Create a CryptoStream using the FileStream <br />
            ' and the passed key and initialization vector (IV).<br />
            Dim cStream As New CryptoStream(fStream, _<br />
                                            RijndaelAlg.CreateDecryptor(Key, IV), _<br />
                                            CryptoStreamMode.Read)<br />
<br />
            RijndaelAlg.Padding = PaddingMode.PKCS7<br />
<br />
<br />
<br />
            ' Create a StreamReader using the CryptoStream.<br />
            Dim sReader As StreamReader = New StreamReader(cStream)<br />
<br />
            dim var23 as String=sReader.ReadLine()<br />
<br />
<br />
<br />
            'Read the data from the stream <br />
            'to decrypt it.<br />
            Dim val As String = ""<br />
            Try<br />
<br />
                val = sReader.ReadLine()<br />
<br />
            Catch e As Exception<br />
                MessageBox.Show("An error occurred: {0}", e.Message)<br />
            Finally<br />
                ' Close the streams and<br />
                ' close the file.<br />
                sReader.Close()<br />
                cStream.Close()<br />
                fStream.Close()<br />
<br />
<br />
            End Try<br />
<br />
            Catch e As CryptographicException<br />
            MessageBox.Show("A Cryptographic error occurred: {0}", e.Message)<br />
            'Return Nothing<br />
        Catch e As UnauthorizedAccessException<br />
            MessageBox.Show("A file error occurred: {0}", e.Message)<br />
            'Return Nothing<br />
        End Try<br />
<br />
   <br />
    End Sub



Thanks.

I search google but I didn't find something that can help me.
AnswerRe: Padding is invalid and cannot be removed. Pin
Luc Pattyn15-Aug-07 23:58
sitebuilderLuc Pattyn15-Aug-07 23:58 
GeneralRe: Padding is invalid and cannot be removed. Pin
WhiteGirl2316-Aug-07 2:09
WhiteGirl2316-Aug-07 2:09 
QuestionError when add a record in the database Pin
Mekong River15-Aug-07 22:24
Mekong River15-Aug-07 22:24 
AnswerRe: Error when add a record in the database Pin
Christian Graus15-Aug-07 22:33
protectorChristian Graus15-Aug-07 22:33 
GeneralRe: Error when add a record in the database Pin
MartyK200715-Aug-07 22:56
MartyK200715-Aug-07 22:56 
GeneralRe: Error when add a record in the database Pin
Mekong River15-Aug-07 23:07
Mekong River15-Aug-07 23:07 
GeneralRe: Error when add a record in the database Pin
MartyK200715-Aug-07 23:09
MartyK200715-Aug-07 23:09 
GeneralRe: Error when add a record in the database Pin
Mekong River15-Aug-07 23:11
Mekong River15-Aug-07 23:11 
GeneralRe: Error when add a record in the database Pin
MartyK200715-Aug-07 23:22
MartyK200715-Aug-07 23:22 
GeneralRe: Error when add a record in the database Pin
Mekong River15-Aug-07 23:05
Mekong River15-Aug-07 23:05 
GeneralRe: Error when add a record in the database Pin
Christian Graus15-Aug-07 23:21
protectorChristian Graus15-Aug-07 23:21 
GeneralRe: Error when add a record in the database Pin
Tom Deketelaere15-Aug-07 23:24
professionalTom Deketelaere15-Aug-07 23:24 
GeneralRe: Error when add a record in the database Pin
Mekong River15-Aug-07 23:54
Mekong River15-Aug-07 23:54 
GeneralRe: Error when add a record in the database Pin
Christian Graus15-Aug-07 23:57
protectorChristian Graus15-Aug-07 23:57 
GeneralRe: Error when add a record in the database Pin
Mekong River16-Aug-07 0:01
Mekong River16-Aug-07 0:01 
GeneralRe: Error when add a record in the database Pin
Christian Graus16-Aug-07 0:11
protectorChristian Graus16-Aug-07 0:11 
GeneralRe: Error when add a record in the database Pin
Mekong River16-Aug-07 0:19
Mekong River16-Aug-07 0:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.