Clean up ugliness in key_parse

Signed-off-by: Casey Dahlin <casey.dahlin@gmail.com>