{"id":840,"date":"2024-10-29T08:00:00","date_gmt":"2024-10-29T13:00:00","guid":{"rendered":"https:\/\/www.sqltabletalk.com\/?p=840"},"modified":"2024-10-25T21:17:29","modified_gmt":"2024-10-26T02:17:29","slug":"testing-always-encrypted-with-parameterized-queries","status":"publish","type":"post","link":"https:\/\/www.sqltabletalk.com\/?p=840","title":{"rendered":"Testing Always Encrypted with Parameterized Queries in SQL Server"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><strong>Always Encrypted<\/strong> is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we&#8217;ll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.<\/p>\n<h2>Understanding Encryption Types<\/h2>\n<p>When working with encrypted columns, it&#8217;s important to understand the two types of encryption:<\/p>\n<ul>\n<li><strong>Deterministic Encryption:<\/strong> Encrypts data so that the same plaintext value always results in the same ciphertext. This allows for equality searches and grouping.<\/li>\n<li><strong>Randomized Encryption:<\/strong> Encrypts data differently each time, providing higher security but not supporting search operations.<\/li>\n<\/ul>\n<p>For testing purposes, especially when performing searches in the <code>WHERE<\/code> clause, use deterministic encryption.<\/p>\n<h2>Updating and Inserting Encrypted Data<\/h2>\n<p>To insert or update data in an encrypted column, the SQL client must be &#8220;Always Encrypted aware,&#8221; meaning it can handle encryption and decryption operations.<\/p>\n<h2>Enabling Parameterized Queries<\/h2>\n<p>When using applications like .NET, the client-side framework must support Always Encrypted to allow updates and inserts. Ensure your application uses parameterized queries to pass encrypted values so that encryption happens transparently.<\/p>\n<ul>\n<li>Use the latest version of <code>Microsoft.Data.SqlClient<\/code>, which fully supports Always Encrypted.<\/li>\n<\/ul>\n<h2>Configuring the Client<\/h2>\n<p>Both SQL Server Management Studio (SSMS) and applications must have the Always Encrypted option enabled.<\/p>\n<ul>\n<li><strong>For applications:<\/strong> Add <code>Column Encryption Setting=Enabled;<\/code> to your connection string.<\/li>\n<li><strong>For SSMS:<\/strong> Adjust the query options to enable Always Encrypted.<\/li>\n<\/ul>\n<h3>Enabling Always Encrypted in SSMS<\/h3>\n<ol>\n<li>Open SSMS and connect to your database.<\/li>\n<li>Open a new query window.<\/li>\n<li>In the menu bar, click on <strong>Query<\/strong> and select <strong>Query Options<\/strong>.<\/li>\n<li>Expand the <strong>Execution<\/strong> tab and select <strong>Advanced<\/strong>.<\/li>\n<li>Check <strong>Enable Parameterization for Always Encrypted<\/strong>.<\/li>\n<li>Click <strong>OK<\/strong>.<\/li>\n<\/ol>\n<h2>Setting Up Always Encrypted<\/h2>\n<h3>1. Configure a Column Master Key<\/h3>\n<ol>\n<li>In SSMS, expand your database and navigate to <strong>Security &gt; Always Encrypted Keys<\/strong>.<\/li>\n<li>Right-click <strong>Column Master Keys<\/strong> and select <strong>New Column Master Key&#8230;<\/strong>.<\/li>\n<li>Name the key <code>CMK1<\/code>.<\/li>\n<li>Choose <strong>Generate Self-Signed Certificate<\/strong>.<\/li>\n<li>Click <strong>OK<\/strong>.<\/li>\n<\/ol>\n<p>This creates a self-signed certificate and stores it in your personal certificate store.<\/p>\n<h3>2. Configure a Column Encryption Key<\/h3>\n<ol>\n<li>Right-click <strong>Column Encryption Keys<\/strong> and select <strong>New Column Encryption Key&#8230;<\/strong>.<\/li>\n<li>Name the key <code>CEK1<\/code>.<\/li>\n<li>Select <code>CMK1<\/code> as the column master key.<\/li>\n<li>Click <strong>OK<\/strong>.<\/li>\n<\/ol>\n<h2>Creating a Table with Encrypted Columns<\/h2>\n<p>Create a table with columns encrypted using deterministic and randomized encryption.<\/p>\n<pre><code>CREATE TABLE [dbo].[Clients](\n    [PatientId] [int] IDENTITY(1,1) NOT NULL,\n     COLLATE Latin1_General_BIN2 \n        ENCRYPTED WITH (\n            COLUMN_ENCRYPTION_KEY = [CEK1], \n            ENCRYPTION_TYPE = Deterministic, \n            ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256'\n        ) NOT NULL,\n     NOT NULL,\n     NOT NULL,\n     NULL,\n     NULL,\n     NULL,\n    [ZipCode] [int] NULL,\n     NULL,\n     \n        ENCRYPTED WITH (\n            COLUMN_ENCRYPTION_KEY = [CEK1], \n            ENCRYPTION_TYPE = Randomized, \n            ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256'\n        ) NOT NULL,\n    PRIMARY KEY CLUSTERED ([PatientId] ASC)\n) ON [PRIMARY];<\/code><\/pre>\n<p>&#8211; <code>SSN<\/code> uses deterministic encryption to allow for searches.<br \/>\n&#8211; <code>BirthDate<\/code> uses randomized encryption for higher security.<\/p>\n<h2>Inserting Records Using Parameterized Queries<\/h2>\n<p>To insert data, use parameterized queries so that the client handles encryption transparently.<\/p>\n<h3>Using T-SQL in SSMS<\/h3>\n<pre><code>DECLARE @SSN nvarchar(11) = '795-73-9838';\nDECLARE @BirthDate datetime2(7) = '1980-01-01';\n\nINSERT INTO [dbo].[Clients] (\n    [SSN],\n    [FirstName],\n    [LastName],\n    [MiddleName],\n    [StreetAddress],\n    [City],\n    [ZipCode],\n    [State],\n    [BirthDate]\n)\nVALUES (\n    @SSN,\n    'John',\n    'Doe',\n    'M',\n    '123 Main St',\n    'New York',\n    10001,\n    'NY',\n    @BirthDate\n);<\/code><\/pre>\n<p><strong>Note:<\/strong> Ensure that <strong>Enable Parameterization for Always Encrypted<\/strong> is checked in your query options.<\/p>\n<h3>Using PowerShell<\/h3>\n<pre><code>$connectionString = \"Data Source=YourServer;Initial Catalog=AlwaysEncryptedDb;Integrated Security=True;Column Encryption Setting=Enabled;\"\n\n$query = @\"\nINSERT INTO dbo.Clients (\n    [SSN],\n    [FirstName],\n    [LastName],\n    [MiddleName],\n    [StreetAddress],\n    [City],\n    [ZipCode],\n    [State],\n    [BirthDate]\n) VALUES (\n    @SSN,\n    @FirstName,\n    @LastName,\n    @MiddleName,\n    @StreetAddress,\n    @City,\n    @ZipCode,\n    @State,\n    @BirthDate\n);\n\"@\n\n$connection = New-Object System.Data.SqlClient.SqlConnection($connectionString)\n$command = $connection.CreateCommand()\n$command.CommandText = $query\n\n$command.Parameters.Add(\"@SSN\", [System.Data.SqlDbType]::NVarChar, 11).Value = \"123-45-6789\"\n$command.Parameters.Add(\"@FirstName\", [System.Data.SqlDbType]::NVarChar, 50).Value = \"Yvonne\"\n# Add other parameters as needed\n\n$connection.Open()\n$command.ExecuteNonQuery()\n$connection.Close()<\/code><\/pre>\n<h2>Reading Encrypted Data<\/h2>\n<p>To read encrypted data, ensure your connection includes <code>Column Encryption Setting=Enabled<\/code>.<\/p>\n<pre><code>SELECT * FROM [dbo].[Clients];<\/code><\/pre>\n<p>&#8211; <strong>Without encryption enabled:<\/strong> Encrypted columns display as binary data.<br \/>\n&#8211; <strong>With encryption enabled:<\/strong> Encrypted columns display decrypted values.<\/p>\n<h2>Updating Encrypted Data Using Parameterized Queries<\/h2>\n<h3>Using PowerShell<\/h3>\n<pre><code>$connectionString = \"Data Source=YourServer;Initial Catalog=AlwaysEncryptedDb;Integrated Security=True;Column Encryption Setting=Enabled;\"\n\n$patientId = 1\n$newSSN = \"123-45-1234\"\n$query = \"UPDATE dbo.Clients SET SSN = @newSSN WHERE PatientId = @patientId\"\n\n$connection = New-Object System.Data.SqlClient.SqlConnection($connectionString)\n$command = $connection.CreateCommand()\n$command.CommandText = $query\n\n$command.Parameters.Add(\"@newSSN\", [System.Data.SqlDbType]::NVarChar, 11).Value = $newSSN\n$command.Parameters.Add(\"@patientId\", [System.Data.SqlDbType]::Int).Value = $patientId\n\n$connection.Open()\n$command.ExecuteNonQuery()\n$connection.Close()<\/code><\/pre>\n<h3>Using C#<\/h3>\n<pre><code>using System.Data.SqlClient;\n\nstring connectionString = \"Data Source=YourServer;Initial Catalog=AlwaysEncryptedDb;Integrated Security=True;Column Encryption Setting=Enabled;\";\n\nint patientId = 1;\nstring newSSN = \"123-45-1234\";\n\nusing (SqlConnection conn = new SqlConnection(connectionString))\n{\n    conn.Open();\n    string sql = \"UPDATE dbo.Clients SET SSN = @newSSN WHERE PatientId = @patientId\";\n    using (SqlCommand cmd = new SqlCommand(sql, conn))\n    {\n        cmd.Parameters.AddWithValue(\"@newSSN\", newSSN);\n        cmd.Parameters.AddWithValue(\"@patientId\", patientId);\n        cmd.ExecuteNonQuery();\n    }\n}<\/code><\/pre>\n<h3>Using T-SQL in SSMS<\/h3>\n<pre><code>DECLARE @SSN nvarchar(11) = '795-73-9838';\nUPDATE [dbo].[Clients] SET [SSN] = @SSN\nWHERE [PatientId] = 1;<\/code><\/pre>\n<p>Ensure that <strong>Enable Parameterization for Always Encrypted<\/strong> is checked in your query options.<\/p>\n<h2>Conclusion<\/h2>\n<p>Testing Always Encrypted with parameterized queries ensures that encryption and decryption processes happen transparently, without requiring developers to manage cryptographic details. This enhances security and reduces the risk of data leaks, even if unauthorized access to the database occurs.<\/p>\n<p>By following these steps, you can securely implement and test Always Encrypted in SQL Server, protecting your sensitive data while maintaining application functionality and performance.<\/p>\n<p><strong>References:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/sql\/relational-databases\/security\/encryption\/always-encrypted-database-engine\">Always Encrypted (Microsoft Docs)<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/security\/encryption\/develop-using-always-encrypted-with-net-framework-data-provider?view=sql-server-ver16\">Using Always Encrypted with the .NET Framework Data Provider for SQL Server<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we&#8217;ll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating. <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_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":""},"categories":[120,12,53,91,29,84],"tags":[341,299,339,343,196,342,338,86,131,340],"class_list":["post-840","post","type-post","status-publish","format-standard","hentry","category-encryption","category-internals","category-powershell","category-query-optimization","category-security","category-sql-developer","tag-net-framework","tag-always-encrypted","tag-data-encryption","tag-data-protection","tag-database-security","tag-encryption-keys","tag-parameterized-queries","tag-powershell","tag-sql-server","tag-ssms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk<\/title>\n<meta name=\"description\" content=\"It&#039;s more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we&#039;ll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqltabletalk.com\/?p=840\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk\" \/>\n<meta property=\"og:description\" content=\"It&#039;s more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we&#039;ll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqltabletalk.com\/?p=840\" \/>\n<meta property=\"og:site_name\" content=\"SQL Table Talk\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-29T13:00:00+00:00\" \/>\n<meta name=\"author\" content=\"Yvonne Vanslageren\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yvonne Vanslageren\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840\"},\"author\":{\"name\":\"Yvonne Vanslageren\",\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/68bb31b454bafe9e139183ed4f3e9082\"},\"headline\":\"Testing Always Encrypted with Parameterized Queries in SQL Server\",\"datePublished\":\"2024-10-29T13:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840\"},\"wordCount\":567,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0\"},\"keywords\":[\".NET Framework\",\"Always Encrypted\",\"Data Encryption\",\"Data Protection\",\"Database Security\",\"Encryption Keys\",\"Parameterized Queries\",\"powershell\",\"SQL Server\",\"SSMS\"],\"articleSection\":[\"Encryption\",\"Internals\",\"PowerShell\",\"Query Optimization\",\"Security\",\"SQL Developer\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.sqltabletalk.com\/?p=840#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840\",\"url\":\"https:\/\/www.sqltabletalk.com\/?p=840\",\"name\":\"Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/#website\"},\"datePublished\":\"2024-10-29T13:00:00+00:00\",\"description\":\"It's more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we'll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqltabletalk.com\/?p=840\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqltabletalk.com\/?p=840#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqltabletalk.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Testing Always Encrypted with Parameterized Queries in SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqltabletalk.com\/#website\",\"url\":\"https:\/\/www.sqltabletalk.com\/\",\"name\":\"SQL Table Talk\",\"description\":\"Breaking Down SQL Server, One Post at a Time.\",\"publisher\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqltabletalk.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0\",\"name\":\"Stephen Planck\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/64181114edc3de3d99072c049bcec024f025c9536dc89fc8ff1bac58976ca81e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/64181114edc3de3d99072c049bcec024f025c9536dc89fc8ff1bac58976ca81e?s=96&d=mm&r=g\",\"caption\":\"Stephen Planck\"},\"logo\":{\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/dexterwiki.com\",\"https:\/\/www.linkedin.com\/in\/stephen-planck-4611b692?trk=people-guest_people_search-card&challengeId=AQErf8gbBmcVMwAAAYsyIsxO-0UvU8z7cHrBpZoo_n3xt9qEKpRN5B_jd_LmAMu-OfeArkQ7GDjobJ2uRoQQV35EQdh_rR6kxA&submissionId=09de7067-c335-8e17-40b8-8dc32b60ed6c&challengeSource=AgEcUCw35zpPmAAAAYsyI4vAWhJTV7Nt4vZYKc3V1qiDBpCkKgUvtlOBgYXcE84&challegeType=AgE_wZiTT09IAQAAAYsyI4vDmNvbZIYe6XHju5V2bXVvM3IVxnJslgY&memberId=AgESFTkUShzs_gAAAYsyI4vGYk0Gic1uc5kB6cKOABA26Gw&recognizeDevice=AgHdSZyUSI5CEwAAAYsyI4vKd_koF9JgpsCJShT8QfbK1QMiv8SI\",\"https:\/\/www.youtube.com\/linuxmate\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/68bb31b454bafe9e139183ed4f3e9082\",\"name\":\"Yvonne Vanslageren\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/22c274a7a354b81a0a8dc5b23e8e0be9bdd81a6bc0541474cfb6b954d6bb2089?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/22c274a7a354b81a0a8dc5b23e8e0be9bdd81a6bc0541474cfb6b954d6bb2089?s=96&d=mm&r=g\",\"caption\":\"Yvonne Vanslageren\"},\"url\":\"https:\/\/www.sqltabletalk.com\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk","description":"It's more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we'll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.","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:\/\/www.sqltabletalk.com\/?p=840","og_locale":"en_US","og_type":"article","og_title":"Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk","og_description":"It's more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we'll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.","og_url":"https:\/\/www.sqltabletalk.com\/?p=840","og_site_name":"SQL Table Talk","article_published_time":"2024-10-29T13:00:00+00:00","author":"Yvonne Vanslageren","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Yvonne Vanslageren","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqltabletalk.com\/?p=840#article","isPartOf":{"@id":"https:\/\/www.sqltabletalk.com\/?p=840"},"author":{"name":"Yvonne Vanslageren","@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/68bb31b454bafe9e139183ed4f3e9082"},"headline":"Testing Always Encrypted with Parameterized Queries in SQL Server","datePublished":"2024-10-29T13:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqltabletalk.com\/?p=840"},"wordCount":567,"commentCount":0,"publisher":{"@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0"},"keywords":[".NET Framework","Always Encrypted","Data Encryption","Data Protection","Database Security","Encryption Keys","Parameterized Queries","powershell","SQL Server","SSMS"],"articleSection":["Encryption","Internals","PowerShell","Query Optimization","Security","SQL Developer"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sqltabletalk.com\/?p=840#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sqltabletalk.com\/?p=840","url":"https:\/\/www.sqltabletalk.com\/?p=840","name":"Testing Always Encrypted with Parameterized Queries in SQL Server - SQL Table Talk","isPartOf":{"@id":"https:\/\/www.sqltabletalk.com\/#website"},"datePublished":"2024-10-29T13:00:00+00:00","description":"It's more important than ever to be vigilant in protecting and securing our data. Always Encrypted is a feature in SQL Server designed to protect sensitive data, such as Social Security numbers or credit card information. In this guide, we'll focus on testing Always Encrypted using parameterized queries to ensure data remains secure during common operations like searching, inserting, and updating.","breadcrumb":{"@id":"https:\/\/www.sqltabletalk.com\/?p=840#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqltabletalk.com\/?p=840"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqltabletalk.com\/?p=840#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqltabletalk.com\/"},{"@type":"ListItem","position":2,"name":"Testing Always Encrypted with Parameterized Queries in SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/www.sqltabletalk.com\/#website","url":"https:\/\/www.sqltabletalk.com\/","name":"SQL Table Talk","description":"Breaking Down SQL Server, One Post at a Time.","publisher":{"@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqltabletalk.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/1947e42a9438bccd91691d8b791888e0","name":"Stephen Planck","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/64181114edc3de3d99072c049bcec024f025c9536dc89fc8ff1bac58976ca81e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/64181114edc3de3d99072c049bcec024f025c9536dc89fc8ff1bac58976ca81e?s=96&d=mm&r=g","caption":"Stephen Planck"},"logo":{"@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/dexterwiki.com","https:\/\/www.linkedin.com\/in\/stephen-planck-4611b692?trk=people-guest_people_search-card&challengeId=AQErf8gbBmcVMwAAAYsyIsxO-0UvU8z7cHrBpZoo_n3xt9qEKpRN5B_jd_LmAMu-OfeArkQ7GDjobJ2uRoQQV35EQdh_rR6kxA&submissionId=09de7067-c335-8e17-40b8-8dc32b60ed6c&challengeSource=AgEcUCw35zpPmAAAAYsyI4vAWhJTV7Nt4vZYKc3V1qiDBpCkKgUvtlOBgYXcE84&challegeType=AgE_wZiTT09IAQAAAYsyI4vDmNvbZIYe6XHju5V2bXVvM3IVxnJslgY&memberId=AgESFTkUShzs_gAAAYsyI4vGYk0Gic1uc5kB6cKOABA26Gw&recognizeDevice=AgHdSZyUSI5CEwAAAYsyI4vKd_koF9JgpsCJShT8QfbK1QMiv8SI","https:\/\/www.youtube.com\/linuxmate"]},{"@type":"Person","@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/68bb31b454bafe9e139183ed4f3e9082","name":"Yvonne Vanslageren","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqltabletalk.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/22c274a7a354b81a0a8dc5b23e8e0be9bdd81a6bc0541474cfb6b954d6bb2089?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/22c274a7a354b81a0a8dc5b23e8e0be9bdd81a6bc0541474cfb6b954d6bb2089?s=96&d=mm&r=g","caption":"Yvonne Vanslageren"},"url":"https:\/\/www.sqltabletalk.com\/?author=2"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/posts\/840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=840"}],"version-history":[{"count":4,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/posts\/840\/revisions"}],"predecessor-version":[{"id":876,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=\/wp\/v2\/posts\/840\/revisions\/876"}],"wp:attachment":[{"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqltabletalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}