Will converting it to base 64 be any good to you, like:
mybuffer is your byte array and you write:
Dim data64 As String= System.Convert.ToBase64String(mybuffer, 0, mybuffer.Length)
now "data64" contains a string representation of the byte array. You can type it in a textbox and the other guy can take that string and through the following statement get the original byte array back:
Dim b() As Byte = System.Convert.FromBase64String(data64)
Its sort of what the ViewState in ASP.net does.
Hope that helps.
Abubakar.
http://joehacker.blogspot.com
--------------------------------------
"Bryan" wrote:
> Apologies if this is a noob question, but I've been struggling with this for quite a while...
>
> I'm trying to convert a byte array (encrypted authorization code) into a *screen-printable* string that is displayed in a text box. Once displayed, the text will be copied, transmitted and then pasted (all manually by humans) into a second utility where the string must then be reverse-engineered into the *original* byte array. The byte array will then be decrypted by the second app.
>
> I've got the encryption/decryption piece sorted, I'm just struggling with the screen-printable text bit...
>
> I've tried many of the suggestions posted on the web for converting the byte array into a screen-printable string. All have worked, and I've settled on the following:
>
> Dim Bytes() As Byte = myCrypto.Encrypt("AuthCode") ' .Encrypt returns a byte array
> Dim myBitConverter As BitConverter
> txtBox.Text = myBitConverter.ToString(Bytes)
> ' Displayed as XX-XX-XX-XX... in the txtBox.
>
> The problem is that for all of the examples I've found on the internet, none have helped me reverse engineer the screen-printable string into the original byte array. Although I like the BitConverter.ToString format (XX-XX-XX-XX) used in the code above, I don't really care how the string looks - as long as it is screen-printable and can be displayed, copied, emailed and pasted without issue. Can you enlighten me as to how I can easily convert a byte array to a screen-friendly string and then back again?
>
> Many thanks in advance.
> Bryan