Removed duplication in key -> NSData methods