Example #1
0
 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()));
 }
Example #2
0
 /**
  * @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));
 }
Example #3
0
 /**
  * @param string $input
  * @return string
  */
 public static function deserialize($input)
 {
     $base64 = new Base64UrlRepresentation();
     return $base64->decode($input);
 }