Вы находитесь на странице: 1из 33

CRYPTOGRAPHY

DATA ENCRYPTION
Bhaskar Kakulavarapu
ISACA-Detroit Chapter
March 15, 2017
Presentation - intro
■ Encryption is the process of changing information in such a way as to make it unreadable
by anyone except those recipients who have a secret phrase (also referred to as a "key")
which allows the recipient to convert the unreadable data back to its original, readable
form.
■ Businesses use encryption to protect corporate secrets, governments’ use encryption to
secure classified information, and many individuals use encryption to protect personal
information to guard against things like identity theft.
■ The topic on data encryption covers a brief introduction on cryptography technology,
history, types of cryptographic algorithms available, uses of cryptography in securing the
data and data communication channels, example of a simple encryption algorithm and
how it works, key management, challenges of implementation and support…..
History of encryption

■ Started as early as 1900 BC


■ Good compilation of history by SANS institute:
Link https://www.sans.org/reading-room/whitepapers/vpns/history-encryption-730
– About 1900 BC An Egyptian scribe used non-standard hieroglyphs in an inscription.
Kahn lists this as the first documented example of written cryptography.
– 1500 BC ancient Assyrian merchants used intaglio, a piece of flat stone carved into
a collage of images and some writing to identify themselves in trading transactions.
Using this mechanism, they are producing what today we know as 'digital
signature.' The public knew that a particular 'signature' belonged to this trader, but
only he had the intaglio to produce that signature.
What is encryption

■ Process of changing data/information in such a way it becomes unreadable –


scrambled text
■ Allows anyone that has special knowledge (also referred as a “key”) to change the
data/information back to its original and readable form
Why encryption
■ Enables
– Confidentiality of data – converts human readable data in scrambled text, hence, protects
data even if stolen
– Authentication of data – provides confidence that the data is from an expected source
– Integrity of data – protects data from unauthorized alteration
– Access control of data – protects data from unauthorized access
■ The goal of encryption is to make an attacker spend more time and resources than the encrypted
message is worth
■ The concept that the strength of the algorithm is not dependent upon secrecy of the method, but
rather the math. That’s why encryption algorithms are open and understood but still secure
■ No encryption is perfect and all is breakable (except OTP) if you have enough computation, or a
good functioning quantum computer
One-time pad
■ Frank Miller in 1882 was the first to describe the one-time pad (OTP) system for securing telegraphy
■ The next one-time pad system was electrical. In 1917, Gilbert Vernam (of AT&T Corporation) invented
and later patented in 1919
– Each character in a message was electrically combined with a character on a paper tape key
■ Joseph Mauborgne (then a captain in the U.S. Army and later chief of the Signal Corps) recognized that
the character sequence on the key tape could be completely random and that, if so, cryptanalysis
would be more difficult. Together they invented the first one-time tape system
■ The one-time pad (OTP) is an encryption technique that cannot be cracked, but requires the use of a
one-time pre-shared key the same size as the message being sent. The key is also called secret key
■ If the key is truly random, is at least as long as the plaintext, is never reused in whole or in part, and is
kept completely secret, then the resulting cipher text will be impossible to decrypt or break

