SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
Secure Your Encryption with HSM
Narudom Roongsiriwong, CISSP
OWASP Thailand Chapter Meeting 4/2017
June 29, 2017
WhoAmI
● Lazy Blogger
– Japan, Security, FOSS, Politics, Christian
– http://narudomr.blogspot.com
● Information Security since 1995
● Web Application Development since 1998
● Head of IT Security and Solution Architecture, Kiatnakin Bank PLC (KKP)
● Consultant for OWASP Thailand Chapter
● Committee Member of Cloud Security Alliance (CSA), Thailand Chapter
● Consulting Team Member for National e-Payment project
● Committee Member of Thailand Banking Sector CERT (TB-CERT)
● Contact: narudom@owasp.org
Real World Cryptography
We spend too much time arguing about algorithm but lack of
time discussing
● Key controls and key management
● Key change/exchange procedures
● Cryptographic toolkits
● Random number/seed generators
● Process & documentation
● Training
Brute-Forcing vs Key Thef
Left hand side: At the Passwords^12 Conference, Jeremi Gosney (a.k.a epixoip) demonstrated a rig of
25 AMD Radeon GPUs that leveraged Virtual OpenCL Open Cluster (VCL)
Cryptography uses SECRET keys
How can we keep keys being SECRET?
Key Management Fundamental
“Key management is the hardest part of cryptography
and often the Achilles’ heel of an otherwise secure
system.”
- Bruce Schneier, Applied Cryptography (2nd edition)
Key Management Framework
Generation Exchange Storage Rotation Archiving Destruction
Key Usage
Key Generation
● Generate Key
● Register Owner
● Activate Key
● Deactivate Key
● Suspend and Re-Activate a Key
● Renew a Public Key
● Key Derivation or Key Update
● Associate a Key with its Metadata
● Modify Metadata
● List Key Metadata
Key Exchange
Establish Key
● Validate Public Key Domain
Parameters
● Validate Public Key
● Validate Public Key Certification
Path
● Validate Symmetric Key
● Validate Private Key (or Key Pair)
● Validate the Possession of a Private
Key
● Perform a Cryptographic Function
using the Key
● Manage the Trust Anchor Store
Cryptographic Key and
Metadata Security: During Key
Establishment
● Key Transport
● Key Agreement
● Key Confirmation
● Key Establishment Protocols
(TLS, IKE, SSH, …)
Key Storage
● Store Operational Key and Metadata
● Backup of a Key and its Metadata
● Recover Key and/or Metadata
● Enter a Key and Associated Metadata into a Cryptographic
Module
● Output a Key and Associated Metadata from a Cryptographic
Module
Key Rotation (Retirement)
● Replace Key (Rollover, Update and Renewal)
● De-register Key
● Revoke Key
– Document, Test and Maintain Compromise Management Plan
– Establish and Maintain Notification Process
– Assess Impact as Part of Incident Response
– Do Not Delete the Keys
Key Archival
● Archive Key and/or Metadata
● Recover Key and/or Metadata
Key Destruction
● Destruction of Encryption Key Materials
● Retention of Encryption Key Meta-Data
An Overview of Hardware Security Module
What is an HSM?
● Cryptographic Computing Hardware Module
● Protected Key Store
● Well-Defined Interface Protocol
● Hard to Compromise
Hardware Security Module
Other Names of HSM
● Personal Computer Security Module (PCSM)
● Secure Application Module (SAM)
● Secure Cryptographic Device (SCD)
● Secure Signature Creation Device (SSCD)
● Hardware Cryptographic Device
● Cryptographic Module
Source: SANS Institute InfoSec Reading Room, An Overview of Hardware Security Modules
Cryptographic Computing Module
● Hardware Accelerate Cryptography
– Symmetric: AES, 3DES, Blowfish, Aria, Camelia
– Asymmetric: RSA, DSA, Diffie-Hellman, ECC
● Secure Random Number Generator
● Message Digest (Hash)
● Message Authentication Code (MAC)
Protected Key Store
● Keys stored in tamper-proof nonvolatile memory
– If tampering is detected, memory will be malfunction
● Implemented using
– Covering components in epoxy
– Thin wires covering sensitive components
How HSM Helps Key Management?
● HSM has key generation functions
● HSM provides key transport and key agreement functions
● HSM provides protected key storage and key handling
functions
● HSM provides ciphertext translation function from one key to
another for key rotation
● HSM provides key backup/recover functions for key archival
● HSM is able to delete keys inside protected storage.
Main Application Areas
● PKI Environments
– Certification Authority (CA) and Registration Authority (RA)
– Generate, store and handle key pairs
● Card Payment Systems
– Authentication and integrity checking of messages
– Confidentiality (e.g. PIN)
– On-line PIN verification
– Checking card security codes
– Re-encryption of PIN blocks
– Card creation: PIN mailers, generation of magnetic stripe data,
personalization of chip cards
– E-commerce and M-commerce
– Home banking
Other Application Areas
● Key Distribution Centers
● SSL connectivity
● PayTV
● Access control: one time passwords, user authentication
● (Qualified) Digital signatures
● Time-stamping
● Trusted Platform Modules (TPM)
● Document protection
HSM Selection Criteria
Smart Card / SIM SD Card
HSM Form Factors
USB
Network / Remote InterfaceLocal Interface (PCI/PCIe)
HSM Key Store Architectures
Keys stored in HSM
● Pros:
– No additional component
is needed
– Ease of maintenance
● Cons:
– Limited numbers of keys
● Example Product: Safenet,
USB Type, Smart Card Type
Keys stored externally and
encrypted by master key in
HSM
● Pros:
– Unlimited or large
numbers of keys
● Cons:
– Additional components are
needed
– Hard to maintain
● Example Product: Thales
HSM: General Purpose vs Specific Purpose
General Purpose
● Equipped with standard
cryptographic algorithms
Symmetric, Asymmetric,
Hashing)
● Support major OS drivers
including VMWare and Hyper-V
● Support standard APIs
– PKCS#11
– Open SSL
– Java (JCE)
– Microsoft CAPI and CNG
Specific Purpose
● Optimized for specific function
– Security Application Module
(SAM) / SIM
– Electronics Fund Transfer /
Payment System
● Limited Cryptographic algorithm
● Support specific applications
– EFT Key Management
– MAC (Message Authentication
Code)
● May not support standard APIs
HSM Speed
● RSA Signing Speed → Signing operations per second (at 1024-
bit, public exponent 3 or 65537)
● RSA Key Generation Speed → Keys per second (at 1024-bit
and 2048-bit)
● Visa PIN Verification → Operation per second
● AES Encryption → MB per second (at 256-bit key length)
HSM Licensing
● HSM specification may support many cryptography algorithms
but not all are activated
– Algorithm activation based on the license
● Maximum encryption/decryption speed may not be the same as
declare in the specification
– Speed limit by the license
● Network or remote interface type HSM may limit the number of
hosts or IP addresses connected to the HSM upon the license
HSM: Standard and Certification
● FIPS 140-2
● Common Criteria Evaluation Assurance Level (CC-EAL)
● PCI HSM
● APCA
● MEPS
FIPS 140-2
Level Requirement
1 Basic security requirements
2 Tamper evidence, user authentication
3 Tamper detection/resistance, data zeroisation, splitting user roles
4 Very high tamper detection/resistance, Environmental protection
CC-EAL
● What Protection Profile (PP)
has been used for the Target
of Evaluation (ToE)?
– CMCKG-PP – Key
Generation
– CMCSO-PP – Signing
Operations
EAL1 Functionally tested
EAL2 Structurally tested
EAL3 Methodically tested and checked
EAL4 Methodically designed, tested,
and reviewed
EAL5 Semi-formally designed and
tested
EAL6 Semi-formally verified design and
tested
EAL7 Formally verified design and
tested
HSM Key Backup/Restore
● How do you backup your keystore?
– Smart Card
– Secure USB Storage
● Key synchronization among two HSMs or more?
● Can you restore a backup elsewhere?
– e.g. on a hot-standby site
● Split key backup possible?
● Well-known backup format?
Cloud HSM
● Amazon AWS CloundHSM
● IBM Bluemix HSM
https://aws.amazon.com/cloudhsm/
https://www.ibm.com/cloud-computing/bluemix/hardware-security-module
HSM API
● PKCS#11
● OpenSSL Engine
● Microsoft CAPI
● Java Cryptography Extension
● Vendor specific API
● Low level programming (need for speed)
– USB Type or Smart Card Type + Reader: PC/SC + vendor
specific smart card application protocol data unit (APDU)
– Network Type: Socket programming with vendor specific
protocol
PKCS#11
● PKCS #11 is one of the Public-Key Cryptography Standards but
also support other cryptographic functions
● Defines a platform-independent API to cryptographic tokens,
such as hardware security modules (HSM) and smart cards
● API name is “Cryptoki”, but often called PKCS#11 API as its
standard. Complex C API.
● Wrappers
– Java Cryptography Architecture/Extension (JCA/JCE)
– Pkcs11Interop → .NET (Open source, Nuget package available)
– PyKCS11 → Python
– Ruby-pkcs11 → Ruby
PKCS#11 Functions
● Key Management
– Key & Key Pair Generation
– Key Factory
– Key Agreement (Diffie-Hellman)
– Key Store (Keys & Certificates)
● Cipher (Encrypt/Decrypt)
● Secure Random Number Generator
● Message Digest
● Message Authentication
● Digital Signature
Key Management with HSM Web Service
Pain Points
● How can we encourage developers adopt HSM and key
management process?
● How can we ensure that developers properly implement only
approved cryptography algorithm?
● How can we help applications rotate keys properly and
correctly?
● If we need stronger encryption algorithm or longer key
length in the future, how can we migrate the encrypted data
without application modification?
HSM Wrapper API Connection Diagram
Wrapping Functions
● decryptdata(AppKeyID, Ciphertext)
– Return Plaintext
● encryptdata(AppKeyID, Plaintext)
– Return Ciphertext
● translatedata(AppKeyID, Ciphertext)
– Return new CipherText
● AppKeyID is not the same as HSM key ID but
a pointer to a configuration record of
– Encryption algorithm
– History list of HSM key IDs usage
– decryptdata & encryptdata will always use
current key that associates with AppKeyID
● Ciphertext is encrypted data
● Plaintext is original data
HSMKeyID AppKeyID ValidFrom
39 3 Last Jan 1
40 4 Last Feb 1
41 3 Next Jan 1
42 4 Next Feb 1
translatedata function will decrypt an input
ciphertext with the current key and re-encrypt
with the nearest future key
For example from key history table, if
AppKeyID=3, translatedata function will use
HSMKeyID=39 to decrypt input ciphertext to a
plaintext, then will encrypt that plaintext with
HSMKeyID=41 to a new ciphertext.
Application Example: PGP Decryption
Data
Encrypt key
using receiver‘s
public key
RSA
Encrypted Message
Encrypt Decrypt
Encrypt data
using random
key
q4fzNeBCRSYqv
Encrypted Key
Generate
Random
Key
Data
TIakvAQkCu2u
Random Key
Encrypted Message
Data
q4fzNeBCRSYqv
Encrypted Key
Decrypt data
using key
Decrypt using
receiver‘s
private key
RSA
TIakvAQkCu2u
Data
● Call Wrapper API’s
“decryptdata” function with
parameters
– AppID (Which App Profile)
– q4fzNeBCRSYqv as
Encrypted Data
● Receive TIakvAQkCu2u as
Decrypted Data
Application Example:
Secure Password for Deployment Automation
Secure Your Encryption with HSM

