Skip to content

Instantly share code, notes, and snippets.

@Klowner
Last active August 29, 2015 14:07
Show Gist options
  • Save Klowner/94513a3c931741fca938 to your computer and use it in GitHub Desktop.
Save Klowner/94513a3c931741fca938 to your computer and use it in GitHub Desktop.
// Read the Google Services Account pkcs12 key and return the fingerprint.
// This is not important for functionality, but will allow the user to
// cross-reference their uploaded fingerprint with the one displayed in the
// Google credentials management page.
function get_google_services_key_fingerprint () {
global $google_services_key_path;
$certs = array();
openssl_pkcs12_read(file_get_contents($google_services_key_path), $certs, "notasecret");
if (sizeof($certs) > 0) {
$output = $certs['cert'];
$output = preg_replace('/\-{5}[A-Z\ ]*\-{5}/', '', $output);
return sha1(base64_decode($output));
}
return '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment