You are here

function oauth2_server_get_keys in OAuth2 Server 7

Returns the pair of private and public keys used to sign tokens.

Return value

array An array with the following keys:

  • private_key: The private key.
  • public_key: The public key certificate (PEM encoded X.509).

See also

oauth2_server_generate_keys()

3 calls to oauth2_server_get_keys()
oauth2_server_certificates_page in ./oauth2_server.pages.inc
Page callback: Returns the server's certificates.
Storage::getPrivateKey in lib/Drupal/oauth2_server/Storage.php
Storage::getPublicKey in lib/Drupal/oauth2_server/Storage.php

File

./oauth2_server.module, line 858
Provides OAuth2 server functionality.

Code

function oauth2_server_get_keys() {
  $keys = variable_get('oauth2_server_keys', FALSE);
  if (!$keys) {
    $keys = oauth2_server_generate_keys();
    variable_set('oauth2_server_keys', $keys);
  }
  return $keys;
}