Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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