I am having an issue where a method call requires a string (plainText) or byte[] (plainTextAsBytes) and is generating a compile error of Cannot implicitly convert type string to byte[]
I have tried to implicitly convert the string to a byte array with no success either.
I have read and tried the examples located at the following SO posts:
Converting string to byte array in C#
Cannot implicitly convert type string to byte[]
The code that I am calling is located at (in the C# section):
How to encrypt and decrypt data with salt
So, what am I doing wrong?
Edit 1
Problem is that when using this:
byte[] array = Encoding.UTF8.GetBytes(SMTPModel.SMTPPassword);
EncryptedPassword = RijndaelEnhanced.Encrypt(plainTextBytes: array);
or:
EncryptedPassword = RijndaelEnhanced.Encrypt(plainText: decryptedPassword);
or even:
EncryptedPassword = RijndaelEnhanced.Encrypt(plainText: "Test");
I get the above stated error.
Edit 2
Forgot to supply the following information:
decryptedPassword is a string defined as:
string decryptedPassword = SMTPModel.SMTPPassword;