{"id":599,"date":"2018-07-17T16:35:23","date_gmt":"2018-07-17T21:35:23","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=599"},"modified":"2019-03-11T12:05:17","modified_gmt":"2019-03-11T17:05:17","slug":"create-always-encrypted-certificate","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/create-always-encrypted-certificate\/","title":{"rendered":"Create Always Encrypted Certificate"},"content":{"rendered":"<p>In SSMS, browse to Database, Security, Always Encrypted Keys, right click Column Master Keys and click New Column Master Key:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-687 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE1.png\" alt=\"\" width=\"468\" height=\"381\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE1.png 468w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE1-300x244.png 300w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/a><\/p>\n<p>In the New Column Master Key box you can choose from several key stores. The most popular stores are Current User or Current Machine. See below for description.<\/p>\n<p><strong>Local machine certificate store<\/strong><br \/>\nThis type of certificate store is local to the computer and is global to all users on the computer. This certificate store is located in the registry under the HKEY_LOCAL_MACHINE root.<\/p>\n<p><strong>Current user certificate store<\/strong><br \/>\nThis type of certificate store is local to a user account on the computer. This certificate store is located in the registry under the HKEY_CURRENT_USER root.<\/p>\n<p>Be aware that all current user certificate stores inherit the contents of the local machine certificate stores. For example, if a certificate is added to the local machine <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/install\/trusted-root-certification-authorities-certificate-store\">Trusted Root Certification Authorities certificate store<\/a>, all current user Trusted Root Certification Authorities certificate stores also contain the certificate.<\/p>\n<p>In this example, we\u2019ll use Local Machine. Type a name for the Master Key, choose Key Store and click Generate Certificate.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-688 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE2.png\" alt=\"\" width=\"682\" height=\"348\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE2.png 682w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE2-300x153.png 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/a><\/p>\n<p>Click OK and a new Column Master Key will appear:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-689 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE3.png\" alt=\"\" width=\"354\" height=\"398\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE3.png 354w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE3-267x300.png 267w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/a><\/p>\n<p>Do the same for any other master keys you would like to create. For example, Developer:<a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-690 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE4.png\" alt=\"\" width=\"684\" height=\"346\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE4.png 684w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE4-300x152.png 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-691 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE5.png\" alt=\"\" width=\"342\" height=\"385\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE5.png 342w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE5-266x300.png 266w\" sizes=\"auto, (max-width: 342px) 100vw, 342px\" \/><\/a><\/p>\n<p>To create a Column Encryption Key, right click on Column Encryption Key and choose New Column Encryption key:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-692 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE6.png\" alt=\"\" width=\"395\" height=\"159\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE6.png 395w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE6-300x121.png 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/a><\/p>\n<p>Give the key a name and select the Column Master Key that you would like to associate it with:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-693 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE7.png\" alt=\"\" width=\"692\" height=\"314\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE7.png 692w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE7-300x136.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/a><\/p>\n<p>Do the same for the Developer keys. You should have two column master keys and two column encryption keys:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-694 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE8.png\" alt=\"\" width=\"364\" height=\"184\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE8.png 364w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE8-300x152.png 300w\" sizes=\"auto, (max-width: 364px) 100vw, 364px\" \/><\/a><\/p>\n<p>To view Local Machine certificates:<\/p>\n<p>Open Certlm.msc<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-695 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE9.png\" alt=\"\" width=\"373\" height=\"676\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE9.png 373w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE9-166x300.png 166w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><\/a><\/p>\n<p>Browse to Personal, Certificates:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-682 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE10.png\" alt=\"\" width=\"823\" height=\"135\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE10.png 823w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE10-300x49.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE10-768x126.png 768w\" sizes=\"auto, (max-width: 823px) 100vw, 823px\" \/><\/a><\/p>\n<p>Double click a certificate and go to the Detail tab where you will see the thumbprint:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-683 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE11.png\" alt=\"\" width=\"399\" height=\"294\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE11.png 399w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE11-300x221.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/a><\/p>\n<p>Match this thumbprint with the Column Master Key in SSMS:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-684 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE12.png\" alt=\"\" width=\"685\" height=\"327\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE12.png 685w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE12-300x143.png 300w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/a><\/p>\n<p>Right click the certificate in Certlm.msc and choose Properties. Enter a friendly name to identify which certificate belongs with the Column Master Key.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-685 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE13.png\" alt=\"\" width=\"763\" height=\"112\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE13.png 763w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE13-300x44.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/a><\/p>\n<p>To Export and certificate, right click and choose All Tasks, Export:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-686 size-full\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE14.png\" alt=\"\" width=\"622\" height=\"251\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE14.png 622w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/AE14-300x121.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In SSMS, browse to Database, Security, Always Encrypted Keys, right click Column Master Keys and click New Column Master Key: In the New Column Master Key box you can choose from several key stores. The most popular stores are Current User or Current Machine. See below for description. Local machine certificate store This type of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121,87,53,10],"tags":[122,98],"class_list":["post-599","post","type-post","status-publish","format-standard","hentry","category-always-encrypted","category-auditing-and-compliance","category-database-design","category-security","tag-always-encrypted","tag-security"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=599"}],"version-history":[{"count":2,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/599\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/599\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}