I have a c# assembly which takes in a SQLBinary variable to decrypt...
[SqlProcedure(Name="Decrypt")]
public static SqlInt32 Decrypt(SqlBinary toDecrypt)
{
return runQuery(toDecrypt);
}
// decrypt or encrypt is determined based on the datatype of argValue
private static SqlInt32 runQuery(object argValue)
{
// create connection and command
command.Parameters.Add("@argValue", SqlDbType.VarBinary, 1024).Value = (SqlBinary)argValue;
I include the (SqlBinary)argValue as a column in the select statement for simple debugging. It doesnt appear as if this SqlBinary value is properly being placed into the query.
argValue is being used like so: QueryString += "SELECT decryptbykey(@argValue);";
Whats being returned looks like a truncated version of (SqlBinary)argValue