Example #1
0
File: JWE.php Project: sop/jwx
 /**
  * Decrypt content using given JWK.
  *
  * Key management and content encryption algorithms are determined from the
  * header.
  *
  * @param JWK $jwk JSON Web Key
  * @throws \RuntimeException If algorithm initialization fails
  * @return string Plaintext payload
  */
 public function decryptWithJWK(JWK $jwk)
 {
     $header = $this->header();
     $key_algo = KeyManagementAlgorithm::fromJWK($jwk, $header);
     $enc_algo = EncryptionAlgorithmFactory::algoByHeader($header);
     return $this->decrypt($key_algo, $enc_algo);
 }