I am generating an encrypted message using .NET. As part of this process I am generating a salt value that is used in the encryption process and also transmitted to the recipient of the encrypted message so that they may decrypt the message. I want to transmit the salt as a text string but when I try to convert the salt byte array to a String I get each byte separated by a "dash". For example ..
45-A1-99-0C-C0-0C-C2-C2
Here is the method that generates the salt ..
Public Shared Function GenerateSalt() As String
Dim rng As New RNGCryptoServiceProvider()
Dim buffer As Byte() = New Byte(7) {}
rng.GetBytes(buffer)
Return BitConverter.ToString(buffer)
End Function
My question is this. How do I represent the salt as a string that the recipient can use in their decryption process?