First: Thank you for not going the easy route and enabling TRUSTWORTHY. Seriously. It is not that much work to do this correctly, so I (and your employer) appreciate you doing more research, and when you couldn't get any farther, reaching out for help .
If you are referring to the "Stairway to SQLCLR" series on SQL Server Central, I am the author of those articles. I am sorry if the information was not easily understood. I will outline the steps here:
- In Visual Studio, sign the Assembly with a Strong Name Key, and protect it with a password (you have already done this, according to the question)
Depending on what you are doing and the overall requirements, you have some options here:
- If your Assembly is using code that does flag a violation on the verification step when being created via CREATE ASSEMBLY, then you can technically load the Assembly into
[master], marked as SAFE, to create the Asymmetric Key from it (you won't execute the code here so it doesn't need to be marked as UNSAFE here).
- If your code does not pass verification (meaning: it can only be created when marked as
UNSAFE), then I find it best to create a separate, empty Assembly, also signed with the same Strong Name Key file (i.e. the .pfx file) used for the main Assembly. I then load that, empty yet signed, Assembly into [master], marked as SAFE
- If you need to deal with SQL Server 2017, then that requires an extra step which I will mention in a moment.
Once you have an Assembly created in [master] that was signed with the same .pfx file that was used to sign your main, UNSAFE Assembly, then you can simply create, in [master], an Asymmetric Key from that Assembly.
Create a Login from that Asymmetric Key
Grant that Key-based Login the UNSAFE ASSEMBLY permission
These steps work for SQL Server 2005 - 2016, and I provide instructions on how to automate this (Option 2 above -- using a separate, empty, signed Assembly) in Visual Studio in the Stairway to SQLCLR Level 7: Development and Security article. (btw, I do realize that the steps described in Level 7 are admittedly a bit much, but they do provide a means of automation using Visual Studio AND they can be simplified by using T4 templates -- which comes with VS -- but I haven't had time yet to write up the simplified approach -- hopefully soon, though).
IF, however, you need to account for SQL Server 2017 (or newer, presumably), then the steps above will not work as not even SAFE Assemblies can be created anymore without being signed and having the corresponding signature-based Login that has the UNSAFE ASSEMBLY permission. And, unfortunately, CREATE ASYMMETRIC KEY does not allow for creating from a hex bytes string / VARBINARY literal, so you need to use a Certificate which does allow for being created that way. Along those lines, I have two blog posts which detail, step-by-step, how to accomplish this, fully automated via Visual Studio (or even not using Visual Studio):
Whatever you do, do not get fooled into using the new "Trusted Assemblies" feature of SQL Server 2017 as there are numerous problems with it, as described here: SQLCLR vs. SQL Server 2017, Part 4: “Trusted Assemblies” – The Disappointment and one more post that I am working on now.
To help improve this needlessly painful process, please support my enhancement requests to improve CREATE ASYMMETRIC KEY and SSDT: