MITT

A Taxonomy of Cryptography

posted on 25 Nov 2009 10:50 by techinnoreview  in MITT
Taxonomy of Cryptography มี cipher 3 ประเภท
Three categories of ciphers
 
  1. Symmetric ciphers 
  2. Public key cryptosystems
  3. Hash functions
 
 
Symmetric ciphers เร็วกว่า Public key cryptosystems 
 
The goal of cryptanalysis is to recover the plaintext, the key, or both
ป้องกันทั้ง plaintext และ key  
 
By KerckhoffsPrinciple, we assume that
Trudy the cryptanalyst has complete knowledge of the inner workings of the algorithm
 
Another basic assumption is that Trudy has access to the ciphertext 
 
If Trudy only knows the algorithms and the ciphertext,
then she must conduct a ciphertextonlyattack.
 
Known plaintext-Trudy might know some of the plaintext
and observe the corresponding ciphertext.
รู้เนื้อความแค่บางส่วน แล้วนำมาใช้เจาะ 
 
Chosen plaintext–Choosing the plaintext to be encrypted and
see the corresponding ciphertext 
เข้ารหัสใหม่แล้วเอาข้อมูลมาเปรียบเทียบกัน
 
Adaptively chosen plaintext-Trudy chooses the plaintext,
views the resulting ciphertext, and chooses the next plaintext based
on the observed ciphertext.
  เข้ารหัสใหม่แล้วเอาข้อมูลมาเปรียบเทียบกันแบบหลายข้อมูลและมีการวิเคราะห์มากขึ้น
 

Forward search-Suppose Trudy intercepts a ciphertext that was encrypted with
Alice’s public key.
If Trudy suspects that the plaintext message was either “yes”or “no,”then she can encrypt both
of these putative plaintexts with Alice’s public key.
If either matches the ciphertext, then the message has been broken. 
 
 
Symmetric Cryptography
 
Stream ciphers (เลิกใช้ไปแล้ว)
  • The key is “stretched”into a long stream of bits
  • Confusion only
  • A5/1, RC4
 
Block ciphers
  • Based of the codebook concept
  • Confusion and diffusion
  • DES, Triple DES, 
  • AES
 
Stream Ciphers
 
  • Takes a key K of n bits
  • Stretches it into a long keystream
  • XOR with the plaintext P to produce a ciphertext C
  • To decrypt, use the same key stream and XOR it with C
Function
StreamCipher(K) = S
เข้ารหัสทีละ bit
ถอดรหัสทีละ bit เช่นกัน
 
Stream Ciphers –RC4
A look up table containing a permutation of the 256-byte values
 
Each time a byte is produced, the look up table is modified in such a way that the table always contains a permutation of {0,1,2, …,255} 
  
First phase สร้างตาราง

 
Initialisesthe lookup table using the key 
generate key ขึ้นมาเป็น array 2 อัน
 
 

RC4 is used in many applications –SSL and WEP
 
Little effort to develop new stream ciphers
 
“Death of stream ciphers”
 
Block ciphers are in ascendency
 
Block Ciphers
  • A block cipher is a function that maps n-bit plaintext blocks to n-bit ciphertext 
blocks, nis called the blocklength
  • Splits plaintext into fixed sized blocks
  • Generates fixed sized blocksof ciphertext 
 
  • The ciphertext is obtained from the plaintext by iterating a function
F over some number of rounds
  • The function F, which depends on the output of the previous round and the key K,
is known as a round function  
 
 
Confusion
 
Complicate relations between keysand ciphertexttoprohibit cryptanalyst from gaining useful information of key from statistical analyses of ciphertext
 
Diffusion
 
Dissipate plaintext redundancyand other characteristicsby defusing/maskingthem within entire ciphertext
 
Transposition, Composition 
 
 
 
 
 
 
 
 Block Ciphers -DES
  • Data Encryption Standard
  • Processes plaintext blocks of n = 64 bits, producing 64-bit ciphertext blocks
  • The effective size of the secret key K is k = 56 bits
  • Encryption proceeds in 16 rounds วน loop 16 ครั้ง
  • From the input key K, sixteen 48-bit subkeysKiare generated, one for each round
  • Within each round, 8 fixed substitution mappings (S-boxes) Siare used
