security check for encryption key length to avoid crashing when deserialisation gives wrong numbers