PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in ..../includes/geshi.php on line 2147

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2010 [Help] Obsolete Code-VBForums
Results 1 to 4 of 4
  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2012
    Posts
    30

    Exclamation [Help] Obsolete Code

    Code:
        ' Use the password to generate key bytes.
        Private Sub MakeKeyAndIV(ByVal password As String, ByVal key_size_bits As Integer, ByVal block_size_bits As Integer, ByRef key As Byte(), ByRef iv As Byte())
            Dim password_derive_bytes As New PasswordDeriveBytes( _
                password, Nothing, "SHA384", 1000)
    
            key = password_derive_bytes.GetBytes(key_size_bits \ 8)
            iv = password_derive_bytes.GetBytes(block_size_bits \ 8)
        End Sub
    
    Warning	1	'Public Overrides Function GetBytes(cb As Integer) As Byte()' is obsolete: 'Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password and is preferred in new applications.'.
    I have found the above code on generating passwords but when I converted the whole project it displays 2 warnings that the code was obsolete but when I search google I didnt found any fix for that warning.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,153

    Re: [Help] Obsolete Code

    You don't need to search Google. The warning message itself tells you what to do:
    Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password and is preferred in new applications.
    You should be using the Rfc2898DeriveBytes class rather than the PasswordDeriveBytes class. The documentation can show you the usage but, while I've neevr used either myself, I think the two are used in basically the same way and it's just that the new class has an internal implementation that satisfies the latest standards.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2012
    Posts
    30

    Re: [Help] Obsolete Code

    I am getting an error if I change PasswordDeriveByres to Rfc2898DeriveBytes...

    vb Code:
    1. span style="color: #ff0000;">"SHA384"

    no accessible 'New' accepts this number of arguments...

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,153

    Re: [Help] Obsolete Code

    So have a look at the MSDN documentation for the Rfc2898DeriveBytes class and see what parameters its constructors do have. You should also be reading the documentation to see how it works. Like I said, I've never actually used it so, while I can say that they are similar from what little I've seen, I can't say whether they are the same.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width