แบ่งเนื้อความเป็น 2 ส่วน ส่วนซ้ายกับขวา
  • The 64-bit plaintext is divided into 32-bit halves L0and R0
  • Each round takes 32-bit inputs Li-1andRi-1from the previous round
  • Produces 32-bit outputLiand Rifor 1 ≤i ≤16, as follows

  • E is a fixed expansion permutation mappingRi-1from 32 to 48 bits
  • P is another fixed permutation on 32 bits
  • An initial bit permutation (IP) precedes the first round
  • Following the last round, the left and right halves are exchanged
  • The resulting string is bit-permutated by the inverse of IP
Decryption
  • The same key and algorithm
  • But with subkeysapplied to the internal rounds in the reverse order
Initial / Final Permutation
  • Shuffle input/output bits by table look-up
  • NO security effect
Round Key Generation
  • Produce 16 48-bit keys
  • Takes different subset of 56-bit master key
DES Internal Rounds
  • Perform confusion by mangling S-boxes
  • Perform diffusion by two-part shuffle and XOR
Strengths of DES
  • Even if you have the plaintext and ciphertext, it seems difficult to get the key
  • Altering 1 bit of the plaintext block alters about half of the bits of the ciphertextblock
  • The functions are a mixture of different mathematical structures with no apparent shortcut
  • DES is tried and tested
 
Weaknesses of DES
 
The key size of 56 bits is now too small. It is feasible these days to
exhaustively search a key space of size 2 
 
Block Ciphers –Triple DES
 
  • One way to improve the security of DES is to increase the key size
  • This is done by using a variation called Triple DES
  • 3 DES keys K1,K2and K3
  • The key size is now 3*56 = 168 bits which is long enough to defeat exhaustive key search attacks with current technology 
Sender (Alice):
  1. First Alice encrypts the message Mwith key K1 to get C
  2. She then Decrypts C with key K2 to get M’,
  3. Finally she encrypts M’ with key K3 to get C’ which she sends to Bob
Receiver (Bob):
  1. Bob also has the 3 keys K1, K2 and K3
  2. Bob decrypts C’ using key K3 to get M’,
  3. He then encrypts M’ using key K2 to get C
  4. Finally Bob decrypts Cusing key K1to get the original message M
