Secure Email Specification (version 2) Discussion

This message document a discription of what I have so far as a specification for secure business document transmission. There is also a discussion about the proposed specification. Please feel free to email peterha@nothingbutnet if you have any comments to add.

Notes regarding PGP and S/MIME:
Some people have been wondering why I am implementing my own file format rather than using PGP or S/MIME. While PGP is popular it requires many algorithms and formats for reason of backwards compatibility. I am trying to develop something which is minimalist - with as few options as possible, while PGP is more of a 'hackers' system - in that it allows control over a number of variables. S/MIME makes use of certificates. I am currently developing an alternative to certificates which don't require purchase of certificates. Then again, there is a possibility of co-existance between the Trust Network and Certificate Authority systems.

I am looking at how I can be compatible with either PGP or S/MIME, while still being able to achieve the project objectives.

SMTP / POP3
Messages are transmitted via attachments within standard SMTP messages. The Message Bodies themselves are not encrypted, only the attachments. Each Attachment is a Encrypted File. Each attachment potentially can be separatly opened or saved to disk for later decryption. Attachments are via standard MIME. Text Messages can still be sent however, by including a text file inside the attachment.
Encrypted Attachments
Each Encrypted Attachment has a five types of data 'block':

Version Block

Session Key Block

Directory Block

Signature Block

Data Block

Version Block
The Version Block provides information about which version of the software was used to create the encrypted file.

1 byte - Literally 'V' to signify start of a Version Block.
4 bytes - Size of Version.
n bytes - Description of Version.

Session Key Block
The Encrypted Session Key is a random session key used by the symetric AES algorithm to encrypt and decrypt the main file data. By using RSA to encrypt the session key only the recipient can decrypt the session, and therefore decrypt the main file. The encrypted session key is stored in the following format :

1 byte - Literally 'K' to signify start of a Session Key Block.
4 bytes - Integer representing length of the Recipients Email Address.
n bytes - Wide String representation of Email Address of Recipient.
4 bytes - Integer representing Encrypted Session Key Length (n).
n bytes - Binary representation of the Session Key encrypted to the Recipients Public Key.

When encrypting a random session key is generated and encrypted with RSA using the public key of the recipient. The receiver uses his private key to decrypt the session key, which is then used for the main data. There can be multiple Session Key Blocks, one for each recipient.

Directory Block
The Directory Block consists of the filenames and sizes of the data being sent..

1 byte - Literally 'D' to signify start of a Directory Block.
4 bytes - Integer representing size of Directory.

(All data from this point is encrypted with the session key)
4 bytes - Integer representing Number of files included in Directory.

(below three points recurse through all files in the directory)
4 bytes - Integer representing FileName Length.
n bytes - Wide String representation of the FileName.
4 bytes - Integer representing Length of file in bytes.

Signature Block
The Signature Block is a MD5 hash of the original data in the files, encrypted with RSA using the private key of the sender. On decrypting the main data the recipient can check the hash provided with one calculated from the decrypted main data. If the hashes match the recipient can be sure that the file was encrypted by someone with access to the private key that corresponds with the public key on file for the sender. In other words, it ensures the apparent sender of the file is the actual sender of the file. The format of the signature block is in the following format :

1 byte - Literally 'S' to signify start of a Signature Block.
4 bytes - Integer representing length of Senders Email Address.
n bytes - Wide String representing Senders Email Address.
4 bytes - Integer representing length of Signature.
n bytes - Binary representation of the Signature.

Data Block
The Data Block is simply the data of the original files appended sequencially according to the Directory Block compressed with the Zip algorithm, and encrypted with the Session Key using the Rijndael algorithm. Its format is simple :

1 byte - Literally 'M' to signify start of a Main Data Block
4 bytes - Size of Data Block.
x bytes - All remaining bytes to the end of the file are compressed and encrypted data.

Home