https://koclab.cs.ucsb.edu/teaching/cren/notes/onetime.pdf
Cryptographic Algorithms - DES
■ DES - 'Data Encryption Standard'. This is a cipher that operates on 64-bit blocks of data, using a
56-bit key. It is a 'private key' system
– DES (the Data Encryption Standard) is a symmetric block cipher developed by IBM. The
algorithm uses a 56-bit key to encipher/decipher a 64-bit block of data. The key is always
presented as a 64-bit block, every 8th bit of which is ignored
■ Use of multiple length keys leads us to the Triple-DES algorithm, in which DES is applied three
times. If we consider a triple length key to consist of three 56-bit keys K1, K2, K3 then:
– Encryption process is:
■ Encrypt with K1
■ Decrypt with K2
■ Encrypt with K3
– Decryption is the reverse process:
■ Decrypt with K3
■ Encrypt with K2
■ Decrypt with K1
Cryptographic Algorithms - RSA
■ RSA is a public key algorithm invented by Rivest, Shamir and Adleman. The key used for encryption is different from (but related
to) the key used for decryption.
■ The algorithm is based on modular exponentiation. Numbers e, d and N are chosen with the property that if A is a number less
e d
than N, then (A mod N) mod N = A.
– N = 11; A = 9; d = 4 & e =7  (97 mod 11 ) 4 mod 11 = 9
■ This means that you can encrypt A with e and decrypt using d. Conversely you can encrypt using d and decrypt using e (though
doing it this way is usually referred to as signing and verification).
– The pair of numbers (e,N) is known as the public key and can be published.
– The pair of numbers (d,N) is known as the private key and must be kept secret.
■ The number e is known as the public exponent, the number d is known as the private exponent, and N is known as the modulus.
When talking of key lengths in connection with RSA, what is meant is the modulus length
■ Anybody knowing the public key can use it to create encrypted messages, but only the owner of the secret key can decrypt them
■ Conversely the owner of the secret key can encrypt messages that can be decrypted by anybody with the public key. Anybody
successfully decrypting such messages can be sure that only the owner of the secret key could have encrypted them. This fact is
the basis of the digital signature technique
■ The security of RSA depends on the difficulty of factorizing N. Given the power of modern computers, a length of 768 bits is
reasonably safe, but for serious commercial use 1024 bits is recommended. Number of combinations (2)1024 (232)32 
(1024)32
■ The problem with choosing long keys is that RSA is very slow compared with a symmetric block cipher such as DES, and the longer
the key the slower it is. The best solution is to use RSA for digital signatures and for protecting DES keys. Bulk data encryption
should be done using DES e.g. key => in2017letsh!vew0nderfultIme
Cryptographic Algorithms - AES

■ AES
– AES (acronym of Advanced Encryption Standard) is a symmetric encryption algorithm.
– The Advanced Encryption Standard using the Rijndael (pronounced rain-dahl) block cipher
approved by NIST
– The algorithm was developed by two Belgian cryptographer Joan Daemen and Vincent
Rijmen.
– AES was designed to be efficient in both hardware and software, and supports a block length
of 128 bits and key lengths of 128, 192, and 256 bits
– AES performs all its computations on bytes rather than bits
– Symmetric key (shared key) symmetric block (fixed length e.g. 32 bytes) cipher
– Stronger and is found at least six times faster than triple DES

https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
Hash Algorithms – SHA-2
■ SHA-2
– SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the National Security Agency (NSA)
– A 'hash algorithm' is used for computing a condensed representation of a fixed length message/file. This is
sometimes known as a 'message digest', or a 'fingerprint'..
– SHA-256 (also SHA-2) algorithm generates an almost-unique, fixed size 256-bit (32-byte) hash
– A hash is not ‘encryption’ – Hash is a one way function and cannot be decrypted back to the original text (it is a
‘one-way’ cryptographic function, and is a fixed size for any size of source text). This makes it suitable when it is
appropriate to compare ‘hashed’ versions of texts, as opposed to decrypting the text to obtain the original version
– challenge handshake authentication’ (or ‘challenge hash authentication’) avoids transmitting passwords in
‘clear’ – a client can send the hash of a password over the internet for validation by a server without risk of the
original password being intercepted
– anti-tamper – link a hash of a message to the original, and the recipient can re-hash the message and compare it
to the supplied hash: if they match, the message is unchanged; this can also be used to confirm no data-loss in
transmission
– digital signatures are rather more involved, but in essence, you can sign the hash of a document by encrypting it
with your private key, producing a digital signature for the document. Anyone else can then check that you
authenticated the text by decrypting the signature with your public key to obtain the original hash again, and
comparing it with their hash of the text
Hash Algorithms – MD5

■ MD5
– MD5 is a 128 bit message digest function. It was developed by Ron Rivest
– MD5 is a hashing algorithm that takes a message of up to 264 bits and reduces it to a digest of 128 bits
(16 bytes).
– The algorithm is a development of the MD4 algorithm invented by Ronald Rivest and announced in 1990.
Unfortunately, MD4 was flawed, so Rivest made some revisions, and the resulting algorithm was
christened MD5
– Any hashing (or digest) algorithm should be such that, given a digest and the corresponding message
from which it was derived, it should be computationally infeasible to construct a different message with
the same digest