Block Ciphers –AES
  • Advanced Encryption Standard
  • Rijndael algorithm
  • Can process data blocks of 128 bits
  • Using cipher keys with lengths of 128, 192 and 256 bits
  • AES-128, AES-192 and AES-256
  • Input and output –sequences of 128 bits
  • The sequences –known as blocks
  • The basic unit for processing in AES is a byte
  • For an input, output and cipher key denoted by a, the resulting array will be referenced as a nor a[n],where
 
 
 
 
  • The length of the input block, the output block and the State is 128 bits
  • Represented as Nb= 4 (number of columns in the State)
  • The length of the Cipher Key, K, is 128, 192 or 256 bits
  • Represented as Nk= 4, 6 or 8 (number of columns in the Cipher Key 
 
 
 
 
 
นำมาสลับ ขยับ และรวมกัน 

Codebook Cipher

posted on 25 Nov 2009 10:29 by techinnoreview  in MITT
Codebook Cipher
  • A codebook is a substitution cipher,
  • but substitutions are for entire words—or even phrases
 
 
 
 
Confusion and Diffusion
  • Confusionis designed to obscure the relationship between the plaintext and ciphertext
  • E.g. A simple substitution cipher and a one-time pad
  • Diffusionis supposed to spread the plaintext statistics through the ciphertext
  • E.g. Double transposition 

One-Time Pad

posted on 25 Nov 2009 10:06 by techinnoreview  in MITT

The Vernam cipher

For simplicity, let’s consider an alphabet of only eight letters

Suppose a spy named Alice wants to encrypt as 001 = s, 011 = a

She converts it to 001011 = sa

 

 

  • A key is a randomly selected string of the same length as the message
  • The key is then XORedwith the plaintext to yield the ciphertext
  • Decryption is accomplished by XORingthe same key with the ciphertext 
ทั้งเข้ารหัสและถอดเป็น XOR ขนาดเท่า key text ของข้อความทั้งหมด
 
ยิ่งใช้ตัวอักษรหลากหลาย code ยิ่งยาว
 
เอาตาราง code แต่ละคีย์ มาจากตารางคำ
แล้วนำมา  XOR กับ random key  ก็จะได้ code ใหม่
 
แล้วจะจำ random key นี้ไว้เพื่อ ถอดรหัส
 
เช่น
 
001 จากตาราง = s
101 เป็นแรนดอมคีย์
100 จะเป็นตัวที่ถูกแปลงแล้ว
 
ถอดกลับก็นำมาทำย้อนครับ
 
  • The ciphertextprovides no information at all about the plaintext
  • The key must be chosen at random and used only once
  • The key must be known only by the sender and receiver 
*padding ก็คือการใส่รหัส 0 ต่อท้ายเพื่อเพิ่มความยาวนั่นเอง คือ code เปล่า ที่เข้ารหัสหลอก

 

edit @ 25 Nov 2009 10:49:08 by Auttapong Maesincee

Double Transposition Cipher

posted on 25 Nov 2009 10:00 by techinnoreview  in MITT
Definition of Secure
  • Ideally, mathematical proof
  • Lack of proofs
  • A crypto system is secure if the best-known attack requires as much work as an exhaustive key search
  • No short-cut attack
  • Must select a cipher that has a large enough key spaceso that an exhaustive key search is impractical
Double Transposition Cipher
 
  • Write the plaintext into an array of a given size
  • Permute the rows and columns according tospecified permutations
  • For example, write metric into a 3x4 array
  • If we transpose the rows according to 1,2,3 -> 3,2,1
  • And then transpose the columns according to 4,3,2,1 -> 4,2,1,3
แนวคิดคือข้อมูลเป็น metric เข้ารหัสเป็นก้อน โดนการสลับแถวและแนว (row, column) 
โดยไม่ได้ซ่อนตัวอักษรที่แท้จริงไว้เลย แต่เอามาสลับที่
 
The key consists of
  • The size of the matrix
  • The row and column permutations 
  • Does nothing to disguise letters
  • It thwarts an attack that relies on the statistical information
  • The idea of “smearing”plaintext information through the ciphertextis useful that it is employed in modern block ciphers 

Simple Subtitution Cipher

posted on 25 Nov 2009 09:48 by techinnoreview  in MITT
imple Substitution Cipher
 
  • Need to be limited to shifting by n
  • Any permutation of the 26 letters will suffice as a key
  • possible keys
  • Big enough to make exhaustive search infeasible
  • Does this mean that a simple substitution cipher secure?
  • Suppose Trudy intercepts the following ciphertext, which she suspects was produced by a simple substitution cipher –though not necessarily a shift by n
  • Trying keys is too much work.
  • Make use of English letter frequency count882882
  • With the frequency count of the ciphertext
เมื่อทำ exhaustive key search ไม่ได้เนื่องจากข้อมูลใหญ่มาก จึงต้องทำ simple
 
เช่น code ตัวหนังสือที่เข้ารหัสมากๆ จึงจำเป็นต้องใช้ shot cut ในการถอดรหัส
โดยจับ frequency ของ code ต่างๆ เพื่อแทนค่าด้วยตัวแปลแทน
 
 
  • The attack on the simple substitution cipher shows that a large key space is not enough
  • Cipher designers must guard against clever attacks
  • A cipher is considered secure as long as no attack against it has been found 

 
 

ASP.net code C# การทำระบบ register และ login

posted on 24 Nov 2009 15:24 by techinnoreview  in MITT
// ใน web.config ให้ใส่ตามนี้ 
 
    <connectionStrings>
        <add name="ProjectDBSPConnectionString" connectionString="Data Source=2009AUG10\sqlexpress;Initial Catalog=ProjectDBSP;User ID=sa; Password=1234"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
// อันนี้จะเพิ่มเข้ามาเองหลังจากสร้าง sqldatasource ไว้1 อันบนเว็บ
// ด้านล่างต้องพิมพ์เพิ่มเองโดยของเดิมจะเป็น <authentication mode="Windows"> 
 
 
 
-->
    <authentication mode="Forms">
    <forms loginUrl="~/login.aspx"/>

    </authentication>
    <membership defaultProvider="MembershipProvider">

      <providers>
        <add name="MembershipProvider" connectionStringName="ProjectDBSPConnectionString"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             requiresUniqueEmail="true"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="5"
             minRequiredNonalphanumericCharacters="0"
             type="System.Web.Security.SqlMembershipProvider" />
      </providers>
    </membership>
    <!--

นายอรรถพงศ์ เมษินทรีย์ 5270280026

Information Security Assignment #2 

การเจาะระบบ Biometric
 ว่าด้วยการทำ Reverse engineering บน ระบบป้องกันแบบ Biometric เอง โดยจะพบว่า
การจะเจาะเข้าสู่ระบบป้องกันแบบนี้นั้น สามารถทำได้โดยการใช้วิธีการไม่ต่างไปจากเดิมซักเท่า
ใหร่เลย

 โดยระบบป้องกันภัย เช่นระบบป้อนรหัสด้วยลายนิ้วมือ หรือ Finger Print Scan นั้นยังต้อง
อาศัยส่วนหลักในการเก็บข้อมูลที่เป็นชุดข้อมูลตัวเลขที่เครื่องคอมพิวเตอร์จะสามารถเข้าใจได้ ซึ่ง
แปลงมาจากการรับข้อมูลมาจากเครื่องแสกน และระหว่างทางจะถูกส่งผ่านเครื่องข่ายไม่ว่าจะสั้น
หรือจะยาว การส่งข้อมูลนี้มีจุดอ่อนที่จะสามารถถูกโจรกรรมได้ตลอดเวลา

 การทำงานของเครื่องนั้นคือเมื่อเราทาบนิ้วมือลงไป เครื่องจะทำการอ่านค่าลายนิ้วมือเป็น
รูปภาพ และส่งผ่านไปยัง Extractor Unit ซึ่งเป็นตัวแปลงรูปลายนิ้วมือให้เป็นข้อมูลตัวเลขจึงจะถูก
ส่งต่อไปยังหน่วยเปรียบเทียบ (Comparison Unit) ที่จะเป็นตัวระบุความถูกต้องของลายนิ้วมือ ซึ่ง
ข้อมูลเหล่านี้จะถูกเก็บไว้บนฐานข้อมูล

 การเจาะระบบวิธีแรก คือ การดักค่าการส่งรหัสจาก ฐานข้อมูลไปยัง Comparison Unit ซึ่ง
หลังจากที่แสร้งทำกดรหัสผ่านพลาดหนึ่งทีก็จะสามารถดัก Packet ที่ถูกส่งมาได้ แล้วนำ packet นี้
มาแปลงและส่งกลับแทนค่าลายนิ้วมือจริงจริงไปยัง Comparison Unit

 การเจาะระบบวิธีที่สอง คือ การเจาะเข้าฐานข้อมูลโดยตรงเพื่อสับเปลี่ยนค่าลายนิ้วมือกับ
ผู้ใช้คนใดคนนึงที่มีอยู่แล้ว โดยจะแทนที่ด้วยชุดข้อมูลตัวเลขที่แปลงมาจากลายนิ้วมือของเราเอง ซึ่ง
ในกรณีที่มีการเข้ารหัสชุดข้อมูลตัวเลขนั้นจำเป็นต้องถอดรหัสข้อมูลก่อนว่าเป้นการเข้ารหัสชนิดใด
และทำการเข้ารหัสแบบเดียวกันเพื่อให้ข้อมูลใช้งานได้

การเจาะระบบวิธีที่สาม คือ การเจาะเข้าฐานข้อมูลโดยตรงเช่นกันเพื่อสับเปลี่ยนค่าความ
น่าเชื่อถือของลายนิ้วมือที่รับซึ่งปรกติแล้ว Confidence level นี้จะถูกตั้งไว้ที่ประมาณ 95%
 เมื่อถูกปรับเป็น 1 % นั้น ลายนิ้วมือใครก็ตามก็สามารถเข้าออกผ่านระบบป้องกันได้ทันที


โดยทั้ง 3 วิธีเน้นไปที่การใช้เทคนิคการเจาะระบบข้อมูลตัวเลขซึ่งเป็นพื้นฐานมาจากการ
เจาะเข้าสู่เครื่องคอมพิวเตอร์โดยตรง ซึ่งเมื่อเจาะเข้าสู่ระบบป้องกันผ่านทางเครือข่ายได้
แล้ว การรับผลจากระบบป้องกัน Biometric นั้นแทบไม่ได้ช่วยป้องกันอะไรได้เลย เทคนิค
การเจาะระบบชนิดนี้ต้องอาศัยการเตรียมการเชิงข้อมูลอย่างดี และความสามารถในการ
เจาะผ่านเครือข่ายที่มีการป้องกันสูง อีกทั้งวิธีนี้ไม่สามารถใช้กันระบบป้องกันแบบปิดที่เก็บ
ข้อมูลไว้ใน ROM ไม่สามารถเปลี่ยนแปลงได้
 
*ปัจจุบันมี Tools สำหรับให้ hack ในระบบที่ไม่มีการเข้ารหัสแล้ว

Reference:

http://www.theinquirer.net/inquirer/news/1029539/how-hack-biometrics

http://news.techworld.com/security/11863/biometric-hack-tool-released/

edit @ 18 Nov 2009 18:19:31 by Auttapong Maesincee

edit @ 18 Nov 2009 18:20:14 by Auttapong Maesincee