{"id":2424,"date":"2014-05-30T11:00:55","date_gmt":"2014-05-30T15:00:55","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=2424"},"modified":"2014-11-13T12:24:59","modified_gmt":"2014-11-13T17:24:59","slug":"strong-name","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/2424\/strong-name\/","title":{"rendered":"Creating an Asymmetric Key using a Strong Name File"},"content":{"rendered":"<div>\n<h3>Introduction<\/h3>\n<p>\nA Strong Name File (SNF) can be used to \"sign\" .NET assemblies. I put the word \"sign\" in quotes, because there is no authentication mechanism provided, so all the signature really can tell you is if two different assemblies are coming from the same source. But that is the main purpose of SNFs anyway: They provide a way to generate a unique identifier for an assembly or a specific version of an assembly, a strong name.\n<\/p>\n<p>\nAn SNF contains just the public and the private key of an asymmetric key pair. There is no additional information stored in the file. SQL Server can take that information and create an asymmetric key in a database from it.\n<\/p>\n<h3>A Strong (Name) Example<\/h3>\n<p>\nCreating an asymmetric key pair from an SNF involves the <span class=\"tt\">CREATE ASYMMETRIC KEY<\/span>  statement using the <span class=\"tt\">FROM FILE<\/span> clause like this:\n<\/p>\n<div>\n[sql]\nCREATE ASYMMETRIC KEY AnAsymmetricKey<br \/>\n  FROM FILE = 'AStrongNameFile.snk'<br \/>\n  ENCRYPTION BY PASSWORD = '**********';<br \/>\n[\/sql]\n<\/div>\n<p>\nThis will create an asymmetric key in the current database from that SNF:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\" alt=\"CREATE ASYMMETRIC KEY FROM FILE in Action.\" title=\"CREATE ASYMMETRIC KEY FROM FILE in Action.\" width=\"768\" height=\"479\" class=\"aligncenter size-full wp-image-2425\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg 768w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE-300x187.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE-150x93.jpg 150w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a>\n<\/p>\n<p>\nThe SNF in the above example does not have a path specified. If you execute the statement like that, the SNF has to exist in SQL Servers default database directory. However, you can also specify a fully qualified path like this:\n<\/p>\n<div>\n[sql]\nCREATE ASYMMETRIC KEY AnAsymmetricKey<br \/>\n  FROM FILE = 'C:\\some\\folder\\AStrongNameFile.snk';<br \/>\n[\/sql]\n<\/div>\n<p>\nThe now specified path is not the only change in this statement. Additionally the <span class=\"tt\">ENCRYPTION BY PASSWORD<\/span> clause is missing. As it is the case with the normal <a href=\"http:\/\/sqlity.net\/en\/2420\/sys-asymmetric_keys\/\"><span class=\"tt\">CREATE ASYMMETRIC KEY<\/span> statement<\/a>, that means that the private key is going to be encrypted with the database master key.\n<\/p>\n<h3>The SN Tool<\/h3>\n<p>\nStrong Name Files can be created with <a href=http:\/\/msdn.microsoft.com\/en-us\/library\/k5b5tt23(v=vs.110).aspx target=\"msdn\">Microsoft's <span class=\"tt\">sn.exe<\/span> tool<\/a>. It for example comes bundled with Visual Studio. The exact syntax of how to use it you can look up following the above link. However, one parameter (<span class=\"tt\">-k<\/span>) allows you to specify the key length. While you can specify any key length between 384 and 16384 bits (in increments of 8 bits), SQL Server can only import SNFs that were created with a key length of either 512, 1024 or 2048 bits.\n<\/p>\n<h3>Summary<\/h3>\n<p>\nMicrosoft developed Strong Name Files to store a complete asymmetric key pair in them. Such a file can be used to show that for example two assemblies came from the same source. However, it does not provide any authentication information. SQL Server can import such files and use them to create asymmetric key from them.\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>.NET Strong name files are built to hold a single asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/2424\/strong-name\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":2425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[32,5,34],"tags":[143,273,31,38,15],"class_list":["post-2424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cryptography","category-general","category-security","tag-asymmetric-key","tag-cryptography","tag-encryption","tag-security-2","tag-sql-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Creating an Asymmetric Key using a Strong Name File - sqlity.net<\/title>\n<meta name=\"description\" content=\".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/2424\/strong-name\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating an Asymmetric Key using a Strong Name File - sqlity.net\" \/>\n<meta property=\"og:description\" content=\".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/2424\/strong-name\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2014-05-30T15:00:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-13T17:24:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"768\" \/>\n\t<meta property=\"og:image:height\" content=\"479\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"Creating an Asymmetric Key using a Strong Name File\",\"datePublished\":\"2014-05-30T15:00:55+00:00\",\"dateModified\":\"2014-11-13T17:24:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/\"},\"wordCount\":429,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\",\"keywords\":[\"asymmetric key\",\"Cryptography\",\"Encryption\",\"security\",\"SQL Server\"],\"articleSection\":[\"Cryptography\",\"General\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/\",\"name\":\"Creating an Asymmetric Key using a Strong Name File - sqlity.net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\",\"datePublished\":\"2014-05-30T15:00:55+00:00\",\"dateModified\":\"2014-11-13T17:24:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#primaryimage\",\"url\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\",\"contentUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg\",\"width\":768,\"height\":479,\"caption\":\"CREATE ASYMMETRIC KEY FROM FILE in Action.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2424\\\/strong-name\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating an Asymmetric Key using a Strong Name File\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating an Asymmetric Key using a Strong Name File - sqlity.net","description":".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/2424\/strong-name\/","og_locale":"en_US","og_type":"article","og_title":"Creating an Asymmetric Key using a Strong Name File - sqlity.net","og_description":".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.","og_url":"https:\/\/sqlity.net\/en\/2424\/strong-name\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2014-05-30T15:00:55+00:00","article_modified_time":"2014-11-13T17:24:59+00:00","og_image":[{"width":768,"height":479,"url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","type":"image\/jpeg"}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"Creating an Asymmetric Key using a Strong Name File","datePublished":"2014-05-30T15:00:55+00:00","dateModified":"2014-11-13T17:24:59+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/"},"wordCount":429,"commentCount":0,"image":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","keywords":["asymmetric key","Cryptography","Encryption","security","SQL Server"],"articleSection":["Cryptography","General","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/2424\/strong-name\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/","url":"https:\/\/sqlity.net\/en\/2424\/strong-name\/","name":"Creating an Asymmetric Key using a Strong Name File - sqlity.net","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","datePublished":"2014-05-30T15:00:55+00:00","dateModified":"2014-11-13T17:24:59+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":".NET Strong name files are built to hold an asymmetric key pair. Read on to discover how to generate SQL Server asymmetric keys form strong name files.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/2424\/strong-name\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#primaryimage","url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","contentUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","width":768,"height":479,"caption":"CREATE ASYMMETRIC KEY FROM FILE in Action."},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/2424\/strong-name\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"Creating an Asymmetric Key using a Strong Name File"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/05\/CREATE_ASYMMETRIC_KEY_FROM_FILE.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-D6","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/2424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=2424"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/2424\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media\/2425"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=2424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=2424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=2424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}