SlideShare a Scribd company logo
SECURING YOUR AZURE WEB
APP WITH ASP.NET CORE
DATA PROTECTION
MICHAEL MELUSKY - @MRJAVASCRIPT
OCTOBER 22, 2016 – PHILLY.NET 2016.2
AGENDA
• Discussing Windows encryption standards before ASP.NET core
• Build a basic ASP.NET core MVC application
• Introduce encryption using the new Data Protector framework
• Obtain a free SSL certificate from Lets Encrypt!
ABOUT THE SPEAKER
• Michael Melusky
• Software developer at Audacious Inquiry in Baltimore, MD
• Adjunct instructor at Penn State University and Franklin and Marshall College
CRYPTOGRAPHY PRIOR TO ASP.NET CORE
• Used machine key generation
• For instance in web.config (system > configuration)
• <machineKey
validationKey="F5FBC9F875CF84173728F23325083E3D97CF9D17FCCA672A
D310BE069361BD4C55C4627F0B6725322AB63EAA8F01D7DF72DE85DBC603567
848EAF124D5C16BC7"
decryptionKey="6F1070AC50E4EAA432120A4DA023BE64EB6BB450BDF6ECEE
A9E59E40BA26475E"
validation="SHA1"
decryption="AES" />
PURPOSE OF MACHINE KEY
• Configures the algorithms and keys used for:
• Encryption and decryption
• Validation of forms-authentication data and view-state data
• And also out of process session-state information
CONFIGURING MACHINE KEYS IN IIS7
CONFIGURING MACHINE KEYS IN IIS7
HOW DOES THIS RELATE TO MODERN
APPLICATIONS TODAY?
• Microsoft introduced the Data Protector framework with ASP.NET Core 1.0
• Web applications need to store sensitive data
• Windows provides DPAPI for desktop applications but it unsuitable for web
applications
• The ASP.NET Core Data Protection stack provides an easy-to-use API developers can
use to protect data
• Includes key management and rotation
ASP.NET CORE DATA PROTECTION
• *** DEMO: Build a basic ASP.NET Core MVC web application ***
ASP.NET DATA PROTECTION IN A NUTSHELL
• Create a data protector from a data protection provider
• Call the Protect method to protect the data you want to protect
• Call the Unprotect method on the data you want to turn back into plaintext
ASP.NET CORE DATA PROTECTION
• *** DEMO: secure the sample ASP.NET web application ***
DATA PROTECTION PURPOSE STRINGS
• The purposes parameter is inherent to the security of the data protection system, as it
provides isolation between cryptographic consumers, even if the root cryptographic
keys are the same.
• When a consumer specifies a purpose, the purpose string is used along with the root
cryptographic keys to derive cryptographic subkeys unique to that consumer
• This isolates the consumer from all other cryptographic consumers in the application:
no other component can read its payloads, and it cannot read any other component’s
payloads
• This isolation also renders infeasible entire categories of attack against the component
DATA PROTECTION PURPOSE STRINGS
DATA PROTECTION PURPOSE STRINGS
OTHER FEATURES OF ASP.NET CORE DATA
PROTECTION
• New libraries for password hashing:
• using System.Security.Cryptography;
• using Microsoft.AspNetCore.Cryptography.KeyDerivation;
• // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations)
• string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
• password: password,
• salt: salt,
• prf: KeyDerivationPrf.HMACSHA1,
• iterationCount: 10000,
• numBytesRequested: 256 / 8));
• Console.WriteLine($"Hashed: {hashed}");
OTHER FEATURES OF ASP.NET CORE DATA
PROTECTION
• Timed Data Protector:
• developer wants to create a protected payload that expires after a set period of time
• Not recommended to use this for data which requires long-term or indefinite
persistence
POTENTIAL SHORTCOMINGS
• Deployment to a server farm:
• Want to synchronize:
• The application discriminator. This is a unique identifier for the application
• The master encryption key. This is the closest thing to machine key in the new system
• The encrypted set of session keys. This is a set of XML files that contain the valid session key(s) that can
be used to encrypt/decrypt state data
• Azure Web Apps is easier!
• All applications are installed to the same location, so the application discriminator lines up.
• Keys aren’t encrypted at rest, so there is no master encryption key.
• The session keys are put in a special folder location that is “magically” synchronized across all instances
of the Azure Web App
ASP.NET CORE DATA PROTECTION - KEY
MANAGEMENT
• The system tries to detect its operational environment and provide good zero-configuration
behavioral defaults. The heuristic used is as follows.
• If the system is being hosted in Azure Web Sites, keys are persisted to the
“%HOME%ASP.NETDataProtection-Keys” folder. This folder is backed by network storage and is
synchronized across all machines hosting the application. Keys are not protected at rest.
• If the user profile is available, keys are persisted to the “%LOCALAPPDATA%ASP.NETDataProtection-
Keys” folder. Additionally, if the operating system is Windows, they’ll be encrypted at rest using DPAPI.
• If the application is hosted in IIS, keys are persisted to the HKLM registry in a special registry key that is
ACLed only to the worker process account. Keys are encrypted at rest using DPAPI.
• If none of these conditions matches, keys are not persisted outside of the current process. When the
process shuts down, all generated keys will be lost.
ASP.NET CORE DATA PROTECTION - KEY LIFETIME
• Keys by default have a 90-day lifetime.
• When a key expires, the system will automatically generate a new key and set the
new key as the active key.
• As long as retired keys remain on the system you will still be able to decrypt any
data protected with them.
ASP.NET CORE DATA PROTECTION - DEFAULT
ALGORITHMS
• The default payload protection algorithm used is AES-256-CBC for confidentiality
and HMACSHA256 for authenticity.
• A 512-bit master key, rolled every 90 days, is used to derive the two sub-keys
used for these algorithms on a per-payload basis
CONFIGURING DATA PROTECTION
• public void ConfigureServices(IServiceCollection services)
• {
• services.ConfigureDataProtection(dp =>
• {
• dp.PersistKeysToFileSystem(new
DirectoryInfo(@"c:keys"));
• dp.SetDefaultKeyLifetime(TimeSpan.FromDays(14));
• });
DEPLOYMENT TO AZURE
• *** DEMO: deploy app to Azure ***
WHAT’S LEFT?
• SSL Certificate for the web site
• Let’s Encrypt! - free, automated, and open certificate authority brought to you
by the non-profit Internet Security Research Group (ISRG).
LET’S ENCRYPT
• *** DEMO Let’s Encrypt on Azure ***
QUESTIONS?
• Thank you for coming
• Michael Melusky - @mrjavascript

More Related Content

What's hot

Azure key vault
Azure key vaultAzure key vault
Azure key vault
Rahul Nath
 
Azure Key Vault - Getting Started
Azure Key Vault - Getting StartedAzure Key Vault - Getting Started
Azure Key Vault - Getting Started
Taswar Bhatti
 
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Azure Low Lands 2019 - Building secure cloud applications with Azure Key VaultAzure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Tom Kerkhove
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
Gianluca Sartori
 
Securing sensitive data with Azure Key Vault
Securing sensitive data with Azure Key VaultSecuring sensitive data with Azure Key Vault
Securing sensitive data with Azure Key Vault
Tom Kerkhove
 
Global Azure Bootcamp 2017 - Azure Key Vault
Global Azure Bootcamp 2017 - Azure Key VaultGlobal Azure Bootcamp 2017 - Azure Key Vault
Global Azure Bootcamp 2017 - Azure Key Vault
Alberto Diaz Martin
 
ITProceed 2015 - Securing Sensitive Data with Azure Key Vault
ITProceed 2015 - Securing Sensitive Data with Azure Key VaultITProceed 2015 - Securing Sensitive Data with Azure Key Vault
ITProceed 2015 - Securing Sensitive Data with Azure Key Vault
Tom Kerkhove
 
SQL Server Security and Intrusion Prevention
SQL Server Security and Intrusion PreventionSQL Server Security and Intrusion Prevention
SQL Server Security and Intrusion Prevention
Gabriel Villa
 
SQL Server 2012 Security Task
SQL Server 2012 Security TaskSQL Server 2012 Security Task
SQL Server 2012 Security Task
Yaakub Idris
 
Database security2 adebiaye
Database security2 adebiayeDatabase security2 adebiaye
Database security2 adebiaye
DR RICHMOND ADEBIAYE
 
Managing your secrets in a cloud environment
Managing your secrets in a cloud environmentManaging your secrets in a cloud environment
Managing your secrets in a cloud environment
Taswar Bhatti
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
Eduardo Piairo
 
Securing Search Data in the Cloud
Securing Search Data in the CloudSecuring Search Data in the Cloud
Securing Search Data in the Cloud
SearchStax
 
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
DevClub_lv
 
Security in practice with Java EE 6 and GlassFish
Security in practice with Java EE 6 and GlassFishSecurity in practice with Java EE 6 and GlassFish
Security in practice with Java EE 6 and GlassFish
Markus Eisele
 
How to avoid top 10 security risks in Java EE applications and how to avoid them
How to avoid top 10 security risks in Java EE applications and how to avoid themHow to avoid top 10 security risks in Java EE applications and how to avoid them
How to avoid top 10 security risks in Java EE applications and how to avoid them
Masoud Kalali
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
Eduardo Piairo
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
webhostingguy
 

What's hot (18)

Azure key vault
Azure key vaultAzure key vault
Azure key vault
 
Azure Key Vault - Getting Started
Azure Key Vault - Getting StartedAzure Key Vault - Getting Started
Azure Key Vault - Getting Started
 
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Azure Low Lands 2019 - Building secure cloud applications with Azure Key VaultAzure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
 
Securing sensitive data with Azure Key Vault
Securing sensitive data with Azure Key VaultSecuring sensitive data with Azure Key Vault
Securing sensitive data with Azure Key Vault
 
Global Azure Bootcamp 2017 - Azure Key Vault
Global Azure Bootcamp 2017 - Azure Key VaultGlobal Azure Bootcamp 2017 - Azure Key Vault
Global Azure Bootcamp 2017 - Azure Key Vault
 
ITProceed 2015 - Securing Sensitive Data with Azure Key Vault
ITProceed 2015 - Securing Sensitive Data with Azure Key VaultITProceed 2015 - Securing Sensitive Data with Azure Key Vault
ITProceed 2015 - Securing Sensitive Data with Azure Key Vault
 
SQL Server Security and Intrusion Prevention
SQL Server Security and Intrusion PreventionSQL Server Security and Intrusion Prevention
SQL Server Security and Intrusion Prevention
 
SQL Server 2012 Security Task
SQL Server 2012 Security TaskSQL Server 2012 Security Task
SQL Server 2012 Security Task
 
Database security2 adebiaye
Database security2 adebiayeDatabase security2 adebiaye
Database security2 adebiaye
 
Managing your secrets in a cloud environment
Managing your secrets in a cloud environmentManaging your secrets in a cloud environment
Managing your secrets in a cloud environment
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
 
Securing Search Data in the Cloud
Securing Search Data in the CloudSecuring Search Data in the Cloud
Securing Search Data in the Cloud
 
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
Network security with Azure PaaS services by Erwin Staal from 4DotNet at Azur...
 
Security in practice with Java EE 6 and GlassFish
Security in practice with Java EE 6 and GlassFishSecurity in practice with Java EE 6 and GlassFish
Security in practice with Java EE 6 and GlassFish
 
How to avoid top 10 security risks in Java EE applications and how to avoid them
How to avoid top 10 security risks in Java EE applications and how to avoid themHow to avoid top 10 security risks in Java EE applications and how to avoid them
How to avoid top 10 security risks in Java EE applications and how to avoid them
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 

Viewers also liked

An evening with Angular 2
An evening with Angular 2An evening with Angular 2
An evening with Angular 2
Mike Melusky
 
What All Organisations Need to Know About Data Protection and Cloud Computing...
What All Organisations Need to Know About Data Protection and Cloud Computing...What All Organisations Need to Know About Data Protection and Cloud Computing...
What All Organisations Need to Know About Data Protection and Cloud Computing...
Brian Miller, Solicitor
 
EU Medical Device Clinical Research under the General Data Protection Regulation
EU Medical Device Clinical Research under the General Data Protection RegulationEU Medical Device Clinical Research under the General Data Protection Regulation
EU Medical Device Clinical Research under the General Data Protection Regulation
Erik Vollebregt
 
Building Native “apps” with Visual Studio 2015
Building Native “apps” with Visual Studio 2015Building Native “apps” with Visual Studio 2015
Building Native “apps” with Visual Studio 2015
Mike Melusky
 
Ember.js and .NET Integration
Ember.js and .NET IntegrationEmber.js and .NET Integration
Ember.js and .NET Integration
Mike Melusky
 
Fun with lambda expressions
Fun with lambda expressionsFun with lambda expressions
Fun with lambda expressions
Mike Melusky
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NET
Mike Melusky
 
Seminar General Data Protection Regulation
Seminar General Data Protection RegulationSeminar General Data Protection Regulation
Seminar General Data Protection Regulation
Axon Lawyers
 
Fun with windows services
Fun with windows servicesFun with windows services
Fun with windows services
Mike Melusky
 
An evening with querydsl
An evening with querydslAn evening with querydsl
An evening with querydsl
Mike Melusky
 
Fun with lambda expressions
Fun with lambda expressionsFun with lambda expressions
Fun with lambda expressions
Mike Melusky
 
The Data Protection Act
The Data Protection ActThe Data Protection Act
The Data Protection Act
SaimaRafiq
 
An afternoon with angular 2
An afternoon with angular 2An afternoon with angular 2
An afternoon with angular 2
Mike Melusky
 

Viewers also liked (13)

An evening with Angular 2
An evening with Angular 2An evening with Angular 2
An evening with Angular 2
 
What All Organisations Need to Know About Data Protection and Cloud Computing...
What All Organisations Need to Know About Data Protection and Cloud Computing...What All Organisations Need to Know About Data Protection and Cloud Computing...
What All Organisations Need to Know About Data Protection and Cloud Computing...
 
EU Medical Device Clinical Research under the General Data Protection Regulation
EU Medical Device Clinical Research under the General Data Protection RegulationEU Medical Device Clinical Research under the General Data Protection Regulation
EU Medical Device Clinical Research under the General Data Protection Regulation
 
Building Native “apps” with Visual Studio 2015
Building Native “apps” with Visual Studio 2015Building Native “apps” with Visual Studio 2015
Building Native “apps” with Visual Studio 2015
 
Ember.js and .NET Integration
Ember.js and .NET IntegrationEmber.js and .NET Integration
Ember.js and .NET Integration
 
Fun with lambda expressions
Fun with lambda expressionsFun with lambda expressions
Fun with lambda expressions
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NET
 
Seminar General Data Protection Regulation
Seminar General Data Protection RegulationSeminar General Data Protection Regulation
Seminar General Data Protection Regulation
 
Fun with windows services
Fun with windows servicesFun with windows services
Fun with windows services
 
An evening with querydsl
An evening with querydslAn evening with querydsl
An evening with querydsl
 
Fun with lambda expressions
Fun with lambda expressionsFun with lambda expressions
Fun with lambda expressions
 
The Data Protection Act
The Data Protection ActThe Data Protection Act
The Data Protection Act
 
An afternoon with angular 2
An afternoon with angular 2An afternoon with angular 2
An afternoon with angular 2
 

Similar to Securing your azure web app with asp.net core data protection

Secure360 - Extracting Password from Windows
Secure360 - Extracting Password from WindowsSecure360 - Extracting Password from Windows
Secure360 - Extracting Password from Windows
Scott Sutherland
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
NetSPI
 
KeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
KeyD: Secure Key-Deduplication with Identity-Based Broadcast EncryptionKeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
KeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
SREEPRAVALLIKABHANDA
 
key aggregate cryptosystem for scalable data sharing in cloud
key aggregate cryptosystem for scalable data sharing in cloudkey aggregate cryptosystem for scalable data sharing in cloud
key aggregate cryptosystem for scalable data sharing in cloud
Sravan Narra
 
Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
Racf psw enhancement
Racf psw enhancementRacf psw enhancement
Racf psw enhancement
Luigi Perrone
 
multiple encryption in clouud computing
multiple encryption in clouud computingmultiple encryption in clouud computing
multiple encryption in clouud computing
Rauf Wani
 
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain AccessDefcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
eightbit
 
Sql_DG_presentation.pptx
Sql_DG_presentation.pptxSql_DG_presentation.pptx
Sql_DG_presentation.pptx
ArunRangrej1
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
Michael Noel
 
IRJET- Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
IRJET-  	  Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud StorageIRJET-  	  Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
IRJET- Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
IRJET Journal
 
Steve Jones - Encrypting Data
Steve Jones - Encrypting DataSteve Jones - Encrypting Data
Steve Jones - Encrypting Data
Red Gate Software
 
Essential Guide to Protect Your Data [Key Management Techniques]
Essential Guide to Protect Your Data [Key Management Techniques]Essential Guide to Protect Your Data [Key Management Techniques]
Essential Guide to Protect Your Data [Key Management Techniques]
SISA Information Security Pvt.Ltd
 
Secretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdfSecretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdf
s87j3
 
Secretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdfSecretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdf
s87j3
 
MySQL Data Encryption at Rest
MySQL Data Encryption at RestMySQL Data Encryption at Rest
MySQL Data Encryption at Rest
Mydbops
 
SQLi for Security Champions
SQLi for Security ChampionsSQLi for Security Champions
SQLi for Security Champions
PetraVukmirovic
 
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Andrejs Prokopjevs
 
SQL Server Encryption - Adi Cohn
SQL Server Encryption - Adi CohnSQL Server Encryption - Adi Cohn
SQL Server Encryption - Adi Cohn
sqlserver.co.il
 
SQL Server Column Based Encryption
SQL Server Column Based EncryptionSQL Server Column Based Encryption
SQL Server Column Based Encryption
David Dye
 

Similar to Securing your azure web app with asp.net core data protection (20)

Secure360 - Extracting Password from Windows
Secure360 - Extracting Password from WindowsSecure360 - Extracting Password from Windows
Secure360 - Extracting Password from Windows
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
 
KeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
KeyD: Secure Key-Deduplication with Identity-Based Broadcast EncryptionKeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
KeyD: Secure Key-Deduplication with Identity-Based Broadcast Encryption
 
key aggregate cryptosystem for scalable data sharing in cloud
key aggregate cryptosystem for scalable data sharing in cloudkey aggregate cryptosystem for scalable data sharing in cloud
key aggregate cryptosystem for scalable data sharing in cloud
 
Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1Enterprise-class security with PostgreSQL - 1
Enterprise-class security with PostgreSQL - 1
 
Racf psw enhancement
Racf psw enhancementRacf psw enhancement
Racf psw enhancement
 
multiple encryption in clouud computing
multiple encryption in clouud computingmultiple encryption in clouud computing
multiple encryption in clouud computing
 
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain AccessDefcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
 
Sql_DG_presentation.pptx
Sql_DG_presentation.pptxSql_DG_presentation.pptx
Sql_DG_presentation.pptx
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
 
IRJET- Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
IRJET-  	  Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud StorageIRJET-  	  Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
IRJET- Key-Aggregate Cryptosystem for Scalable Data Sharing in Cloud Storage
 
Steve Jones - Encrypting Data
Steve Jones - Encrypting DataSteve Jones - Encrypting Data
Steve Jones - Encrypting Data
 
Essential Guide to Protect Your Data [Key Management Techniques]
Essential Guide to Protect Your Data [Key Management Techniques]Essential Guide to Protect Your Data [Key Management Techniques]
Essential Guide to Protect Your Data [Key Management Techniques]
 
Secretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdfSecretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdf
 
Secretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdfSecretsth-Azure-KeyVault-and-Azure-App.pdf
Secretsth-Azure-KeyVault-and-Azure-App.pdf
 
MySQL Data Encryption at Rest
MySQL Data Encryption at RestMySQL Data Encryption at Rest
MySQL Data Encryption at Rest
 
SQLi for Security Champions
SQLi for Security ChampionsSQLi for Security Champions
SQLi for Security Champions
 
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
 
SQL Server Encryption - Adi Cohn
SQL Server Encryption - Adi CohnSQL Server Encryption - Adi Cohn
SQL Server Encryption - Adi Cohn
 
SQL Server Column Based Encryption
SQL Server Column Based EncryptionSQL Server Column Based Encryption
SQL Server Column Based Encryption
 

More from Mike Melusky

Container Orchestration for .NET Developers
Container Orchestration for .NET DevelopersContainer Orchestration for .NET Developers
Container Orchestration for .NET Developers
Mike Melusky
 
Containerize all the things!
Containerize all the things!Containerize all the things!
Containerize all the things!
Mike Melusky
 
Building a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet coreBuilding a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet core
Mike Melusky
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Mike Melusky
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Mike Melusky
 
Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2
Mike Melusky
 
Building xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvmBuilding xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvm
Mike Melusky
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
Mike Melusky
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
Mike Melusky
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
Mike Melusky
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
Mike Melusky
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)
Mike Melusky
 
