googleauth - Class Google::Auth::IDTokens::KeyInfo (v1.12.1)

Reference documentation and code samples for the googleauth class Google::Auth::IDTokens::KeyInfo.

A public key used for verifying ID tokens.

This includes the public key data, ID, and the algorithm used for signature verification. RSA and Elliptical Curve (EC) keys are supported.

Inherits

  • Object

Methods

.from_jwk

def self.from_jwk(jwk) -> KeyInfo

Create a KeyInfo from a single JWK, which may be given as either a hash or an unparsed JSON string.

Parameter
  • jwk (Hash, String) — The JWK specification.
Returns
Raises
  • (KeySourceError) — If the key could not be extracted from the JWK.

.from_jwk_set

def self.from_jwk_set(jwk_set) -> Array<KeyInfo>

Create an array of KeyInfo from a JWK Set, which may be given as either a hash or an unparsed JSON string.

Parameter
  • jwk (Hash, String) — The JWK Set specification.
Returns
Raises
  • (KeySourceError) — If a key could not be extracted from the JWK Set.

#algorithm

def algorithm() -> String

The signature algorithm. (normally RS256 or ES256)

Returns
  • (String)

#id

def id() -> String

The key ID.

Returns
  • (String)

#initialize

def initialize(id: nil, key: nil, algorithm: nil) -> KeyInfo

Create a public key info structure.

Parameters
  • id (String) (defaults to: nil) — The key ID.
  • key (OpenSSL::PKey::RSA, OpenSSL::PKey::EC) (defaults to: nil) — The key itself.
  • algorithm (String) (defaults to: nil) — The algorithm (normally RS256 or ES256)
Returns
  • (KeyInfo) — a new instance of KeyInfo

#key

def key() -> OpenSSL::PKey::RSA, OpenSSL::PKey::EC

The key itself.

Returns
  • (OpenSSL::PKey::RSA, OpenSSL::PKey::EC)