Added check for length of keys and file sizes

Signed-off-by: Richard Hancock <rjhancock@me.com>