Philly.NET Code Camp 2014.1
Philly.NET Code Camp 2014.1Philly.NET Code Camp 2014.1
Philly.NET Code Camp 2014.1
Mike Melusky
 

More from Mike Melusky (13)

Container Orchestration for .NET Developers
Container Orchestration for .NET DevelopersContainer Orchestration for .NET Developers
Container Orchestration for .NET Developers
 
Containerize all the things!
Containerize all the things!Containerize all the things!
Containerize all the things!
 
Building a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet coreBuilding a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet core
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
 
Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2
 
Building xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvmBuilding xamarin.forms apps with prism and mvvm
Building xamarin.forms apps with prism and mvvm
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)Into to Docker (Central PA Java User Group - 8/14/2017)
Into to Docker (Central PA Java User Group - 8/14/2017)
 
Philly.NET Code Camp 2014.1
Philly.NET Code Camp 2014.1Philly.NET Code Camp 2014.1
Philly.NET Code Camp 2014.1
 

Recently uploaded

How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 

Recently uploaded (20)

How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 

Securing your azure web app with asp.net core data protection

  • 1. SECURING YOUR AZURE WEB APP WITH ASP.NET CORE DATA PROTECTION MICHAEL MELUSKY - @MRJAVASCRIPT OCTOBER 22, 2016 – PHILLY.NET 2016.2
  • 2. AGENDA • Discussing Windows encryption standards before ASP.NET core • Build a basic ASP.NET core MVC application • Introduce encryption using the new Data Protector framework • Obtain a free SSL certificate from Lets Encrypt!
  • 3. ABOUT THE SPEAKER • Michael Melusky • Software developer at Audacious Inquiry in Baltimore, MD • Adjunct instructor at Penn State University and Franklin and Marshall College
  • 4. CRYPTOGRAPHY PRIOR TO ASP.NET CORE • Used machine key generation • For instance in web.config (system > configuration) • <machineKey validationKey="F5FBC9F875CF84173728F23325083E3D97CF9D17FCCA672A D310BE069361BD4C55C4627F0B6725322AB63EAA8F01D7DF72DE85DBC603567 848EAF124D5C16BC7" decryptionKey="6F1070AC50E4EAA432120A4DA023BE64EB6BB450BDF6ECEE A9E59E40BA26475E" validation="SHA1" decryption="AES" />
  • 5. PURPOSE OF MACHINE KEY • Configures the algorithms and keys used for: • Encryption and decryption • Validation of forms-authentication data and view-state data • And also out of process session-state information
  • 8. HOW DOES THIS RELATE TO MODERN APPLICATIONS TODAY? • Microsoft introduced the Data Protector framework with ASP.NET Core 1.0 • Web applications need to store sensitive data • Windows provides DPAPI for desktop applications but it unsuitable for web applications • The ASP.NET Core Data Protection stack provides an easy-to-use API developers can use to protect data • Includes key management and rotation
  • 9. ASP.NET CORE DATA PROTECTION • *** DEMO: Build a basic ASP.NET Core MVC web application ***
  • 10. ASP.NET DATA PROTECTION IN A NUTSHELL • Create a data protector from a data protection provider • Call the Protect method to protect the data you want to protect • Call the Unprotect method on the data you want to turn back into plaintext
  • 11. ASP.NET CORE DATA PROTECTION • *** DEMO: secure the sample ASP.NET web application ***
  • 12. DATA PROTECTION PURPOSE STRINGS • The purposes parameter is inherent to the security of the data protection system, as it provides isolation between cryptographic consumers, even if the root cryptographic keys are the same. • When a consumer specifies a purpose, the purpose string is used along with the root cryptographic keys to derive cryptographic subkeys unique to that consumer • This isolates the consumer from all other cryptographic consumers in the application: no other component can read its payloads, and it cannot read any other component’s payloads • This isolation also renders infeasible entire categories of attack against the component
  • 15. OTHER FEATURES OF ASP.NET CORE DATA PROTECTION • New libraries for password hashing: • using System.Security.Cryptography; • using Microsoft.AspNetCore.Cryptography.KeyDerivation; • // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations) • string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( • password: password, • salt: salt, • prf: KeyDerivationPrf.HMACSHA1, • iterationCount: 10000, • numBytesRequested: 256 / 8)); • Console.WriteLine($"Hashed: {hashed}");
  • 16. OTHER FEATURES OF ASP.NET CORE DATA PROTECTION • Timed Data Protector: • developer wants to create a protected payload that expires after a set period of time • Not recommended to use this for data which requires long-term or indefinite persistence
  • 17. POTENTIAL SHORTCOMINGS • Deployment to a server farm: • Want to synchronize: • The application discriminator. This is a unique identifier for the application • The master encryption key. This is the closest thing to machine key in the new system • The encrypted set of session keys. This is a set of XML files that contain the valid session key(s) that can be used to encrypt/decrypt state data • Azure Web Apps is easier! • All applications are installed to the same location, so the application discriminator lines up. • Keys aren’t encrypted at rest, so there is no master encryption key. • The session keys are put in a special folder location that is “magically” synchronized across all instances of the Azure Web App
  • 18. ASP.NET CORE DATA PROTECTION - KEY MANAGEMENT • The system tries to detect its operational environment and provide good zero-configuration behavioral defaults. The heuristic used is as follows. • If the system is being hosted in Azure Web Sites, keys are persisted to the “%HOME%ASP.NETDataProtection-Keys” folder. This folder is backed by network storage and is synchronized across all machines hosting the application. Keys are not protected at rest. • If the user profile is available, keys are persisted to the “%LOCALAPPDATA%ASP.NETDataProtection- Keys” folder. Additionally, if the operating system is Windows, they’ll be encrypted at rest using DPAPI. • If the application is hosted in IIS, keys are persisted to the HKLM registry in a special registry key that is ACLed only to the worker process account. Keys are encrypted at rest using DPAPI. • If none of these conditions matches, keys are not persisted outside of the current process. When the process shuts down, all generated keys will be lost.
  • 19. ASP.NET CORE DATA PROTECTION - KEY LIFETIME • Keys by default have a 90-day lifetime. • When a key expires, the system will automatically generate a new key and set the new key as the active key. • As long as retired keys remain on the system you will still be able to decrypt any data protected with them.
  • 20. ASP.NET CORE DATA PROTECTION - DEFAULT ALGORITHMS • The default payload protection algorithm used is AES-256-CBC for confidentiality and HMACSHA256 for authenticity. • A 512-bit master key, rolled every 90 days, is used to derive the two sub-keys used for these algorithms on a per-payload basis
  • 21. CONFIGURING DATA PROTECTION • public void ConfigureServices(IServiceCollection services) • { • services.ConfigureDataProtection(dp => • { • dp.PersistKeysToFileSystem(new DirectoryInfo(@"c:keys")); • dp.SetDefaultKeyLifetime(TimeSpan.FromDays(14)); • });
  • 22. DEPLOYMENT TO AZURE • *** DEMO: deploy app to Azure ***
  • 23. WHAT’S LEFT? • SSL Certificate for the web site • Let’s Encrypt! - free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG).
  • 24. LET’S ENCRYPT • *** DEMO Let’s Encrypt on Azure ***
  • 25. QUESTIONS? • Thank you for coming • Michael Melusky - @mrjavascript