Factorize pinned public key code into generic file handling and backend specific