Skip to content

Typcasting to byte[]

Krishna Kishore

Asked Mar 16, 2006, 11:32 PM EST3 answers
Share
LinkedInX

Hello,

Iam encrypting my data(of byte[] type) and storing in registry.

At the time of retrieving my data I am obtaining in Object type.How to convert back to byte[]...So that I can Decrypt back.

Thank you.

Regards
Kolluru.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Post some of your code to get more information...
    0
  • 0
    Will this work for you?

      private byte[] ConvertToByteArray(string sInput)
      {
       char[] arrChar;
       arrChar = sInput.ToCharArray();
       byte[] arrByte = new byte[arrChar.Length];
       for (int i= 0; i < arrByte.Length; i++){
        arrByte[i] = Convert.ToByte(arrChar[i]);
       }
       return (arrByte);
       
      }

    Cheers!
    0
  • 0
    Thatz Kool...Thank you ...

    I found an other way...

    (byte[])Registry.getvalue("str");

    Thamks again...

    regards
    0