https://www.wordfence.com/learn/how-passwords-work-and-cracking-passwords/
Hash Algorithms - HMAC
■ HMAC
– HMAC is a hashing method that uses a key in conjunction with an algorithm such as MD5 or SHA-2. Thus
one can refer to HMAC-MD5 and HMAC-SHA2.
– Cryptographic hash functions generally execute faster in software than symmetric block ciphers such as
DES
– There are no export restrictions for cryptographic hash functions, whereas symmetric block ciphers, even
when used for MACs, are restricted
– A hash function such as MD5 was not designed for use as a MAC and cannot be used directly for that
purpose because it does not rely on a secret key
– When attacking HMAC, attackers cannot generate message/code pairs offline because attackers do not
know the key
■ For a hash code length of 128 bits, it requires 264observed blocks (273 bits) generated using the same key. On a 1-
Gbps link, you would need to observe a continuous stream of messages with no change in the key for about
250,000 years to succeed. Thus, if speed is a concern, it is fully acceptable to use MD5
– HMAC received the most support
■ HMAC has been chosen as the mandatory-to-implement MAC for IP Security, and is used in other Internet protocols,
such as Transport Layer Security (TLS, soon to replace Secure Sockets Layer) and Secure Electronic Transaction
(SET)
Applications

■ Data security – encryption at rest


■ Secure data transfer – encryption while in transit
■ Internet payment systems – digital signatures
■ E-commerce – non-repudiation
■ Defense services – secure communication
Symmetric Key

■ It is the oldest and best-known technique


■ Its a secret key, which can be a number, a word, or just a string of random
characters
■ Both sender and recipient know the secret key
■ The same key is used to encrypt and decrypt all messages
■ All symmetric keys must be long and randomly generated
Transposition Cipher

1 2 3 4 5 6 4 2 5 1 6 3
L E T S D I S E D L I T
S C U S S A S C S S A U
F T E R M E R T M F E E
E T I N G N T G E I

• Plain Text: LETSDISCUSSAFTERMEETING


• Cipher text: SEDLITSCSSAURTMFEENTGEI
• Key Used : 425163  implies key length is 6 characters or 6 columns and
character position (which column) for each letter left to right
Symmetric key
■ Generate a key at random - Most cryptographic APIs have facilities to
generate keys at random and they normally avoid weak keys
■ Derive a key from a passphrase
– These are pieces of text that can be transformed into a key (usually by applying
a hash function or a cipher)
– They need to be easy to remember, but they should not come from a limited
key space that is easy to search
– They should not be subject to a dictionary attack
– Their big advantage is that they can be easily remembered so keys do not need
to stored
– There are a number of standards for deriving a symmetric key from a
passphrase.
Asymmetric key
■ An algorithm that uses different keys for encryption and decryption is said to be asymmetric
■ Asymmetric key contains two related keys – also called as a key pair
– A public key, and
– A private key
■ Public key is made freely available to anyone who might want to an encrypted message
■ Private key is kept secret, so that only the owner of it know it
■ Any message (text, binary files, or documents) that are encrypted by using the public key can only be
decrypted by applying the same algorithm, but by using the matching private key
■ Any message that is encrypted by using the private key can only be decrypted by using the matching
public key.
■ Public key can be shared over the internet
■ Shared secret key isn’t required
■ Asymmetric encryption, however, is slower than symmetric encryption. It requires far more processing
power to both encrypt and decrypt the content of the message.
■ Asymmetric Cryptography explained -
https://www.cs.cornell.edu/courses/cs5430/2013sp/TL04.asymmetric.html
Encoding vs. Encryption
■ Encoding:
– Purpose: The purpose of encoding is to transform data so that it can be properly (and safely) consumed by a
different type of system.
– Used for: For maintaining data usability i.e. To ensure that it is able to be properly consumed.
– Data Retrieval Mechanism: No key and can be easily reversed provided we know what algorithm was used in
encoding.
– Algorithms Used: ASCII, Unicode, URL Encoding, Base64
– Example: Binary data being sent over email, or viewing special characters on a web page.
■ Encryption:
– Purpose: The purpose of encryption is to transform data in order to keep it secret from others.
– Used for: For maintaining data confidentiality i.e., to ensure the data cannot be consumed by anyone other than
the intended recipient(s).
– Data Retrieval Mechanism: Original data can be obtained if we know the key and encryption algorithm used.
– Algorithms Used: AES, DES, RSA
– Example: Sending someone a secret letter that only they should be able to read, or securely sending a password
over the Internet.
Insecure Cryptography

