![S-des Key Generation Method S-des Key Generation Method](/uploads/1/2/6/0/126084885/864358594.jpg)
The 186-4 RSA Validation System (RSA2VS) specifies the procedures involved in validating implementations of public key cryptography based on the RSA algorithm. This document deals with. To test the key generation method specified in Appendices B.3.2, B.3.4, B.3.5, and B.3.6, the 186-4. In 2 authors give a new method of key generation in DES. They used odd even substitution method for key generation. Odd even substitution is applied on 56 bits key at every step. In 9 authors give a change to existing DES by using two keys, left key and right key. They used method of Blowfish algorithm to generate the keys.
This class provides the functionality of a secret (symmetric) key generator. Key generators are constructed using one of the
getInstance
class methods of this class. KeyGenerator objects are reusable, i.e., after a key has been generated, the same KeyGenerator object can be re-used to generate further keys.
There are two ways to generate a key: in an algorithm-independent manner, and in an algorithm-specific manner. The only difference between the two is the initialization of the object:
- Algorithm-Independent InitializationAll key generators share the concepts of a keysize and a source of randomness. There is an
init
method in this KeyGenerator class that takes these two universally shared types of arguments. There is also one that takes just akeysize
argument, and uses the SecureRandom implementation of the highest-priority installed provider as the source of randomness (or a system-provided source of randomness if none of the installed providers supply a SecureRandom implementation), and one that takes just a source of randomness.Since no other parameters are specified when you call the above algorithm-independentinit
methods, it is up to the provider what to do about the algorithm-specific parameters (if any) to be associated with each of the keys. - Algorithm-Specific InitializationFor situations where a set of algorithm-specific parameters already exists, there are two
init
methods that have anAlgorithmParameterSpec
argument. One also has aSecureRandom
argument, while the other uses the SecureRandom implementation of the highest-priority installed provider as the source of randomness (or a system-provided source of randomness if none of the installed providers supply a SecureRandom implementation).
In case the client does not explicitly initialize the KeyGenerator (via a call to an
init
method), each provider must supply (and document) a default initialization. Every implementation of the Java platform is required to support the following standard
KeyGenerator
algorithms with the keysizes in parentheses: - AES (128)
- DES (56)
- DESede (168)
- HmacSHA1
- HmacSHA256
S-DES ENCRYPTION SAMPLE
To the input (plaintext), apply initial permutation IP:
In the next steps, we will develop 4 bits with which to replace the left half of this 'blue' result. | Input:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To right 4 bits of above result, apply expansion/permutation E/P (generating 8 bits from 4). The bit numbering is that of the 4-bit right-nibble, not of the 8-bit byte (e.g., indicated bit 2 refers to byte's bit 6).
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Upon above result, perform binary XOR operation with subkey K1:
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Determine a row and a column from above XOR result. For the row, combine bits 1 and 4 and convert to decimal. For the column, combine bits 2 and 3 and convert to decimal. Determine another row and column. For this second row, combine bits 5 and 8; for this second column, bits 6 and 7. Identify the entry in s-box S0 at the first row/first column you determined. S0 shows it in decimal; convert it to binary (two bits). Enter those bits as the first half of the 4-bit number at right. Identify the entry in s-box S1 at the second row/second column you determined. Convert it to binary; enter those two bits as the second half of the number at right.
| left nibble: bits 1 & 4 -> 11 -> 3 bits 2 & 3 -> 00 -> 0 therefore, get from S0 row 3 col 0 result is 3 -> 11 right nibble: bits 1 & 4 -> 10 -> 2 bits 2 & 3 -> 00 -> 0 therefore, get from S1 row 2 col 0 result is 3 -> 11
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To above result, apply permutation P4:
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Upon the above P4 result, perform binary XOR operation, combining it with the left 4-bits of our first result (application of IP to original plaintext input, blue cell above). We are trying to replace the left half of that first result. These XOR result bits are the replacement bits for it. | XOR with 1110
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Rewrite that 'blue' first result with its left half replaced. (Look it up, keep/copy its right half, use the preceding result as the new left half.) |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Swap the two 4-bit halves of the above (previous) result. In the next steps, we will again develop 4 replacement bits, and with them replace the left half of this 'green' swap result. The steps will be the same ones used for that purpose already. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To right 4 bits of above swap result, apply expansion/permutation E/P (generating 8 bits from 4):
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Upon above result, perform binary XOR operation with subkey K2:
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Determine a row and a column from above result. For the row, combine bits 1 and 4 and convert to decimal. For the column, combine bits 2 and 3 and convert to decimal. Determine another row and column. For this second row, combine bits 5 and 8; for this second column, bits 6 and 7. Identify the entry in s-box S0 at the first row/first column you determined. It's given in decimal; convert it to binary (two bits). Enter those bits as the first half of the 4-bit number at right. Identify the entry in s-box S1 at the second row/second column you determined. Convert it to binary; enter those two bits as the second half of the number at right.
| left nibble: bits 1 & 4 -> 10 -> 2 bits 2 & 3 -> 10 -> 2 therefore, get from S0 row 2 col 2 result is 1 -> 01 right nibble: bits 1 & 4 -> 01 -> 1 bits 2 & 3 -> 00 -> 0 therefore, get from S1 row 1 col 0 result is 2 -> 10
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To above result, apply permutation P4:
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Upon the above P4 result, perform binary XOR operation, combining it with the left 4-bits of the earlier swap result (green cell above). We are trying to replace the left half of that swap result. These XOR result bits are the replacement bits for it. | XOR with 0110
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Rewrite that 'green' swap result with its left half replaced. (Look it up, keep/copy its right half, use the preceding result as the new left half.) |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To above result, apply reverse of initial permutation IP, which is IP-1:
This result is ciphertext. It is the S-DES encryption of the plaintext input. |
|