|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.Text.Encoding help ????Dear all,
Suring studying security issue on application and cryptin/Decripting, sample I have found use quite a lot the System.Text.Encoding class. Then a point is mentionned that we shave to be carefull on which encoding method is use for Decrypring and Encryprting. What is the way to select or to know which encoding mode we should use in general like Unicode, BASe64,Ascii .... ? Thanks for your help regards Serge When converting arbitrary binary data like an encryption key or hash to/from
a string, always use a method like Base64. It is designed for use with arbitrary binary data. When converting a string object to binary for encryption, etc., you need to remember that .NET strings are Unicode. If you want to be sure that all of the data in the string is converted to binary and back without loss, then you should use a Unicode based encoding like UTF8 or UTF16 (called Unicode in .NET). UTF8 is smaller. If you are absolutely sure your text will only be a certain character set, then you can use that encoding. However, why bother? UTF8 falls back to ASCII binary equivalence if the string only contains ASCII characters, so why not just use UTF8? If your input data is already binary, then leave it as such. My $0.02, Joe K. -- Show quoteHide quoteJoe Kaplan-MS MVP Directory Services Programming Co-author of "The .NET Developer's Guide to Directory Services Programming" http://www.directoryprogramming.net -- "serge calderara" <sergecalder***@discussions.microsoft.com> wrote in message news:499438F4-C02B-4ECA-980E-D1790E58B0E7@microsoft.com... > Dear all, > > Suring studying security issue on application and cryptin/Decripting, > sample > I have found use quite a lot the System.Text.Encoding class. > > Then a point is mentionned that we shave to be carefull on which encoding > method is use for Decrypring and Encryprting. > > What is the way to select or to know which encoding mode we should use in > general like Unicode, BASe64,Ascii .... ? > > Thanks for your help > regards > Serge Thnaks for you clarification
regards serge Show quoteHide quote "Joe Kaplan (MVP - ADSI)" wrote: > When converting arbitrary binary data like an encryption key or hash to/from > a string, always use a method like Base64. It is designed for use with > arbitrary binary data. > > When converting a string object to binary for encryption, etc., you need to > remember that .NET strings are Unicode. If you want to be sure that all of > the data in the string is converted to binary and back without loss, then > you should use a Unicode based encoding like UTF8 or UTF16 (called Unicode > in .NET). UTF8 is smaller. > > If you are absolutely sure your text will only be a certain character set, > then you can use that encoding. However, why bother? UTF8 falls back to > ASCII binary equivalence if the string only contains ASCII characters, so > why not just use UTF8? > > If your input data is already binary, then leave it as such. > > My $0.02, > > Joe K. > > -- > Joe Kaplan-MS MVP Directory Services Programming > Co-author of "The .NET Developer's Guide to Directory Services Programming" > http://www.directoryprogramming.net > -- > "serge calderara" <sergecalder***@discussions.microsoft.com> wrote in > message news:499438F4-C02B-4ECA-980E-D1790E58B0E7@microsoft.com... > > Dear all, > > > > Suring studying security issue on application and cryptin/Decripting, > > sample > > I have found use quite a lot the System.Text.Encoding class. > > > > Then a point is mentionned that we shave to be carefull on which encoding > > method is use for Decrypring and Encryprting. > > > > What is the way to select or to know which encoding mode we should use in > > general like Unicode, BASe64,Ascii .... ? > > > > Thanks for your help > > regards > > Serge > > >
WindowsIdentity.GetCurrent().Token cannot be used when remoting?
Credentials not passed on when using ASP.NET SMIME Decryption How to ByPass Protected Storage Prompt RSA Encryption: Saving keys as files, and size of encrypted data code access security across the network Detecting if a NTAccount is user or a group Encrypt elements in XML file Web App Impersonation Console App Security Context |
|||||||||||||||||||||||