@Test
public void createPrimitive() throws Exception {

  EciesAeadHkdfPrivateKey key = createValidKey();
  HybridDecrypt hybridDecrypt = manager.getPrimitive(key, HybridDecrypt.class);
  EciesAeadHkdfParams eciesParams = key.getPublicKey().getParams();
  EciesHkdfKemParams kemParams = eciesParams.getKemParams();
  ECPublicKey recipientPublicKey =
      EllipticCurves.getEcPublicKey(
          HybridUtil.toCurveType(kemParams.getCurveType()),
          key.getPublicKey().getX().toByteArray(),
          key.getPublicKey().getY().toByteArray());
  EciesAeadHkdfDemHelper demHelper =
      new RegistryEciesAeadHkdfDemHelper(eciesParams.getDemParams().getAeadDem());
  HybridEncrypt hybridEncrypt = new EciesAeadHkdfHybridEncrypt(
      recipientPublicKey,
      kemParams.getHkdfSalt().toByteArray(),
      HybridUtil.toHmacAlgo(kemParams.getHkdfHashType()),
      HybridUtil.toPointFormatType(eciesParams.getEcPointFormat()),
      demHelper);
  byte[] message = Random.randBytes(20);
  byte[] contextInfo = Random.randBytes(20);
  assertThat(hybridDecrypt.decrypt(hybridEncrypt.encrypt(message, contextInfo), contextInfo))
      .isEqualTo(message);
}