|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Difference between VS2003 / VS20005 causes CRYPTO BAD DATA exceptiHi there. Can you help?
My encrypton / decryption routines work fine with exactly the same code if: (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 but if I try to decrypt a string encrypted via VS2005 but using VS2003 (or the other way round) I get a Bad Data exception. Any ideas? Are there specific differences between the Crypto classes in each VS version or the .NET Framework versions? Thanks If there's really a difference, it's may be a bug, or it should perhaps be
documented on the breaking change list at http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. You may wish to report this as a bug at http://lab.msdn.microsoft.com/productfeedback/default.aspx, along with sample code so that others may try to reproduce the problem. Show quoteHide quote "KCS" <K**@discussions.microsoft.com> wrote in message news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... > Hi there. Can you help? > > My encrypton / decryption routines work fine with exactly the same code > if: > > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 > > but if I try to decrypt a string encrypted via VS2005 but using VS2003 (or > the other way round) I get a Bad Data exception. > > Any ideas? > > Are there specific differences between the Crypto classes in each VS > version > or the .NET Framework versions? > > Thanks > Hi there Nicole.
It was because I was using ASCIIEncoding.GetString after first using ComputeHash. This produces different results on the .NET FW 1.1 and 2.0. So trying to decipher a key on one FW did not work if created on the other FW. I amended my routine to use UTF8Encoding.GetString instead. Thanks. Kevin Show quoteHide quote "Nicole Calinoiu" wrote: > If there's really a difference, it's may be a bug, or it should perhaps be > documented on the breaking change list at > http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. > You may wish to report this as a bug at > http://lab.msdn.microsoft.com/productfeedback/default.aspx, along with > sample code so that others may try to reproduce the problem. > > > > "KCS" <K**@discussions.microsoft.com> wrote in message > news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... > > Hi there. Can you help? > > > > My encrypton / decryption routines work fine with exactly the same code > > if: > > > > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or > > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 > > > > but if I try to decrypt a string encrypted via VS2005 but using VS2003 (or > > the other way round) I get a Bad Data exception. > > > > Any ideas? > > > > Are there specific differences between the Crypto classes in each VS > > version > > or the .NET Framework versions? > > > > Thanks > > > > > The ComputeHash method returns an arbitrary byte array that should not be
converted to a string with eithe ASCIIEncoding or UTFEncoding as there could be unprintable characters with either encoding. You should use Convert.ToBase64String for this purpose. It allows lossless roundtrips from byte[] to string. Joe K. Show quoteHide quote "KCS" <K**@discussions.microsoft.com> wrote in message news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... > Hi there Nicole. > > It was because I was using ASCIIEncoding.GetString after first using > ComputeHash. This produces different results on the .NET FW 1.1 and 2.0. > So > trying to decipher a key on one FW did not work if created on the other > FW. I > amended my routine to use UTF8Encoding.GetString instead. > > Thanks. Kevin > > > "Nicole Calinoiu" wrote: > >> If there's really a difference, it's may be a bug, or it should perhaps >> be >> documented on the breaking change list at >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >> You may wish to report this as a bug at >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along with >> sample code so that others may try to reproduce the problem. >> >> >> >> "KCS" <K**@discussions.microsoft.com> wrote in message >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >> > Hi there. Can you help? >> > >> > My encrypton / decryption routines work fine with exactly the same code >> > if: >> > >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >> > >> > but if I try to decrypt a string encrypted via VS2005 but using VS2003 >> > (or >> > the other way round) I get a Bad Data exception. >> > >> > Any ideas? >> > >> > Are there specific differences between the Crypto classes in each VS >> > version >> > or the .NET Framework versions? >> > >> > Thanks >> > >> >> >> April 6, 2005
I have seen a lot of examples and I didn't know that UTF or ASCII drops bytes. Thanks for stating that. By the way, do you know if UnicodeEncoding does? Right now, I believe that it doesn't, but I haven't actually read that. Joseph MCAD Show quoteHide quote "Joe Kaplan (MVP - ADSI)" wrote: > The ComputeHash method returns an arbitrary byte array that should not be > converted to a string with eithe ASCIIEncoding or UTFEncoding as there could > be unprintable characters with either encoding. You should use > Convert.ToBase64String for this purpose. It allows lossless roundtrips from > byte[] to string. > > Joe K. > > > "KCS" <K**@discussions.microsoft.com> wrote in message > news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... > > Hi there Nicole. > > > > It was because I was using ASCIIEncoding.GetString after first using > > ComputeHash. This produces different results on the .NET FW 1.1 and 2.0. > > So > > trying to decipher a key on one FW did not work if created on the other > > FW. I > > amended my routine to use UTF8Encoding.GetString instead. > > > > Thanks. Kevin > > > > > > "Nicole Calinoiu" wrote: > > > >> If there's really a difference, it's may be a bug, or it should perhaps > >> be > >> documented on the breaking change list at > >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. > >> You may wish to report this as a bug at > >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along with > >> sample code so that others may try to reproduce the problem. > >> > >> > >> > >> "KCS" <K**@discussions.microsoft.com> wrote in message > >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... > >> > Hi there. Can you help? > >> > > >> > My encrypton / decryption routines work fine with exactly the same code > >> > if: > >> > > >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or > >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 > >> > > >> > but if I try to decrypt a string encrypted via VS2005 but using VS2003 > >> > (or > >> > the other way round) I get a Bad Data exception. > >> > > >> > Any ideas? > >> > > >> > Are there specific differences between the Crypto classes in each VS > >> > version > >> > or the .NET Framework versions? > >> > > >> > Thanks > >> > > >> > >> > >> > > > None of the unicode formats are intended for encoding of binary data.
UnicodeEncoding (which is just UTF-16) will present the same general set of problems as ASCII, UTF-7, or UTF-8 if one attempts to use it for encoding binary data. Show quoteHide quote "Joseph MCAD" <JosephM***@discussions.microsoft.com> wrote in message news:8BFE7935-F9B2-4A56-917B-D62166CB4773@microsoft.com... > > April 6, 2005 > > I have seen a lot of examples and I didn't know that UTF or ASCII > drops > bytes. Thanks for stating that. By the way, do you know if UnicodeEncoding > does? Right now, I believe that it doesn't, but I haven't actually read > that. > > > Joseph MCAD > > > "Joe Kaplan (MVP - ADSI)" wrote: > >> The ComputeHash method returns an arbitrary byte array that should not be >> converted to a string with eithe ASCIIEncoding or UTFEncoding as there >> could >> be unprintable characters with either encoding. You should use >> Convert.ToBase64String for this purpose. It allows lossless roundtrips >> from >> byte[] to string. >> >> Joe K. >> >> >> "KCS" <K**@discussions.microsoft.com> wrote in message >> news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... >> > Hi there Nicole. >> > >> > It was because I was using ASCIIEncoding.GetString after first using >> > ComputeHash. This produces different results on the .NET FW 1.1 and >> > 2.0. >> > So >> > trying to decipher a key on one FW did not work if created on the other >> > FW. I >> > amended my routine to use UTF8Encoding.GetString instead. >> > >> > Thanks. Kevin >> > >> > >> > "Nicole Calinoiu" wrote: >> > >> >> If there's really a difference, it's may be a bug, or it should >> >> perhaps >> >> be >> >> documented on the breaking change list at >> >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >> >> You may wish to report this as a bug at >> >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along with >> >> sample code so that others may try to reproduce the problem. >> >> >> >> >> >> >> >> "KCS" <K**@discussions.microsoft.com> wrote in message >> >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >> >> > Hi there. Can you help? >> >> > >> >> > My encrypton / decryption routines work fine with exactly the same >> >> > code >> >> > if: >> >> > >> >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >> >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >> >> > >> >> > but if I try to decrypt a string encrypted via VS2005 but using >> >> > VS2003 >> >> > (or >> >> > the other way round) I get a Bad Data exception. >> >> > >> >> > Any ideas? >> >> > >> >> > Are there specific differences between the Crypto classes in each VS >> >> > version >> >> > or the .NET Framework versions? >> >> > >> >> > Thanks >> >> > >> >> >> >> >> >> >> >> >> April 6, 2005
Thanks for posting that! Do you know of any place that lists what the different encodings are used for? Thanks again! Joseph MCAD Show quoteHide quote "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message news:OI0khxsOFHA.3880@tk2msftngp13.phx.gbl... > None of the unicode formats are intended for encoding of binary data. > UnicodeEncoding (which is just UTF-16) will present the same general set > of problems as ASCII, UTF-7, or UTF-8 if one attempts to use it for > encoding binary data. > > > > "Joseph MCAD" <JosephM***@discussions.microsoft.com> wrote in message > news:8BFE7935-F9B2-4A56-917B-D62166CB4773@microsoft.com... >> >> April 6, 2005 >> >> I have seen a lot of examples and I didn't know that UTF or ASCII >> drops >> bytes. Thanks for stating that. By the way, do you know if >> UnicodeEncoding >> does? Right now, I believe that it doesn't, but I haven't actually read >> that. >> >> >> Joseph MCAD >> >> >> "Joe Kaplan (MVP - ADSI)" wrote: >> >>> The ComputeHash method returns an arbitrary byte array that should not >>> be >>> converted to a string with eithe ASCIIEncoding or UTFEncoding as there >>> could >>> be unprintable characters with either encoding. You should use >>> Convert.ToBase64String for this purpose. It allows lossless roundtrips >>> from >>> byte[] to string. >>> >>> Joe K. >>> >>> >>> "KCS" <K**@discussions.microsoft.com> wrote in message >>> news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... >>> > Hi there Nicole. >>> > >>> > It was because I was using ASCIIEncoding.GetString after first using >>> > ComputeHash. This produces different results on the .NET FW 1.1 and >>> > 2.0. >>> > So >>> > trying to decipher a key on one FW did not work if created on the >>> > other >>> > FW. I >>> > amended my routine to use UTF8Encoding.GetString instead. >>> > >>> > Thanks. Kevin >>> > >>> > >>> > "Nicole Calinoiu" wrote: >>> > >>> >> If there's really a difference, it's may be a bug, or it should >>> >> perhaps >>> >> be >>> >> documented on the breaking change list at >>> >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >>> >> You may wish to report this as a bug at >>> >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along >>> >> with >>> >> sample code so that others may try to reproduce the problem. >>> >> >>> >> >>> >> >>> >> "KCS" <K**@discussions.microsoft.com> wrote in message >>> >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >>> >> > Hi there. Can you help? >>> >> > >>> >> > My encrypton / decryption routines work fine with exactly the same >>> >> > code >>> >> > if: >>> >> > >>> >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >>> >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >>> >> > >>> >> > but if I try to decrypt a string encrypted via VS2005 but using >>> >> > VS2003 >>> >> > (or >>> >> > the other way round) I get a Bad Data exception. >>> >> > >>> >> > Any ideas? >>> >> > >>> >> > Are there specific differences between the Crypto classes in each >>> >> > VS >>> >> > version >>> >> > or the .NET Framework versions? >>> >> > >>> >> > Thanks >>> >> > >>> >> >>> >> >>> >> >>> >>> >>> > > There's a brief summary of some the more popular encodings at
http://anakin.ncst.ernet.in/~aparna/consolidated/x459.html. Except for base64, all of the encodings listed there are meant for representation of string data in binary form. Base64 is intended for representation of non-string binary data as ASCII. Show quoteHide quote "Joseph MCAD" <anonym***@discussions.microsoft.com> wrote in message news:e%23PCjQtOFHA.3076@TK2MSFTNGP12.phx.gbl... > April 6, 2005 > > Thanks for posting that! Do you know of any place that lists what the > different encodings are used for? Thanks again! > > > > Joseph MCAD > > > > > > "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message > news:OI0khxsOFHA.3880@tk2msftngp13.phx.gbl... >> None of the unicode formats are intended for encoding of binary data. >> UnicodeEncoding (which is just UTF-16) will present the same general set >> of problems as ASCII, UTF-7, or UTF-8 if one attempts to use it for >> encoding binary data. >> >> >> >> "Joseph MCAD" <JosephM***@discussions.microsoft.com> wrote in message >> news:8BFE7935-F9B2-4A56-917B-D62166CB4773@microsoft.com... >>> >>> April 6, 2005 >>> >>> I have seen a lot of examples and I didn't know that UTF or ASCII >>> drops >>> bytes. Thanks for stating that. By the way, do you know if >>> UnicodeEncoding >>> does? Right now, I believe that it doesn't, but I haven't actually read >>> that. >>> >>> >>> Joseph MCAD >>> >>> >>> "Joe Kaplan (MVP - ADSI)" wrote: >>> >>>> The ComputeHash method returns an arbitrary byte array that should not >>>> be >>>> converted to a string with eithe ASCIIEncoding or UTFEncoding as there >>>> could >>>> be unprintable characters with either encoding. You should use >>>> Convert.ToBase64String for this purpose. It allows lossless roundtrips >>>> from >>>> byte[] to string. >>>> >>>> Joe K. >>>> >>>> >>>> "KCS" <K**@discussions.microsoft.com> wrote in message >>>> news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... >>>> > Hi there Nicole. >>>> > >>>> > It was because I was using ASCIIEncoding.GetString after first using >>>> > ComputeHash. This produces different results on the .NET FW 1.1 and >>>> > 2.0. >>>> > So >>>> > trying to decipher a key on one FW did not work if created on the >>>> > other >>>> > FW. I >>>> > amended my routine to use UTF8Encoding.GetString instead. >>>> > >>>> > Thanks. Kevin >>>> > >>>> > >>>> > "Nicole Calinoiu" wrote: >>>> > >>>> >> If there's really a difference, it's may be a bug, or it should >>>> >> perhaps >>>> >> be >>>> >> documented on the breaking change list at >>>> >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >>>> >> You may wish to report this as a bug at >>>> >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along >>>> >> with >>>> >> sample code so that others may try to reproduce the problem. >>>> >> >>>> >> >>>> >> >>>> >> "KCS" <K**@discussions.microsoft.com> wrote in message >>>> >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >>>> >> > Hi there. Can you help? >>>> >> > >>>> >> > My encrypton / decryption routines work fine with exactly the same >>>> >> > code >>>> >> > if: >>>> >> > >>>> >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >>>> >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >>>> >> > >>>> >> > but if I try to decrypt a string encrypted via VS2005 but using >>>> >> > VS2003 >>>> >> > (or >>>> >> > the other way round) I get a Bad Data exception. >>>> >> > >>>> >> > Any ideas? >>>> >> > >>>> >> > Are there specific differences between the Crypto classes in each >>>> >> > VS >>>> >> > version >>>> >> > or the .NET Framework versions? >>>> >> > >>>> >> > Thanks >>>> >> > >>>> >> >>>> >> >>>> >> >>>> >>>> >>>> >> >> > > April 6, 2005
Thanks a lot! Joseph MCAD Show quoteHide quote "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message news:eRoEHatOFHA.2520@tk2msftngp13.phx.gbl... > There's a brief summary of some the more popular encodings at > http://anakin.ncst.ernet.in/~aparna/consolidated/x459.html. Except for > base64, all of the encodings listed there are meant for representation of > string data in binary form. Base64 is intended for representation of > non-string binary data as ASCII. > > > "Joseph MCAD" <anonym***@discussions.microsoft.com> wrote in message > news:e%23PCjQtOFHA.3076@TK2MSFTNGP12.phx.gbl... >> April 6, 2005 >> >> Thanks for posting that! Do you know of any place that lists what the >> different encodings are used for? Thanks again! >> >> >> >> Joseph MCAD >> >> >> >> >> >> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message >> news:OI0khxsOFHA.3880@tk2msftngp13.phx.gbl... >>> None of the unicode formats are intended for encoding of binary data. >>> UnicodeEncoding (which is just UTF-16) will present the same general set >>> of problems as ASCII, UTF-7, or UTF-8 if one attempts to use it for >>> encoding binary data. >>> >>> >>> >>> "Joseph MCAD" <JosephM***@discussions.microsoft.com> wrote in message >>> news:8BFE7935-F9B2-4A56-917B-D62166CB4773@microsoft.com... >>>> >>>> April 6, 2005 >>>> >>>> I have seen a lot of examples and I didn't know that UTF or ASCII >>>> drops >>>> bytes. Thanks for stating that. By the way, do you know if >>>> UnicodeEncoding >>>> does? Right now, I believe that it doesn't, but I haven't actually read >>>> that. >>>> >>>> >>>> Joseph MCAD >>>> >>>> >>>> "Joe Kaplan (MVP - ADSI)" wrote: >>>> >>>>> The ComputeHash method returns an arbitrary byte array that should not >>>>> be >>>>> converted to a string with eithe ASCIIEncoding or UTFEncoding as there >>>>> could >>>>> be unprintable characters with either encoding. You should use >>>>> Convert.ToBase64String for this purpose. It allows lossless >>>>> roundtrips from >>>>> byte[] to string. >>>>> >>>>> Joe K. >>>>> >>>>> >>>>> "KCS" <K**@discussions.microsoft.com> wrote in message >>>>> news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... >>>>> > Hi there Nicole. >>>>> > >>>>> > It was because I was using ASCIIEncoding.GetString after first using >>>>> > ComputeHash. This produces different results on the .NET FW 1.1 and >>>>> > 2.0. >>>>> > So >>>>> > trying to decipher a key on one FW did not work if created on the >>>>> > other >>>>> > FW. I >>>>> > amended my routine to use UTF8Encoding.GetString instead. >>>>> > >>>>> > Thanks. Kevin >>>>> > >>>>> > >>>>> > "Nicole Calinoiu" wrote: >>>>> > >>>>> >> If there's really a difference, it's may be a bug, or it should >>>>> >> perhaps >>>>> >> be >>>>> >> documented on the breaking change list at >>>>> >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >>>>> >> You may wish to report this as a bug at >>>>> >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along >>>>> >> with >>>>> >> sample code so that others may try to reproduce the problem. >>>>> >> >>>>> >> >>>>> >> >>>>> >> "KCS" <K**@discussions.microsoft.com> wrote in message >>>>> >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >>>>> >> > Hi there. Can you help? >>>>> >> > >>>>> >> > My encrypton / decryption routines work fine with exactly the >>>>> >> > same code >>>>> >> > if: >>>>> >> > >>>>> >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >>>>> >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >>>>> >> > >>>>> >> > but if I try to decrypt a string encrypted via VS2005 but using >>>>> >> > VS2003 >>>>> >> > (or >>>>> >> > the other way round) I get a Bad Data exception. >>>>> >> > >>>>> >> > Any ideas? >>>>> >> > >>>>> >> > Are there specific differences between the Crypto classes in each >>>>> >> > VS >>>>> >> > version >>>>> >> > or the .NET Framework versions? >>>>> >> > >>>>> >> > Thanks >>>>> >> > >>>>> >> >>>>> >> >>>>> >> >>>>> >>>>> >>>>> >>> >>> >> >> > > The encodings in System.Text are all designed to create different binary
versions of textual string data. Each encoding defines a mapping between the unicode characters in a string and a sequence of bytes. Note that not all encodings map all characters and different encodings will map the characters to different byte sequences. This is why you can't mix and match encodings when going back and forth. If you have arbitrary binary data (like an image file, encrypted blob or random chunk of memory) and want to encode that as a string, then you need to use an encoding method designed for arbitrary binary data like Base64 or octet string (hex character pairs). That is the only way to guarantee no loss of fidelity when going from arbitrary binary -> string -> original binary. I'm sure there are a ton of great articles on the web that can explain this better. I know Joel Spolsky had a good article on encoding methods for text data on his blog a while ago. HTH, Joe K. Show quoteHide quote "Joseph MCAD" <anonym***@discussions.microsoft.com> wrote in message news:e%23PCjQtOFHA.3076@TK2MSFTNGP12.phx.gbl... > April 6, 2005 > > Thanks for posting that! Do you know of any place that lists what the > different encodings are used for? Thanks again! > > > > Joseph MCAD > > > > > > "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message > news:OI0khxsOFHA.3880@tk2msftngp13.phx.gbl... >> None of the unicode formats are intended for encoding of binary data. >> UnicodeEncoding (which is just UTF-16) will present the same general set >> of problems as ASCII, UTF-7, or UTF-8 if one attempts to use it for >> encoding binary data. >> >> >> >> "Joseph MCAD" <JosephM***@discussions.microsoft.com> wrote in message >> news:8BFE7935-F9B2-4A56-917B-D62166CB4773@microsoft.com... >>> >>> April 6, 2005 >>> >>> I have seen a lot of examples and I didn't know that UTF or ASCII >>> drops >>> bytes. Thanks for stating that. By the way, do you know if >>> UnicodeEncoding >>> does? Right now, I believe that it doesn't, but I haven't actually read >>> that. >>> >>> >>> Joseph MCAD >>> >>> >>> "Joe Kaplan (MVP - ADSI)" wrote: >>> >>>> The ComputeHash method returns an arbitrary byte array that should not >>>> be >>>> converted to a string with eithe ASCIIEncoding or UTFEncoding as there >>>> could >>>> be unprintable characters with either encoding. You should use >>>> Convert.ToBase64String for this purpose. It allows lossless roundtrips >>>> from >>>> byte[] to string. >>>> >>>> Joe K. >>>> >>>> >>>> "KCS" <K**@discussions.microsoft.com> wrote in message >>>> news:C07101CF-7EE0-46C6-8549-65C19E61390A@microsoft.com... >>>> > Hi there Nicole. >>>> > >>>> > It was because I was using ASCIIEncoding.GetString after first using >>>> > ComputeHash. This produces different results on the .NET FW 1.1 and >>>> > 2.0. >>>> > So >>>> > trying to decipher a key on one FW did not work if created on the >>>> > other >>>> > FW. I >>>> > amended my routine to use UTF8Encoding.GetString instead. >>>> > >>>> > Thanks. Kevin >>>> > >>>> > >>>> > "Nicole Calinoiu" wrote: >>>> > >>>> >> If there's really a difference, it's may be a bug, or it should >>>> >> perhaps >>>> >> be >>>> >> documented on the breaking change list at >>>> >> http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx. >>>> >> You may wish to report this as a bug at >>>> >> http://lab.msdn.microsoft.com/productfeedback/default.aspx, along >>>> >> with >>>> >> sample code so that others may try to reproduce the problem. >>>> >> >>>> >> >>>> >> >>>> >> "KCS" <K**@discussions.microsoft.com> wrote in message >>>> >> news:72A2D84D-025B-43B5-8D28-FBEE88B1F685@microsoft.com... >>>> >> > Hi there. Can you help? >>>> >> > >>>> >> > My encrypton / decryption routines work fine with exactly the same >>>> >> > code >>>> >> > if: >>>> >> > >>>> >> > (a) I encrypt and decrypt with .NET FW 1.1 with VS2003 or >>>> >> > (b) I encrypt and decrypt with .NET FW 2.0 with VS2005 >>>> >> > >>>> >> > but if I try to decrypt a string encrypted via VS2005 but using >>>> >> > VS2003 >>>> >> > (or >>>> >> > the other way round) I get a Bad Data exception. >>>> >> > >>>> >> > Any ideas? >>>> >> > >>>> >> > Are there specific differences between the Crypto classes in each >>>> >> > VS >>>> >> > version >>>> >> > or the .NET Framework versions? >>>> >> > >>>> >> > Thanks >>>> >> > >>>> >> >>>> >> >>>> >> >>>> >>>> >>>> >> >> > >
Cannot Run Application on Windows Server 2003
Cannot run program from network drive Changing folder security RE: Designtime licenses, I just don't get it Custom principles and DnsPermission.Demand() User's Privileges Forms authentication to enter a static website ?cannot be instantiated under a partially trusted security policy (AllowPartiallyTrustedCallersAttri Change in ASP.Net authentication between Win2000 and Win2003 Windows Authentication |
|||||||||||||||||||||||