CLR Runtime error framework 3.5 - System.Security.HostProtectionException
<p>I´ve created a CLR Runtime dll following the steps of this post - <a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b732a134-33ba-4880-838d-33fb93887d12/decript-data-on-field-level-that-was-encrypted-on-an-oracle-system?forum=transactsql" rel="nofollow">https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b732a134-33ba-4880-838d-33fb93887d12/decript-data-on-field-level-that-was-encrypted-on-an-oracle-system?forum=transactsql</a>
It was created for SQL Server 2012 and it works perfectly.
The problem is that the client database is SQL Server 2008 and a new project had to be created for due to the framework 3.5.
So a new dll was created and when I call it on SQL Server 2008 I´m having the following error message.</p>

<pre><code>Msg 6522, Level 16, State 2, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "DecryptDataDecimal": 
System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.

The protected resources (only available with full trust) were: All
The demanded resources were: MayLeakOnAbort

System.Security.HostProtectionException: 
at UserDefinedFunctions.Decrypt_AES(Byte[] cypherText, Byte[] Key, Byte[] IV)
at UserDefinedFunctions.DecryptDataDecimal(String EncryptedData)
</code></pre>

<p>Thanks in advance.</p>