![](bg2.png)
tampered with while data is encrypted, when this
occurs the integrity of the data is lost.
Typically encryption algorithms such as the
Advanced Encryption Standard (AES) provide
confidentiality but don’t provide integrity and hash
digest algorithms such as Secure Hash Algorithm
(SHA) provide integrity without confidentiality
(Forouzan, 2008). Traditional methods to obtain
both confidentiality and integrity involve combining
encryption and digest algorithms. Message
authentication codes such as HMAC provide an
alternative to traditional hash digests where the
digest is protected from unauthorized update with a
secret key.
This paper presents a HMAC based encryption
scheme that provides confidentiality and tamper
detection for positive integer data. This scheme is an
improvement in efficiency and tamper detection to
the HMAC integer encryption concept presented in
(Lee et al. 2007). The scheme is implemented in the
PostgreSQL database environment (PostgreSQL,
2009), and the developed process is named “HMAC
based Tamper Evident Encryption”, referred to as
HTEE in this paper. This process is simpler to use
than the standard AES with SHA solution, and more
efficient for encryption. However this process is
slower on decryption than AES with SHA, and the
security of this scheme is dependent on the security
of the underlying hash function.
The HTEE scheme is a symmetric encryption
process that relies on a secret key and processes
positive integer values. The integer plaintext values
are decomposed into components, or buckets, using
modulus arithmetic. The buckets have a fixed size of
1,000, so integer values are decomposed into the
value of the ones, thousands, millions, etc. places.
The plaintext buckets are encrypted using the
HMAC function, where the hash digest represents
the ciphertext. The secret key is modified for each
plaintext value and each bucket value using a
specific transformation process resulting in a
different key for every HMAC operation. The key
transformation process is based on a unique value
related to the sensitive data, such as a database
primary key. A primary goal of the HTEE process is
the detection of unauthorized updates or tampering
with ciphertext data, particularly when ciphertext
values are interchanged. The key transformation
process ensures ciphertext values can’t be changed
without detection.
The decryption process is similar to the
encryption process and uses the same key
transformation sequence. Because the HMAC
function produces a one-way hash digest, it is not
trivial to reverse the operation. In order to find the
correct plaintext for each bucket’s digest value a
search is performed across all 1,000 possible bucket
values, calculating the HMAC digest of each until a
match is found. The search is repeated for all
buckets and the modulus decomposition is reversed
to obtain the plaintext value. Any unauthorized
updates to ciphertext data are detected in the
decryption step by a failure to find a matching
HMAC digest.
2 BACKGROUND
2.1 Hash Message Authentication Code
HMAC is a symmetric process that uses a secret key
and a hash algorithm such as SHA to generate a
message authentication code, or digest. This
authentication code securely provides data integrity
and authenticity because the secret key is required to
reproduce the code. Digests for normal hash
functions can be reproduced with no such constraint.
HMAC can protect against man-in-the-middle
attacks on the message, but it is not designed to
encrypt the message itself. The HMAC function was
published by Bellare et al. (1996), which includes
analysis and a proof of the function’s security, and it
is standardized in FIPS PUB 198 (NIST, 2002). Any
hash algorithm can be used with HMAC including
MD5, SHA-1, SHA-256, etc.
The output of HMAC is a binary authentication
code equal in length to the hash function digest. The
security of HMAC is directly related to the
underlying hash function used, so it is weaker with
MD5 and stronger with SHA-512. Forgery and key
recovery attacks threaten HMAC, but typically
require a large number of message/digest pairs for
analysis. The HMAC functions used in the
implementation of the HTEE scheme are based on
the SHA-1 hash algorithm. The use of HMAC-
SHA1 specifies some data sizes that are important in
the HTEE implementation such as a 64 byte key size
20 byte digest output size.
2.2 HMAC Integer Encryption
The HTEE algorithm is based on an original HMAC
encryption scheme presented by Lee et al. (2007),
and provides several improvements. A detailed
analysis and discussion of this original scheme is
available in (Baker, 2009a). The original scheme
uses integer decomposition, HMAC for encryption,
and decryption with exhaustive search. Because the
HTEE: AN HMAC BASED TAMPER EVIDENT ENCRYPTION
197