Update test_keys.py

Strip PEM footer and reorder PEM header / footer test conditions.