Format Preserving Encryption For Small Domain
Format Preserving Encryption For Small Domain
Abstract-Cryptography is important in communicating secured column, which contains the credit Custid, Custname and Credit
information that is vulnerable to distortion. The main goal of this card number.
paper is encrypting the small arbitrary length data without any /* Create a table Customer_detail */
changes in the length and data type. We propose a flexible arbitrary Create table Customer_detail (Custidint,
length small domain block cipher (FPESD). FPESD is based on AES
Algorithm. The resulting cipher text is the same as input plaintext.
Custtnamevarchar(25), Credicardnuminteger(16);
Here, we use Galois finite field GF (28) and format preserving key to /* Display the content of Customer_detail */
implement FPE. For decryption format preserving key is used along Select * from Customer_detail;
with cipher text and secret key. /* Create index to locate and retrieve data faster and more
efficient */
Keywords -Format Preserving Encryption, Small domain, AES CTR, Create index idindex on Customer_detail(Credicardnum);
Credit Card Number Encryption
Table1. Database Before Encryption
I. INTRODUCTION
Custid Custname Creditcardnum
There is a need for privacy of sensitive data before data are 1 N.S.Velu 1234567878901245
shared with any cloud provider, client server etc. Sensitive data 2 S.Ushadevi 7661234567199887
fields having well defined data formats[1]. While designing
3 S.Dhivya 3456789897890124
privacy for sensitive fields, it may be desirable to maintain the
length and format of the inputs, in order to avoid any re-
Electronic Code Book (ECB) mode is used to encrypt our
constructions of packet formats or database columns of
database column. This mode does not require any initialization
existing system. We propose a traditional AES cipher with
vector. This mode requires our input should be multiple of 8
CTR mode along with format preserving key[2].
bytes [5].The following queries are required to update
Customer_detail table after encryption.
II. NEED FOR FPE
/* Add columns which will hold the encrypted data in binary */
In normal encryption, the length and format of thePlaintext
AltertableCustomer_detail add
was entirely changed.
EncryptedCreditCardNumvarbinary(128);
The database structure was also changed by the encrypted /* Update new column with encrypted data */
column. Update Customer_detail set EncryptedCreditCardNum =
The reconstruction of database is a very difficult process. encryptbykey(‘Symmetrickey’, Creditcardnum);
If randomization was used in the encryption algorithm then /* Drop the original column */
referential integrity of the data base was also affected.
Special problems arise when encrypted data is indexed. The Alter table Customer_detail drop column Creditcardnum;
index of the column contains encrypted values and then the The original column and decrypted column have different type.
index is unusable for encrypted data. The conversion function is required to get the original data
An encryption algorithm not only alters the structure of the type.
table it also alters the queries passed to the database.
Changing of database and queries are complex tasks and /* Drop the index */
also cost prohibitive. Drop index idindex;
III. IMPACT OF NORMAL ENCRYPTION An index is useless for encrypted column, so it is removed.
ON DATABSES AND QUERIES Select Custid, Custname, convert (varchar(20), decryptbykey
(Encrypted CreditCardNum ) ) fromCustomer_detail;
Most of the block ciphers support length preserving
encryption. N bit block is mapped into another N bit block. But After completing all the encryptions, our database schema will
the data type of cipher text is not same as plain text. Format be changed to store the encrypted value. The corresponding
preserving encryption is a combination of length and data type queries that handle the credit card number will also be
preserving encryption.We give an example to encrypt credit changed[11]. Cryptographic operations, required to store
card number in stored in the data base. Create a sensitive data securely, need more amount of arithmetic
Customer_detail a table which contains credit card details of calculations. Coupled with bad block cipher choice, expensive
the customers. Our task is to protect this data by encrypting the cryptographic operations needed for querying and processing
1
Integrated Intelligent Research (IIR) International Journal of Computing Algorithm
Volume: 04 Issue: 01 June 2015 Pages:49-53
ISSN: 2278-2397
00 04 08 0c
01 05 09 0d
02 06 0a 0e
03 07 0b 0f
3E E5 D3 EE
0F A6 BF A6
57 63 F1 3E
EE F1 D3 0F
C. Plaintext
The input for encryption algorithm is a single 128 bit block.
The input is represented as a square matrix of bytes. The block
is copied to state array. The ordering of bytes in a matrix is by
column. The first four bytes occupied the first column; the
second four bytes occupied the second column and so on. The
same procedure is followed for key also. The state array is
represented as follows.
Table 6 :Aes Plaintext
S0 S1 S2 S3
S4 S5 S6 S7
S8 S9 S10 S11
S12 S13 S14 S15
For example using any padding technique with 16 digit credit
card number to represent 32 digit hex is
3EE5D3EE0FA6BFA65763F13EEEF1D30F. Each hex is
converted to 4 bit binary number. Totally we have 128 bit.
D. AES Encryption
The IV/nonce and the counter can be combined by XOR to
produce the actual unique counter block for encryption.
3E E5 D3 EE
0F A6 BF A6
57 63 F1 3E
EE F1 D3 0F
Table:8
A. Substitute bytes
AES defines a 16 x 16 matrix called S-Box. Each element in a
matrix represents byte values. Each individual byte of State is
converted into a new byte in the following way: The leftmost 4
bits of the byte indicate row index and the rightmost 4 bits
indicate column index. These row and column values provide
indexes into the S-box to select a byte as output value. S-box
is constructed using multiplicative inverse of Galois finite field
GF(28).SubByte transformation for the given example is as
follows
B. ShiftRows
The first row of State is not shifted. From the second row to
fourth row circular left shift is performed. For the second row 1
byte, third row 2 bytes, fourth row 3 bytes are shifted. The
following is an example of ShiftRows:
Input :
C. MixColumns
MixColumns, operates on each column separately. Each byte
128 bit cipher text S & 128 bit key K
of a column is converted into a new byte that is a function of
Output : 16 digits and Format preserving Key F.
all four bytes in that column. The result can be defined by the
following matrix multiplication in GF(28) on State.
1. Set i and sum value to 0.
2. Select i th byte from state array(si) and i th byte from
Table:10 mix columns
expanded key(ki).
3. Calculate ei = siki
4. The resultant ei is applied to s-box and we get the new
cipher text nci
5. Calculate the decimal equivalent of nci.
6. Di = decimal(nci)mod 10 and
F[i]=tochar(decimal(nci)/10)
7. Calculate sum = sumx10+di
D. AddRoundKey Transformation
8. Increment i value with 1 .
The 128 bits of State are XORed with the 128 bits of the key.
9. Repeat from step 2 to step 7 until I value becomes 16.
The operation is viewed as a column wise operation between
10. The sum variable contains format preserved cipher
the 32 bits of a State column and one word of the round
text.(16 decimal digits) and array F contains Format
key.The following is an example of Addroundkey
preserving key.
Transformation.
Table:11
4
Integrated Intelligent Research (IIR) International Journal of Computing Algorithm
Volume: 04 Issue: 01 June 2015 Pages:49-53
ISSN: 2278-2397