Format preserving encryption

Format preserving encryption (FPE) is a method of encryption where the resulting cipher text has the same form as the input clear text. The form of the text can vary according to use and the application. One example is a 16 digit credit card number. After using FPE to encrypt a credit card number, the resulting cipher text is another 16 digit number. In this example of the credit card number, the output cipher text is limited to numeric digits only.

The FPE services require some knowledge of the input clear text character set in order to create the appropriate output ciphertext. The CSNBFPEE, CSNBFPED, and CSNBFPET callable services use the following tables to determine valid character sets for the clear text input parameters:

Base-10 alphabet

This alphabet is used when the character set only consists of numbers 0 through 9. The original data type of the source field may be of any type. This alphabet requires the following values to be used in the VFPE algorithm:
Number of characters in alphabet('n'): 10
Table 1. Base-10 alphabet
VFPE alphabet number Character ISO 7811 modified 5-bit ASCII ISO 7811 modified 7-bit ASCII Normal data type encoding
4-bit binary coded decimal 7-bit ASCII 8-bit EBCDIC
0 0 10000 0010000 0000 0110000 11110000
1 1 00001 1010001 0001 0110001 11110001
2 2 00010 1010010 0010 0110010 11110010
3 3 10011 0010011 0011 0110011 11110011
4 4 00100 1010100 0100 0110100 11110100
5 5 10101 0010101 0101 0110101 11110101
6 6 10110 0010110 0110 0110110 11110110
7 7 00111 1010111 0111 0110111 11110111
8 8 01000 1011000 1000 0111000 11111000
9 9 11001 0011001 1001 0111001 11111001

Base-16 alphabet

Cards are encoded with the special ISO 7811 modified 5-bit ASCII encoding for track 2. This data type allows parity checking of the digits. Many systems require this encoding to be converted into standard data types for processing. Other data fields may use base-16 encoding and would use this same alphabet when performing VFPE. These data types support values of 0 through 9 and A through F.

VFPE requires translation of the characters of the VFPE alphabet number prior to encryption. Therefore, any of the data types shown in Table 2 are supported. Decryption may use the same or a different data type than the original encoding. This alphabet requires the following values to be used in the VFPE algorithm:
Number of characters in alphabet('n'): 16
Table 2. Base-16 alphabet
VFPE alphabet number ISO 7811 modified 5-bit ASCII encoding Normal data type encoding
Character Binary Character 4-bit binary coded decimal 7-bit ASCII 8-bit EBCDIC
0 0 10000 0 0000 0110000 11110000
1 1 00001 1 0001 0110001 11110001
2 2 00010 2 0010 0110010 11110010
3 3 10011 3 0011 0110011 11110011
4 4 00100 4 0100 0110100 11110100
5 5 10101 5 0101 0110101 11110101
6 6 10110 6 0110 0110110 11110110
7 7 00111 7 0111 0110111 11110111
8 8 01000 8 1000 0111000 11111000
9 9 11001 9 1001 0111001 11111001
10 : 11010 A 1010 1000001 11000001
11 ; 01011 B 1011 1000010 11000010
12 < 11100 C 1100 1000011 11000011
13 = 01101 D 1101 1000100 11000100
14 > 01110 E 1110 1000101 11000101
15 ? 11111 F 1111 1000110 11000110

Track 1 alphabet

This alphabet requires the following values to be used in the VFPE algorithm:
Number of characters in alphabet('n'): 41
Table 3. Track 1 alphabet
FPE alphabet number Character ISO 7811 modified 7-bit ASCII Standard data types 7-bit ASCII Standard data types 8-bit ASCII
0 space 1000000 0100000 01000000
1 $ 0000100 0100100 01011011
2 ( 0001000 0101000 01001101
3 ) 1001001 0101001 01011101
4 - 0001101 0101101 01100000
5 0 0010000 0110000 11110000
6 1 1010001 0110001 11110001
7 2 1010010 0110010 11110010
8 3 0010011 0110011 11110011
9 4 1010100 0110100 11110100
10 5 0010101 0110101 11110101
11 6 0010110 0110110 11110110
12 7 1010111 0110111 11110111
13 8 1011000 0111000 11111000
14 9 0011001 0111001 11111001
15 A 1100001 1000001 11000001
16 B 1100010 1000010 11000010
17 C 0100011 1000011 11000011
18 D 1100100 1000100 11000100
19 E 0100101 1000101 11000101
20 F 0100110 1000110 11000110
21 G 1100111 1000111 11000111
22 H 1101000 1001000 11001000
23 I 0101001 1001001 11001001
24 J 0101010 1001010 11010001
25 K 1101011 1001011 11010010
26 L 0101100 1001100 11010011
27 M 1101101 1001101 11010100
28 N 1101110 1001110 11010101
29 O 0101111 1001111 11010110
30 P 1110000 1010000 11010111
31 Q 0110001 1010001 11011000
32 R 0110010 1010010 11011001
33 S 1110011 1010011 11100010
34 T 0110100 1010100 11100011
35 U 1110101 1010101 11100100
36 V 1110110 1010110 11100101
37 W 0110111 1010111 11100110
38 X 0111000 1011000 11100111
39 Y 1111001 1011001 11101000
40 Z 1111010 1011010 11101001