# Altova Technology Primer: Digital Signatures Technology Overview

Digital Signatures

Digital signatures facilitate the safe exchange of electronic documents by providing a way to test both the authenticity and the integrity of information exchanged digitally. With the explosion in the number of organizations engaged in electronic data exchange as well as the amount of data changing hands (or computers), the secure transmission of information has become a focus for business users across virtually all industries.

A digital signature is created by a series of mathematical processes that transform data (e.g., a Word document, PDF, or XML file) into a uniquely coded “message digest.” The sender encrypts the message digest (commonly referred to as the digital signature – the terms will be used interchangeably throughout this article), attaches it to or embeds it in a file, and sends the package to the intended recipient. Once the package is received and the message digest is decrypted, a determination of authenticity and integrity can be made.

If the digital signature matches the identity of the sender one can be reasonably assured that it was sent by the individual associated with the digital signature (at worst the actual sender had access to the digital identity of the supposed sender). If the message digest received matches the message digest as calculated by the recipient the document has not been altered after it was digitally signed.

The Hash Function

A file (or other collection of data) is transformed into a message digest via a mathematical function referred to as a “hash.” The hash function reduces the file to a smaller one with a fixed number of bits. The smaller file contains some representation of the contents of the actual document – Morse Code offers a relevant analogy.

The hash function acts as any other mathematical formula – the result (message digest/digital signature) will depend on the operand (file) to which the function is applied. Just as the mathematical function “multiply by seven” will produce 49 when the operand is seven and 35 when the operand is five, the hash function will create a unique message digest based on the contents of the file.

Often referred to as a “digital fingerprint,” the digital signature created by the hash function is wholly unique because individual files have unique contents and characteristics.

There are a number of different hash functions in use including Rivest’s MD5, which reduces a file to a 128-bit message digest, and NIST’s Secure Hash Algorithm (SHA), which creates a 160-bit message digest.

In addition to being a “collision free” algorithm, or one that creates a wholly unique message digest, the digital signature created by the hash function should not be able to be reverse engineered. In other words, given the result of the hash function (i.e., the message digest/digital signature) it is virtually impossible to reconstruct the document or other collection of data from that information.

Encryption

Once the message digest is created by the hash function, it is encrypted.

In order to encrypt any message, an individual requires a unique digital identity to which he is bound (almost like a social security number). That unique identifier is issued a pair of “keys,” one private (known only to the individual) and one public (used by individuals exchanging encrypted messages with the owner of the private key).

The keys are actually associated algorithms used to transform data (e.g., message contents) into a format unintelligible to the human eye and then transform it back again. Only the associated key can unlock content encrypted by the other.

The process of generating, assigning, and managing unique digital identifiers and issuing keys is carried out by nationally-accredited third parties called Certificate Authorities (e.g., Thawte, Symantec, or Microsoft Certificate Services, which run on Windows server operating systems). These third parties and the policies that dictate the issuing of digital identifiers are a large part of the Public Key Infrastructure (PKI) that makes the use of digital signatures and other security measures feasible.

Once the hash function has been applied to the file and the message digest created, the sender uses his unique private key to encrypt it. Once encrypted, the digital signature can be embedded in the file (enveloped) or attached to it as a separate file (detached). The package is then dispatched to the intended recipient.

Upon receipt, the recipient “unlocks” the message digest via a public key associated with the sender’s private key (asymmetric cryptography). If the public key successfully decrypts the digital signature, the file has in fact been sent by the individual associated with the digital identifier (or, worst case scenario, someone with access to that identifier).

Please note that there is an alternative encryption process in which a sender and recipient use the same key to encrypt and decrypt a file (symmetric encryption). However this is not supported by digital signatures, which rely on the association between a digital identifier and an individual to enforce the principle of non-repudiation. In other words, a sender whose digital signature is attached to a file cannot deny having sent it because his “digital DNA” is associated with it.

Once the message digest has been decrypted the authenticity of the digital signature has been established, the integrity of the file can be determined.

Recreating the Message Digest

As noted earlier the message digest/digital signature is created by applying a hash function to the file.

Once the recipient gets the file and decrypts the digital signature, the same hash function is applied. If the message digest created on the recipient’s end is identical to the file’s message digest, it has not been altered since the digital signature was attached or embedded. If there is a discrepancy between the original and re-created digital signatures, the file has been altered in some way.

For more information about XML digital signatures click to view the XML Digital Signature Technology Overview from our collection of Technology Primers.

Altova XMLSpy, Altova MapForce, Altova StyleVision, and Altova Authentic support XML digital signatures. Please click for more information about XML digital signatures in XMLSpy, MapForce, StyleVision, and Authentic.