Mais conteúdo relacionado

Mais procurados

Abusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get itAbusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get itBenjamin Delpy
 
6. cryptography
6. cryptography6. cryptography
6. cryptography7wounders
 
Email Security Presentation
Email Security PresentationEmail Security Presentation
Email Security PresentationYosef Gamble
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Codingbilcorry
 
User Authentication Overview
User Authentication OverviewUser Authentication Overview
User Authentication OverviewJim Fenton
 
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYCS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYKathirvel Ayyaswamy
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryWill Schroeder
 
Cours- Sécurité des réseaux
Cours- Sécurité des réseaux Cours- Sécurité des réseaux
Cours- Sécurité des réseaux Yassmina AGHIL
 
Secure Socket Layer
Secure Socket LayerSecure Socket Layer
Secure Socket LayerNaveen Kumar
 
IPSec Overview
IPSec OverviewIPSec Overview
IPSec Overviewdavisli
 
Chapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IChapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IDr. Ahmed Al Zaidy
 
Cissp d5-cryptography v2012-mini coursev2
Cissp d5-cryptography v2012-mini coursev2Cissp d5-cryptography v2012-mini coursev2
Cissp d5-cryptography v2012-mini coursev2infosecedu
 
secure socket layer
secure socket layersecure socket layer
secure socket layerAmar Shah
 

