none
NEED HELP : Error in CREATING ASYMMETRIC KEY RRS feed

  • Question

  • Hi,

    I am trying to create asymmetric key in SQL Server 2005 database from a vb.net dll (SQLCLRAsm.dll). The vb.net dll is built using Visual studio 2005 with signing (SQLCLRAsmKey.snk).

    when i execute below script in sql server i am getting error :
    Msg 15563, Level 16, State 1, Line 2
    The asymmetric key has no private key set for it.

    Here is the script :
    USE [MySQLdb]
    GO
    CREATE ASYMMETRIC KEY [SQLCLRAsmKey] AUTHORIZATION dbo FROM
    EXECUTABLE FILE = 'C:\Test\bin\SQLCLRAsm.dll'
    ENCRYPTION BY PASSWORD = 'dfgfdg7689df6g87d$%khjkh$%'
    GO

    Any help to resolve this will greatly appriciated. Should i create asymmetric key, and login for asymmetric key only in master database?

    Wednesday, October 7, 2009 11:51 PM

Answers

  • Hi Ravi,

    Yes, your entire script above needs to be run in the master database.

    Cheers,
    Bob
    • Marked as answer by Ravi Poranki Tuesday, October 13, 2009 4:07 PM
    Monday, October 12, 2009 7:20 PM
    Moderator

All replies

  • Did you try using CREATE ASYMMETRIC KEY like this instead....

    CREATE ASYMMETRIC KEY [SQLCLRAsmKey]
    AUTHORIZATION dbo
    FROM FILE = c:\yourkeyfilelocation\
    SQLCLRAsmKey.snk
    ENCRYPTION BY PASSWORD = 'dfgfdg7689df6g87d$%khjkh$%'

    Hope this helps,
    Bob Beauchemin
    SQLskills
    Friday, October 9, 2009 6:15 PM
    Moderator
  • Thanks Bob. I did try that and was able create asymmetrickey, but creating login for that asymmetrickey is failing now. I am using SQL Server 2005, local instance, and I have admin rights on MySQLdb. Please look at script & error below. And also, Should I create asymmetric key and login for asymmetric key only in Master database?

    USE [MySQLdb]
    GO
    CREATE ASYMMETRIC KEY [SQLCLRAsmKey] FROM
    FILE = 'C:\Test\\bin\SQLCLRAsmKey.snk'
    ENCRYPTION BY PASSWORD = '7ly89shN$%rs50SoWs50S9s%f57n43N$%rs50SoW'
    GO
    CREATE LOGIN [SQLCLRLogin]
    FROM ASYMMETRIC KEY [SQLCLRAsmKey]
    GO
    Result : Msg 15151, Level 16, State 1, Line 2
    Cannot find the asymmetric key 'SQLCLRAsmKey', because it does not exist or you do not have permission.

    Monday, October 12, 2009 3:23 PM
  • Hi Ravi,

    Yes, your entire script above needs to be run in the master database.

    Cheers,
    Bob
    • Marked as answer by Ravi Poranki Tuesday, October 13, 2009 4:07 PM
    Monday, October 12, 2009 7:20 PM
    Moderator
  • Thanks Bob.
    Tuesday, October 13, 2009 4:07 PM