■ Insecure cryptography –
– Proprietary encryption algorithms
– https://www.cigital.com/blog/standard-versus-proprietary-security-protocols/
– http://www.cs.ru.nl/~rverdult/phd_thesis-roel_verdult.pdf
– https://www.schneier.com/essays/archives/1998/01/security_pitfalls_in.html
Symmetric Key Distribution
■ Symmetric key
– Send part of the key by a courier, and
– The second (remaining) part of the key by a different courier
– If same courier, then send the two parts on different days
– Ensure that deliveries of the key components (part-1 and part-2) are not converged
to a single entity at the same time – e.g. Mail room
– Use special pre-numbered, opaque tamper-evident envelopes
– Communicate the number on the envelop through a separate trusted
communication channel – secure fax, secure email, etc.
– After receiving the envelopes, inspect for any tampering, verify the number on the
envelope, and communicate back to sender
– Encryption key and the encrypted data/information should not be sent or stored on
the same media
Symmetric Key Distribution
■ Two types of symmetric keys
– Session key
– Permanent key
■ Session key
– When two end systems (hosts, terminals, etc.) wish to communicate, they establish a logical connection (e.g., virtual
circuit). For the duration of that logical connection, called a session, all user data are encrypted with a one-time
session key. At the conclusion of the session the session key is destroyed.
■ Permanent key
– A permanent key is a key used between entities for the purpose of distributing session keys.
– A necessary element of this option requires a key distribution center (KDC)
■ The KDC process:
– Determines which systems are allowed to communicate with each other. When permission is granted for two systems
to establish a connection, the key distribution center provides a one-time session key for that connection
– When host A wishes to set up a connection to host B, it transmits a connection request packet to the KDC. The
communication between A and the KDC is encrypted using a master key shared only by A and the KDC
– If the KDC approves the connection request, it generates a unique one-time session key. It encrypts the session key
using the permanent key it shares with A and delivers the encrypted session key to A. Similarly, it encrypts the session
key using the permanent key it shares with B and delivers the encrypted session key to B
– A and B can now set up a logical connection and exchange messages and data, all encrypted using the temporary
session key
Asymmetric Encryption Keys
Distribution
■ Asymmetric public keys can be distributed through a non-secure medium (i.e. HTTP)
■ Asymmetric private keys should be distributed through a secure medium (i.e. HTTPS)
■ Validate the key using fingerprints or hashes prior to their use via another trusted,
out-of-band channel
Diffie-Hellman Key Exchange method
■ Two entities – sender, receiver
■ Sender and receiver agree on two prime numbers and exchange them publicly – e.g. 3 and 29
■ Sender and receiver will individually select separate private random numbers that are within the
range of the publicly exchanged two prime numbers – e.g. 3 < n1 < 29 and 3 < n2 < 29
■ n1 and n2 are kept secret – not shared, revealed or exposed
■ Sender and receiver will calculate pseudo random numbers using respective private random
numbers
– Sender 3n1 mod 29 = result1
– Receiver 3n2 mod 29 = result2
■ Sender and receiver exchange the calculated results with each other
– Sender shares result1 with receiver
– Receiver shares result2 with sender
■ Sender calculates the key – resutl2n1 mod 29
■ Receiver calculates the key – result1n2 mod 29
■ Calculated key is used to encrypt and decrypt the message
Cryptolocker Ransomware
■ Antivirus companies discovered a new ransomware known as Cryptolocker
■ This ransomware is particularly nasty because infected users are in danger of losing their personal files forever
Cryptolocker Ransomware
■ Spread through email attachments, this ransomware has been seen targeting companies through phishing
attacks.
■ Cryptolocker will encrypt users’ files using asymmetric encryption, which requires both a public and private
key.
■ The public key is used to encrypt and verify data, while private key is used for decryption, each the inverse of
the other.
■ The bad news is decryption is impossible unless a user has the private key stored on the cybercriminals’
server.
■ Infected users are instructed to pay $300 USD to receive this private key.
■ Infected users also have a time limit to send the payment. If this time elapses, the private key is destroyed,
and your files may be lost forever.
■ Files targeted are those commonly found on most PCs today; a list of file extensions for targeted files include:
3fr, accdb, ai, arw, bay, cdr, cer, cr2, crt, crw, dbf, dcr, der, dng, doc, docm, docx, dwg, dxf, dxg, eps, erf, indd,
jpe, jpg, kdc, mdb, mdf, mef, mrw, nef, nrw, odb, odm, odp, ods, odt, orf, p12, p7b, p7c, pdd, pef, pem, pfx,
ppt, pptm, pptx, psd, pst, ptx, r3d, raf, raw, rtf, rw2, rwl, srf, srw, wb2, wpd, wps, xlk, xls, xlsb, xlsm, xlsx

