/** * @return Context */ public function get() { $randomGenerator = $this->randomGenerator ?: new OpenSslRandomGenerator(); $context = new DefaultContext($randomGenerator); $context->jwsAlgorithms()->add(JwsAlgorithm::NONE, new PlainText())->add(JwsAlgorithm::HS256, new HmacUsingSha('sha256'))->add(JwsAlgorithm::HS384, new HmacUsingSha('sha384'))->add(JwsAlgorithm::HS512, new HmacUsingSha('sha512'))->add(JwsAlgorithm::RS256, new RsaUsingSha('sha256'))->add(JwsAlgorithm::RS384, new RsaUsingSha('sha384'))->add(JwsAlgorithm::RS512, new RsaUsingSha('sha512')); $context->jweAlgorithms()->add(JweAlgorithm::RSA1_5, new RsaAlgorithm(OPENSSL_PKCS1_PADDING, $randomGenerator))->add(JweAlgorithm::RSA_OAEP, new RsaAlgorithm(OPENSSL_PKCS1_OAEP_PADDING, $randomGenerator))->add(JweAlgorithm::A128KW, new AesKeyWrapAlgorithm(128, $randomGenerator))->add(JweAlgorithm::A192KW, new AesKeyWrapAlgorithm(192, $randomGenerator))->add(JweAlgorithm::A256KW, new AesKeyWrapAlgorithm(256, $randomGenerator))->add(JweAlgorithm::DIR, new DirectAlgorithm()); $context->jweEncryptions()->add(JweEncryption::A128CBC_HS256, new AesCbcHmacEncryption(256, new HmacUsingSha('sha256'), $randomGenerator))->add(JweEncryption::A192CBC_HS384, new AesCbcHmacEncryption(384, new HmacUsingSha('sha384'), $randomGenerator))->add(JweEncryption::A256CBC_HS512, new AesCbcHmacEncryption(512, new HmacUsingSha('sha512'), $randomGenerator)); return $context; }
public function test_json_mapper_get_set() { $context = new DefaultContext(); $context->setJsonMapper($expected = $this->getJsonMapperMock()); $this->assertSame($expected, $context->jsonMapper()); }