Chapter 2. Algorithms, operations, and System i implementations
2.2 Cryptographic operations
The algorithms discussed in the previous section are used individually or in combination in different cryptographic operations. We can roughly categorize cryptographic operations into five groups: data confidentiality, authentication (including data integrity and non-repudiation), random number generation, financial PINs, and key management.
Note: Chapter 6, “Choosing a data encryption method” on page 71, provides more
information about choosing an appropriate cipher algorithm and mode of operation.
Cipher
Algorithms
DES
TDES
AES
RC2
RC4
RSA
Diffie-Hellman
MD5 RIPEMD-160
SHA-1 MDC
SHA-256
SHA-384
SHA-512
FIPS186-2
PKA (Asymmetric)
Algorithms
Secret key
(Symmetric)
Algorithms
One-way Hash
Algorithms
Random Number Generation Algorithm
Block
Ciphers
Stream Cipher
Key Exchange
Algorithms
2.2.1 Data confidentiality
Cryptographic operations for the purpose of data confidentiality prevent an unauthorized person from reading a message. The following operations are included in data confidentiality.
Encrypt and decrypt
The encrypt operation changes plaintext data into ciphertext through the use of a cipher algorithm and key. To restore the plaintext data, the decrypt operation must employ the same algorithm and key.
Encryption and decryption may be employed at any level of the operating system. Basically, there are three levels:
Link level encryption
Link level encryption is performed at the lowest level of the protocol stack, usually by specialized hardware.
Session level encryption
With encryption at the session layer, the system requests cryptographic services instead of an application. The application may or may not be aware that encryption is happening.
Field level encryption
With field level encryption, the user application explicitly requests cryptographic services. The user application completely controls key generation, selection, distribution, and what data to encrypt.
Translate
The translate operation decrypts data from encryption under one key and encrypts the data under another key. This is done in one step to avoid exposing the plaintext data within the application program.
2.2.2 Data authentication, integrity, and non-repudiation
Encrypted data does not mean that the data cannot be manipulated (for example, repeated, deleted, or even altered). To rely on data, you need to know that it comes from an authorized source and is unchanged. Additional cryptographic operations are required for these
purposes.
Hash (or message digest)
Hash operations are useful for authentication purposes. For example, you can keep a copy of a digest for the purpose of comparing it with a newly generated digest at a later date. If the digests are identical, the data has not been altered.
Message authentication code (MAC)
A MAC operation uses a secret key and symmetric cipher algorithm. The input data is encrypted using CBC mode. But instead of returning the entire ciphertext, it returns the last block of encrypted data. This value is called a MAC and is used to ensure that the data has
Chapter 2. Algorithms, operations, and System i implementations 21
The MAC operation helps authenticate messages, but does not prevent unauthorized reading because the data remains as plaintext. You must use the MAC operation and then encrypt the entire message to ensure both data privacy and integrity.
HMAC (hash MAC)
An HMAC, or keyed hash, operation uses a cryptographic hash function and a shared secret key to produce an authentication value. It is used in the same way in which a MAC is used. Because hash algorithms are faster than symmetric ciphers, producing a MAC via an HMAC operation will perform better than producing a MAC via a symmetric cipher.
Sign/verify
A sign operation produces an authentication value called a digital signature. A sign operation works as follows:
1. The data to be signed is hashed to produce a digest.
2. The digest is encrypted using a PKA algorithm such as RSA and a private key, to produce the signature.
The verify operation works as follows:
1. The signature is decrypted using the sender's PKA public key to produce digest 1. 2. The sender’s data is hashed to produce digest 2.
3. If the two digests are equal, the signature is valid.
Theoretically, this also verifies the sender because only the sender should posses the private key. However, how can the receiver verify that the public key actually belongs to the sender? Certificates are used to help solve this problem.
2.2.3 Key and random number generation
Many security-related functions rely on random number generation, for example, salting a password or generating an initialization vector. An important use of random numbers is in the generation of cryptographic key material. Key generation has been described as the most sensitive of all computer security functions. If the random numbers are not cryptographically strong, the function will be subject to attack.
2.2.4 Financial PINs
Although not covered in this book, personal identification number (PIN) generation and handling are also considered cryptographic operations.
A PIN is a unique number assigned to an individual by an organization. PINs are commonly assigned to customers by financial institutions. The PIN is typed in at a keypad and compared with other customer-associated data to provide proof of identity.
To generate a PIN, customer validation data is encrypted with a PIN key. Other processing is done on the PIN as well, such as putting it in a particular format.
The cryptographic coprocessors provide a complete set of financial PIN operations. Cryptographic Services does not support any type of PIN operation.
2.2.5 Key management
Key management is the secure generation, handling, and storage of cryptographic keys. This includes key storage and retrieval, key encryption and conversions, and key distribution. Key management is discussed in more detail in Chapter 3, “Key management concepts” on page 25.