Is it possible to create an asymmetric key for a .NET framework assembly in SQL Server 2014?
<p>I am developping an SQL Server Database Project in Visual Studio which is in fact a User Defined Function. In this project, I included Json.NET as a reference (using NuGet).</p>

<p>I managed to publish (and make work) my assembly and the UDF to my SQL Server instance by first turning the database <code>TRUSTWORTHY ON</code> (since my project is UNSAFE) and then running this:</p>

<pre><code>CREATE ASSEMBLY [System.Runtime.Serialization] 
FROM 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.Serialization.dll'
WITH PERMISSION_SET = UNSAFE;
</code></pre>

<p>Which turns out to be an assembly Json.NET depends on (if I don't do it, I get an error)</p>

<p>Meanwhile <a href="http://akawn.com/blog/2012/10/a-warning-about-the-trustworthy-database-option/" rel="nofollow noreferrer">I read about how bad turning TRUSTWORTHY ON can be</a> and I tried to <a href="https://stackoverflow.com/a/27007138/165055">go the asymmetric key</a> way to avoid turning it on.</p>

<p>Before even signing my own assembly, I know I will have to create a key for  <code>System.Runtime.Serialization</code> since my project depends on Json.Net which in turn depends on it, but when I run it, I get this:</p>

<pre><code>USE [master];
GO
  CREATE ASYMMETRIC KEY [SystemRuntimeSerializationKey]
    AUTHORIZATION [dbo]
    FROM EXECUTABLE FILE = 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.Serialization.dll';
GO

Msg 15468, Level 16, State 5, Line 3
An error occurred during the generation of the asymmetric key.
</code></pre>

<p>Which does not help me much.</p>

<p>So is it possible to generate such a key for .NET framework assemblies, or does it exist a workaround other that turning TRUSTWORTHY ON ?</p>