Re: Converting byte[] to string - removing NULLs??



j.a. harriman <jeffrey_no_spam_alias@xxxxxxxxxxxxx> wrote:
Your solution is certainly more thorough. The vlaue coming in is from a
known source and "should" always be the same.

Why? Encryption *often* ends up with a different length of encrypted
data to decrypted data.

I was able to trim the nulls at this point:
//Convert the byte array back into a string.
sDecryptedString =
textConverter.GetString(fromEncrypt).Trim('\0');

I still *strongly* urge you to try to fix it "properly".

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Rijndael class, Padding bug?, Ivan Medvedev
    ... used bytefor raw, encrypted and decrypted data. ... CreateDecryptor methods on the Rijndael class and used the TransformBlock ... Encryption works fine. ...
    (microsoft.public.dotnet.security)
  • Re: "Access Denied" with encrypted USB device
    ... software and one for decrypted data. ... The device is a sandisk cruzer and the encryption is sanctuary from lumension. ... I am having some problems with encrypted USB devices. ... encryption software then the drives work fine. ...
    (microsoft.public.windowsxp.security_admin)
  • Migration to Win 2K3
    ... We have a SQL Server 2000 database wherein we store encrypted data as ... code) is encrypted using Windows 2000-based encryption. ... DES-based encryption, ... decrypted data in column Win2K3PwdD. ...
    (microsoft.public.sqlserver.security)
  • RSACryptoServiceProvider Encrypt/Decrypt
    ... I know that this data has been encrypted by passing true in fOAEP paramenter ... in Encrypt method. ... but I don't have source code to access this encryption ... Is there anyway I can get the decrypted data from CF 2.0? ...
    (microsoft.public.dotnet.framework)
  • RSACryptoServiceProvider Encrypt/Decrypt
    ... I know that this data has been encrypted by passing true in fOAEP paramenter ... in Encrypt method. ... but I don't have source code to access this encryption ... Is there anyway I can get the decrypted data from CF 2.0? ...
    (microsoft.public.dotnet.framework.compactframework)