https://blog.malwarebytes.com/101/2013/10/cryptolocker-ransomware-what-you-need-to-know/
Key Management
■ Integrity of Encryption Keys during Transport
■ Separate Storage for Encryption Keys and Encrypted Data
– Encrypted data and the encryption keys used in the encryption process should not be stored
on the same storage media
– Storage of encryption keys on portable media that is properly protected both physically and
logically
– Place part of the key on one portable media device and another part of the key on a second
– enables physically and logically giving control of the two devices to different individuals
– Certain key types, such as PIN keys and master keys, must always be stored in physical
hardware and never be resident in a software system, including backup and archive systems
■ Recoverability of Encryption Keys
– To ensure availability, keys should be properly archived for recovery in case of temporary
storage medium loss during transport
– If requested, a disposal of the keys should be executed upon the recipient’s positive receipt
acknowledgement
■ However, best encryption algorithms can be defeated by poor key management
Key Management – Continued
■ The private key must be protected at all the times by the owner of the key
■ Public key repository should be available to those entities that require public keys
■ Keys must be securely distributed to recipients from where they are generated or stored while ensuring
the integrity and trust
■ Data owner has the responsibility to maintain the access controls and protection to the encryption keys:
– Encryption key management
– Storage of encryption keys and protection
■ The key management solution chosen must log every detail about the encryption and the decryption
tasks. The data captured should contain details of:
– Who (i.e. user) requested and/or used a key
– Application requested and/or used a key
– What data did they access
– When was the activity performed
■ Restrict access to the logs to prevent tampering or deletion
■ Implement controls for authentication and signing the log files for non-repudiation
Key Management – Continued
■ Keys arrive to the proper recipient with confidentiality protections
■ Keys arrive with integrity intact
■ Keys are distributed to proper recipients only
– Manual transport methods (e.g., file transfer, key loaders),
– Automated methods (e.g., key transport and/or key agreement protocols), or
– A combination of automated and manual methods
■ Mechanism of transport provides secure key import
■ Manage annual encryption key rotation
■ Ensure encryption keys are never stored or transmitted in the clear
■ Ensure regular backup of the key server to prevent loss
■ Segregation of duties with required controls must be implemented for the server(s) that
maintains the keys
■ Proper storage or disposal of the transport medium
Key Management – Continued
■ Maintenance of Key Meta-Data
– A log should be maintained and retained in compliance with the organization’s ‘Information
and Data Retention and Destruction’ practices. The log should contain meta-data necessary
to track the key usage, ownership and other relevant facts throughout the key’s lifecycle.
Examples of meta-data to maintain include:
■ Date of the activity
■ Description of the activity (generated keys, loaded keys, etc.)
■ The type of key(s) and key check values
■ If generating/loading keys, the application or device into which they were loaded
■ If encrypting a clear key under a master key, the master key name and key check value
■ Where the key(s) or component forms are stored
■ Names of Key Custodians participating
■ Signatures of Key Custodians (as the evidence of their witnessing the process and accepting the
responsibility of Key Custodian)
Key management challenges
■ Key management deals with cryptographic keys in a cryptosystem
– The key generation
– Exchange
– Storage
– Use of the keys
– Replacement of keys
■ Cryptographic protocol design, key servers, user procedures, and other relevant protocols
■ The management of cryptographic keys is essential to the effective use of encryption
■ Loss or corruption of these keys:
– Can lead to loss of access to systems and data
– Making a system completely unusable unless it is reformatted and reinstalled
■ The challenge grows with the size and complexity of the environment
■ The larger your user base, the more diverse is the environment, or the more distributed they
are, the greater the challenge will be
Key management challenges
■ User training and acceptance
– Ease of use
– Impact to the users in the areas of application or system interface (login)
– Latency due to the encryption process
– Difficulties in key recovery or resetting the users key or passwords
■ System administration, maintenance and key recovery
– Key management is a task that does not scale well
– On an enterprise scale, manual key management simply isn't feasible
– Key management should integrate with the existing infrastructure (such as
Active Directory) while providing easy administration, secure key delivery and
recovery
Key management challenges
■ Key recovery process
– Process to recover the key when an employee leaves the organization without a
proper turnover, or if a key becomes damaged and can no longer be used
– Recovery should be a simple, but secure process
– Process should allow a recovery key to be split into several parts
– The individual parts of the recovery key should be distributed to different security
officers
– The owners of each part must be present when the key is used. This process is
simple (driven by a software wizard) yet secure because it requires several parties
to recreate the key
■ Key generation
– Should be restricted to an appropriate person(s)
Questions

Вам также может понравиться