Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

(no description)

File Size: 171 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JWK:: (4 methods):
  parseKeySet()
  parseKey()
  createPemFromModulusAndExponent()
  encodeLength()


Class: JWK  - X-Ref

JSON Web Key implementation, based on this spec:
https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41

PHP version 5

parseKeySet(array $jwks)   X-Ref
Parse a set of JWK keys

param: array $jwks The JSON Web Key Set as an associative array
return: array An associative array that represents the set of keys

parseKey(array $jwk)   X-Ref
Parse a JWK key

param: array $jwk An individual JWK
return: resource|array An associative array that represents the key

createPemFromModulusAndExponent($n, $e)   X-Ref
Create a public key represented in PEM format from RSA modulus and exponent information

param: string $n The RSA modulus encoded in Base64
param: string $e The RSA exponent encoded in Base64
return: string The RSA public key represented in PEM format

encodeLength($length)   X-Ref
DER-encode the length

DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4.  See
{@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.

param: int $length
return: string