protected function __construct(Key $secret, $headers = array()) { if (empty($secret)) { throw new InvalidOctetSequenceJWKException('secret is not set!.'); } $this->set[JSONWebKeyParameters::KeyType] = new StringOrURI(JSONWebKeyTypes::OctetSequence); parent::__construct($headers); if (count($headers) === 0) { return; } $b64 = new Base64UrlRepresentation(); $this->key = $secret; $this->set[OctetSequenceKeysParameters::Key] = new StringOrURI($b64->encode($secret->getEncoded())); }
/** * @param \Math_BigInteger $big_int * @return Base64urlUInt */ public static function fromBigInt(\Math_BigInteger $big_int) { $b64 = new Base64UrlRepresentation(); $input = $big_int->toBytes(); return new Base64urlUInt($b64->encode($input)); }
/** * @param string $input * @return string */ public static function deserialize($input) { $base64 = new Base64UrlRepresentation(); return $base64->decode($input); }