Refactor priv key decoding, add pub key reading.