Exemplo n.º 1
0
 /**
  * @param string[]                                  $algorithms
  * @param \Jose\Payload\PayloadConverterInterface[] $payload_converters
  * @param string[]                                  $compression_methods
  *
  * @return \Jose\EncrypterInterface
  */
 public static function createEncrypter(array $algorithms, array $payload_converters = [], array $compression_methods = ['DEF'])
 {
     $algorithm_manager = AlgorithmManagerFactory::createAlgorithmManager($algorithms);
     $payload_converter_manager = PayloadConverterFactory::createPayloadConverter($payload_converters);
     $compression_manager = CompressionManagerFactory::createCompressionManager($compression_methods);
     return new Encrypter($algorithm_manager, $payload_converter_manager, $compression_manager);
 }
Exemplo n.º 2
0
 /**
  * Decrypter constructor.
  *
  * @param string[]|\Jose\Algorithm\KeyEncryptionAlgorithmInterface[]     $key_encryption_algorithms
  * @param string[]|\Jose\Algorithm\ContentEncryptionAlgorithmInterface[] $content_encryption_algorithms
  * @param string[]|\Jose\Compression\CompressionInterface[]              $compression_methods
  */
 public function __construct(array $key_encryption_algorithms, array $content_encryption_algorithms, array $compression_methods)
 {
     $this->setKeyEncryptionAlgorithms($key_encryption_algorithms);
     $this->setContentEncryptionAlgorithms($content_encryption_algorithms);
     $this->setCompressionMethods($compression_methods);
     $this->setJWAManager(Factory\AlgorithmManagerFactory::createAlgorithmManager(array_merge($key_encryption_algorithms, $content_encryption_algorithms)));
     $this->setCompressionManager(Factory\CompressionManagerFactory::createCompressionManager($compression_methods));
 }
Exemplo n.º 3
0
 /**
  * Verifier constructor.
  *
  * @param string[]|\Jose\Algorithm\SignatureAlgorithmInterface[] $signature_algorithms
  */
 public function __construct(array $signature_algorithms)
 {
     $this->setSignatureAlgorithms($signature_algorithms);
     $this->setJWAManager(Factory\AlgorithmManagerFactory::createAlgorithmManager($signature_algorithms));
 }
Exemplo n.º 4
0
 /**
  * @param string[]                         $algorithms
  * @param \Jose\Checker\CheckerInterface[] $checker_managers
  *
  * @return \Jose\VerifierInterface
  */
 public static function createVerifier(array $algorithms, array $checker_managers = [])
 {
     $algorithm_manager = AlgorithmManagerFactory::createAlgorithmManager($algorithms);
     $checker_manager = CheckerManagerFactory::createCheckerManager($checker_managers);
     return new Verifier($algorithm_manager, $checker_manager);
 }
Exemplo n.º 5
0
 /**
  * @param string[]                                  $algorithms
  * @param \Jose\Payload\PayloadConverterInterface[] $payload_converters
  *
  * @return \Jose\SignerInterface
  */
 public static function createSigner(array $algorithms, array $payload_converters = [])
 {
     $algorithm_manager = AlgorithmManagerFactory::createAlgorithmManager($algorithms);
     $payload_converter_manager = PayloadConverterFactory::createPayloadConverter($payload_converters);
     return new Signer($algorithm_manager, $payload_converter_manager);
 }