Mais procurados (20)

Public key Infrastructure (PKI)
Public key Infrastructure (PKI)Public key Infrastructure (PKI)
Public key Infrastructure (PKI)
 
Crypto graphy
Crypto graphyCrypto graphy
Crypto graphy
 
Abusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get itAbusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get it
 
6. cryptography
6. cryptography6. cryptography
6. cryptography
 
SSL TLS Protocol
SSL TLS ProtocolSSL TLS Protocol
SSL TLS Protocol
 
Email Security Presentation
Email Security PresentationEmail Security Presentation
Email Security Presentation
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
 
User Authentication Overview
User Authentication OverviewUser Authentication Overview
User Authentication Overview
 
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITYCS6701 CRYPTOGRAPHY AND NETWORK SECURITY
CS6701 CRYPTOGRAPHY AND NETWORK SECURITY
 
Cryptographie
CryptographieCryptographie
Cryptographie
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
 
Cours- Sécurité des réseaux
Cours- Sécurité des réseaux Cours- Sécurité des réseaux
Cours- Sécurité des réseaux
 
Secure Socket Layer
Secure Socket LayerSecure Socket Layer
Secure Socket Layer
 
IPSec Overview
IPSec OverviewIPSec Overview
IPSec Overview
 
Le chiffrement
Le chiffrementLe chiffrement
Le chiffrement
 
Chapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IChapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K I
 
Cryptography
CryptographyCryptography
Cryptography
 
Cissp d5-cryptography v2012-mini coursev2
Cissp d5-cryptography v2012-mini coursev2Cissp d5-cryptography v2012-mini coursev2
Cissp d5-cryptography v2012-mini coursev2
 
Ipsec
IpsecIpsec
Ipsec
 
secure socket layer
secure socket layersecure socket layer
secure socket layer
 

Semelhante a Secure Your Encryption with HSM

HKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEEHKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEELinaro
 
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEEBKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEELinaro
 
Managing secrets at scale
Managing secrets at scaleManaging secrets at scale
Managing secrets at scaleAlex Schoof
 
CISSP Week 22
CISSP Week 22CISSP Week 22
CISSP Week 22jemtallon
 
Inro to Secure Sockets Layer: SSL
Inro to Secure Sockets Layer: SSLInro to Secure Sockets Layer: SSL
Inro to Secure Sockets Layer: SSLDipankar Achinta
 
FIPS 140-2 Validations in a Secure Enclave
FIPS 140-2 Validations in a Secure EnclaveFIPS 140-2 Validations in a Secure Enclave
FIPS 140-2 Validations in a Secure EnclavewolfSSL
 
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...Ramesh Nagappan
 
Shytikov on NTLM Authentication
Shytikov on NTLM AuthenticationShytikov on NTLM Authentication
Shytikov on NTLM Authenticationshytikov
 
Understanding the Role of Hardware Data Encryption in EMV and P2PE
Understanding the Role of Hardware Data Encryption in EMV and P2PEUnderstanding the Role of Hardware Data Encryption in EMV and P2PE
Understanding the Role of Hardware Data Encryption in EMV and P2PEGreg Stone
 
Microservices on a budget meetup
Microservices on a budget   meetupMicroservices on a budget   meetup
Microservices on a budget meetupMatthew Reynolds
 
[Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things![Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things!OWASP
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxGiuseppe Paterno'
 
Introduction to cryptography for software developers
Introduction to cryptography for software developersIntroduction to cryptography for software developers
Introduction to cryptography for software developersIntopalo Digital Oy
 
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...OpenNebula Project
 
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...Dmytro Korzhevin
 
Course_Presentation cyber --------------.pptx
Course_Presentation cyber --------------.pptxCourse_Presentation cyber --------------.pptx
Course_Presentation cyber --------------.pptxssuser020436
 

Semelhante a Secure Your Encryption with HSM (20)

HKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEEHKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEE
 
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEEBKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
 
Slides for CC & IAAS
Slides for CC & IAASSlides for CC & IAAS
Slides for CC & IAAS
 
Managing secrets at scale
Managing secrets at scaleManaging secrets at scale
Managing secrets at scale
 
CISSP Week 22
CISSP Week 22CISSP Week 22
CISSP Week 22
 
Inro to Secure Sockets Layer: SSL
Inro to Secure Sockets Layer: SSLInro to Secure Sockets Layer: SSL
Inro to Secure Sockets Layer: SSL
 
FIPS 140-2 Validations in a Secure Enclave
FIPS 140-2 Validations in a Secure EnclaveFIPS 140-2 Validations in a Secure Enclave
FIPS 140-2 Validations in a Secure Enclave
 
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...
Analysis of Security and Compliance using Oracle SPARC T-Series Servers: Emph...
 
Shytikov on NTLM Authentication
Shytikov on NTLM AuthenticationShytikov on NTLM Authentication
Shytikov on NTLM Authentication
 
Understanding the Role of Hardware Data Encryption in EMV and P2PE
Understanding the Role of Hardware Data Encryption in EMV and P2PEUnderstanding the Role of Hardware Data Encryption in EMV and P2PE
Understanding the Role of Hardware Data Encryption in EMV and P2PE
 
IPsec on Mikrotik
IPsec on MikrotikIPsec on Mikrotik
IPsec on Mikrotik
 
Microservices on a budget meetup
Microservices on a budget   meetupMicroservices on a budget   meetup
Microservices on a budget meetup
 
[Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things![Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things!
 
App Security and Securing App
App Security and Securing AppApp Security and Securing App
App Security and Securing App
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
 
Introduction to cryptography for software developers
Introduction to cryptography for software developersIntroduction to cryptography for software developers
Introduction to cryptography for software developers
 
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
 
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
 
Course_Presentation cyber --------------.pptx
Course_Presentation cyber --------------.pptxCourse_Presentation cyber --------------.pptx
Course_Presentation cyber --------------.pptx
 

Mais de Narudom Roongsiriwong, CISSP

How Good Security Architecture Saves Corporate Workers from COVID-19
How Good Security Architecture Saves Corporate Workers from COVID-19How Good Security Architecture Saves Corporate Workers from COVID-19
How Good Security Architecture Saves Corporate Workers from COVID-19Narudom Roongsiriwong, CISSP
 
Embedded System Security: Learning from Banking and Payment Industry
Embedded System Security: Learning from Banking and Payment IndustryEmbedded System Security: Learning from Banking and Payment Industry
Embedded System Security: Learning from Banking and Payment IndustryNarudom Roongsiriwong, CISSP
 
Application Security Verification Standard Project
Application Security Verification Standard ProjectApplication Security Verification Standard Project
Application Security Verification Standard ProjectNarudom Roongsiriwong, CISSP
 
Top 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security ProblemsTop 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security ProblemsNarudom Roongsiriwong, CISSP
 

Mais de Narudom Roongsiriwong, CISSP (20)

Biometric Authentication.pdf
Biometric Authentication.pdfBiometric Authentication.pdf
Biometric Authentication.pdf
 
Security Shift Leftmost - Secure Architecture.pdf
Security Shift Leftmost - Secure Architecture.pdfSecurity Shift Leftmost - Secure Architecture.pdf
Security Shift Leftmost - Secure Architecture.pdf
 
Secure Design: Threat Modeling
Secure Design: Threat ModelingSecure Design: Threat Modeling
Secure Design: Threat Modeling
 
Security Patterns for Software Development
Security Patterns for Software DevelopmentSecurity Patterns for Software Development
Security Patterns for Software Development
 
How Good Security Architecture Saves Corporate Workers from COVID-19
How Good Security Architecture Saves Corporate Workers from COVID-19How Good Security Architecture Saves Corporate Workers from COVID-19
How Good Security Architecture Saves Corporate Workers from COVID-19
 
Secure Software Design for Data Privacy
Secure Software Design for Data PrivacySecure Software Design for Data Privacy
Secure Software Design for Data Privacy
 
Blockchain and Cryptocurrency for Dummies
Blockchain and Cryptocurrency for DummiesBlockchain and Cryptocurrency for Dummies
Blockchain and Cryptocurrency for Dummies
 
DevSecOps 101
DevSecOps 101DevSecOps 101
DevSecOps 101
 
National Digital ID Platform Technical Forum
National Digital ID Platform Technical ForumNational Digital ID Platform Technical Forum
National Digital ID Platform Technical Forum
 
IoT Security
IoT SecurityIoT Security
IoT Security
 
Embedded System Security: Learning from Banking and Payment Industry
Embedded System Security: Learning from Banking and Payment IndustryEmbedded System Security: Learning from Banking and Payment Industry
Embedded System Security: Learning from Banking and Payment Industry
 
Application Security Verification Standard Project
Application Security Verification Standard ProjectApplication Security Verification Standard Project
Application Security Verification Standard Project
 
Coding Security: Code Mania 101
Coding Security: Code Mania 101Coding Security: Code Mania 101
Coding Security: Code Mania 101
 
Top 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security ProblemsTop 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security Problems
 
OWASP Top 10 Proactive Control 2016 (C5-C10)
OWASP Top 10 Proactive Control 2016 (C5-C10)OWASP Top 10 Proactive Control 2016 (C5-C10)
OWASP Top 10 Proactive Control 2016 (C5-C10)
 
Securing the Internet from Cyber Criminals
Securing the Internet from Cyber CriminalsSecuring the Internet from Cyber Criminals
Securing the Internet from Cyber Criminals
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
Secure Software Development Adoption Strategy
Secure Software Development Adoption StrategySecure Software Development Adoption Strategy
Secure Software Development Adoption Strategy
 
Secure PHP Coding
Secure PHP CodingSecure PHP Coding
Secure PHP Coding
 
Application Security: Last Line of Defense
Application Security: Last Line of DefenseApplication Security: Last Line of Defense
Application Security: Last Line of Defense
 

Último

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 

Último (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 

Secure Your Encryption with HSM

  • 1. Secure Your Encryption with HSM Narudom Roongsiriwong, CISSP OWASP Thailand Chapter Meeting 4/2017 June 29, 2017
  • 2. WhoAmI ● Lazy Blogger – Japan, Security, FOSS, Politics, Christian – http://narudomr.blogspot.com ● Information Security since 1995 ● Web Application Development since 1998 ● Head of IT Security and Solution Architecture, Kiatnakin Bank PLC (KKP) ● Consultant for OWASP Thailand Chapter ● Committee Member of Cloud Security Alliance (CSA), Thailand Chapter ● Consulting Team Member for National e-Payment project ● Committee Member of Thailand Banking Sector CERT (TB-CERT) ● Contact: narudom@owasp.org
  • 3. Real World Cryptography We spend too much time arguing about algorithm but lack of time discussing ● Key controls and key management ● Key change/exchange procedures ● Cryptographic toolkits ● Random number/seed generators ● Process & documentation ● Training
  • 4. Brute-Forcing vs Key Thef Left hand side: At the Passwords^12 Conference, Jeremi Gosney (a.k.a epixoip) demonstrated a rig of 25 AMD Radeon GPUs that leveraged Virtual OpenCL Open Cluster (VCL)
  • 5. Cryptography uses SECRET keys How can we keep keys being SECRET?
  • 7. “Key management is the hardest part of cryptography and often the Achilles’ heel of an otherwise secure system.” - Bruce Schneier, Applied Cryptography (2nd edition)
  • 8. Key Management Framework Generation Exchange Storage Rotation Archiving Destruction Key Usage
  • 9. Key Generation ● Generate Key ● Register Owner ● Activate Key ● Deactivate Key ● Suspend and Re-Activate a Key ● Renew a Public Key ● Key Derivation or Key Update ● Associate a Key with its Metadata ● Modify Metadata ● List Key Metadata
  • 10. Key Exchange Establish Key ● Validate Public Key Domain Parameters ● Validate Public Key ● Validate Public Key Certification Path ● Validate Symmetric Key ● Validate Private Key (or Key Pair) ● Validate the Possession of a Private Key ● Perform a Cryptographic Function using the Key ● Manage the Trust Anchor Store Cryptographic Key and Metadata Security: During Key Establishment ● Key Transport ● Key Agreement ● Key Confirmation ● Key Establishment Protocols (TLS, IKE, SSH, …)
  • 11. Key Storage ● Store Operational Key and Metadata ● Backup of a Key and its Metadata ● Recover Key and/or Metadata ● Enter a Key and Associated Metadata into a Cryptographic Module ● Output a Key and Associated Metadata from a Cryptographic Module
  • 12. Key Rotation (Retirement) ● Replace Key (Rollover, Update and Renewal) ● De-register Key ● Revoke Key – Document, Test and Maintain Compromise Management Plan – Establish and Maintain Notification Process – Assess Impact as Part of Incident Response – Do Not Delete the Keys
  • 13. Key Archival ● Archive Key and/or Metadata ● Recover Key and/or Metadata
  • 14. Key Destruction ● Destruction of Encryption Key Materials ● Retention of Encryption Key Meta-Data
  • 15. An Overview of Hardware Security Module
  • 16. What is an HSM? ● Cryptographic Computing Hardware Module ● Protected Key Store ● Well-Defined Interface Protocol ● Hard to Compromise Hardware Security Module
  • 17. Other Names of HSM ● Personal Computer Security Module (PCSM) ● Secure Application Module (SAM) ● Secure Cryptographic Device (SCD) ● Secure Signature Creation Device (SSCD) ● Hardware Cryptographic Device ● Cryptographic Module Source: SANS Institute InfoSec Reading Room, An Overview of Hardware Security Modules
  • 18. Cryptographic Computing Module ● Hardware Accelerate Cryptography – Symmetric: AES, 3DES, Blowfish, Aria, Camelia – Asymmetric: RSA, DSA, Diffie-Hellman, ECC ● Secure Random Number Generator ● Message Digest (Hash) ● Message Authentication Code (MAC)
  • 19. Protected Key Store ● Keys stored in tamper-proof nonvolatile memory – If tampering is detected, memory will be malfunction ● Implemented using – Covering components in epoxy – Thin wires covering sensitive components
  • 20. How HSM Helps Key Management? ● HSM has key generation functions ● HSM provides key transport and key agreement functions ● HSM provides protected key storage and key handling functions ● HSM provides ciphertext translation function from one key to another for key rotation ● HSM provides key backup/recover functions for key archival ● HSM is able to delete keys inside protected storage.
  • 21. Main Application Areas ● PKI Environments – Certification Authority (CA) and Registration Authority (RA) – Generate, store and handle key pairs ● Card Payment Systems – Authentication and integrity checking of messages – Confidentiality (e.g. PIN) – On-line PIN verification – Checking card security codes – Re-encryption of PIN blocks – Card creation: PIN mailers, generation of magnetic stripe data, personalization of chip cards – E-commerce and M-commerce – Home banking
  • 22. Other Application Areas ● Key Distribution Centers ● SSL connectivity ● PayTV ● Access control: one time passwords, user authentication ● (Qualified) Digital signatures ● Time-stamping ● Trusted Platform Modules (TPM) ● Document protection
  • 24. Smart Card / SIM SD Card HSM Form Factors USB Network / Remote InterfaceLocal Interface (PCI/PCIe)
  • 25. HSM Key Store Architectures Keys stored in HSM ● Pros: – No additional component is needed – Ease of maintenance ● Cons: – Limited numbers of keys ● Example Product: Safenet, USB Type, Smart Card Type Keys stored externally and encrypted by master key in HSM ● Pros: – Unlimited or large numbers of keys ● Cons: – Additional components are needed – Hard to maintain ● Example Product: Thales
  • 26. HSM: General Purpose vs Specific Purpose General Purpose ● Equipped with standard cryptographic algorithms Symmetric, Asymmetric, Hashing) ● Support major OS drivers including VMWare and Hyper-V ● Support standard APIs – PKCS#11 – Open SSL – Java (JCE) – Microsoft CAPI and CNG Specific Purpose ● Optimized for specific function – Security Application Module (SAM) / SIM – Electronics Fund Transfer / Payment System ● Limited Cryptographic algorithm ● Support specific applications – EFT Key Management – MAC (Message Authentication Code) ● May not support standard APIs
  • 27. HSM Speed ● RSA Signing Speed → Signing operations per second (at 1024- bit, public exponent 3 or 65537) ● RSA Key Generation Speed → Keys per second (at 1024-bit and 2048-bit) ● Visa PIN Verification → Operation per second ● AES Encryption → MB per second (at 256-bit key length)
  • 28. HSM Licensing ● HSM specification may support many cryptography algorithms but not all are activated – Algorithm activation based on the license ● Maximum encryption/decryption speed may not be the same as declare in the specification – Speed limit by the license ● Network or remote interface type HSM may limit the number of hosts or IP addresses connected to the HSM upon the license
  • 29. HSM: Standard and Certification ● FIPS 140-2 ● Common Criteria Evaluation Assurance Level (CC-EAL) ● PCI HSM ● APCA ● MEPS
  • 30. FIPS 140-2 Level Requirement 1 Basic security requirements 2 Tamper evidence, user authentication 3 Tamper detection/resistance, data zeroisation, splitting user roles 4 Very high tamper detection/resistance, Environmental protection
  • 31. CC-EAL ● What Protection Profile (PP) has been used for the Target of Evaluation (ToE)? – CMCKG-PP – Key Generation – CMCSO-PP – Signing Operations EAL1 Functionally tested EAL2 Structurally tested EAL3 Methodically tested and checked EAL4 Methodically designed, tested, and reviewed EAL5 Semi-formally designed and tested EAL6 Semi-formally verified design and tested EAL7 Formally verified design and tested
  • 32. HSM Key Backup/Restore ● How do you backup your keystore? – Smart Card – Secure USB Storage ● Key synchronization among two HSMs or more? ● Can you restore a backup elsewhere? – e.g. on a hot-standby site ● Split key backup possible? ● Well-known backup format?
  • 33. Cloud HSM ● Amazon AWS CloundHSM ● IBM Bluemix HSM https://aws.amazon.com/cloudhsm/ https://www.ibm.com/cloud-computing/bluemix/hardware-security-module
  • 34. HSM API ● PKCS#11 ● OpenSSL Engine ● Microsoft CAPI ● Java Cryptography Extension ● Vendor specific API ● Low level programming (need for speed) – USB Type or Smart Card Type + Reader: PC/SC + vendor specific smart card application protocol data unit (APDU) – Network Type: Socket programming with vendor specific protocol
  • 35. PKCS#11 ● PKCS #11 is one of the Public-Key Cryptography Standards but also support other cryptographic functions ● Defines a platform-independent API to cryptographic tokens, such as hardware security modules (HSM) and smart cards ● API name is “Cryptoki”, but often called PKCS#11 API as its standard. Complex C API. ● Wrappers – Java Cryptography Architecture/Extension (JCA/JCE) – Pkcs11Interop → .NET (Open source, Nuget package available) – PyKCS11 → Python – Ruby-pkcs11 → Ruby
  • 36. PKCS#11 Functions ● Key Management – Key & Key Pair Generation – Key Factory – Key Agreement (Diffie-Hellman) – Key Store (Keys & Certificates) ● Cipher (Encrypt/Decrypt) ● Secure Random Number Generator ● Message Digest ● Message Authentication ● Digital Signature
  • 37. Key Management with HSM Web Service
  • 38. Pain Points ● How can we encourage developers adopt HSM and key management process? ● How can we ensure that developers properly implement only approved cryptography algorithm? ● How can we help applications rotate keys properly and correctly? ● If we need stronger encryption algorithm or longer key length in the future, how can we migrate the encrypted data without application modification?
  • 39. HSM Wrapper API Connection Diagram
  • 40. Wrapping Functions ● decryptdata(AppKeyID, Ciphertext) – Return Plaintext ● encryptdata(AppKeyID, Plaintext) – Return Ciphertext ● translatedata(AppKeyID, Ciphertext) – Return new CipherText ● AppKeyID is not the same as HSM key ID but a pointer to a configuration record of – Encryption algorithm – History list of HSM key IDs usage – decryptdata & encryptdata will always use current key that associates with AppKeyID ● Ciphertext is encrypted data ● Plaintext is original data HSMKeyID AppKeyID ValidFrom 39 3 Last Jan 1 40 4 Last Feb 1 41 3 Next Jan 1 42 4 Next Feb 1 translatedata function will decrypt an input ciphertext with the current key and re-encrypt with the nearest future key For example from key history table, if AppKeyID=3, translatedata function will use HSMKeyID=39 to decrypt input ciphertext to a plaintext, then will encrypt that plaintext with HSMKeyID=41 to a new ciphertext.
  • 41. Application Example: PGP Decryption Data Encrypt key using receiver‘s public key RSA Encrypted Message Encrypt Decrypt Encrypt data using random key q4fzNeBCRSYqv Encrypted Key Generate Random Key Data TIakvAQkCu2u Random Key Encrypted Message Data q4fzNeBCRSYqv Encrypted Key Decrypt data using key Decrypt using receiver‘s private key RSA TIakvAQkCu2u Data ● Call Wrapper API’s “decryptdata” function with parameters – AppID (Which App Profile) – q4fzNeBCRSYqv as Encrypted Data ● Receive TIakvAQkCu2u as Decrypted Data
  • 42. Application Example: Secure Password for Deployment Automation