anchor.diff:  -export([
       provider_certs_are_published_on_registration/1,
       verify_fails_on_forged_certs/1,
  -    verify_succeeds_on_published_certs/1,
       verify_succeeds_on_republished_cert/1,
       certs_should_be_cached_after_successful_publishing/1]).
   
   -define(NORMAL_CASES_NAMES, [
       provider_certs_are_published_on_registration,
       verify_fails_on_forged_certs,
  -    verify_succeeds_on_published_certs,
       verify_succeeds_on_republished_cert,
       certs_should_be_cached_after_successful_publishing
   ]).
  
positive.code: register_provider(Workers) ->
      ?assertMatch({ok, _}, rpc:call(hd(Workers), oneprovider, register_provider_in_oz, [Workers])).
  
  publish(Worker, Cert) ->
      rpc:call(Worker, identity, publish, [Cert]).
  
  verify(Worker, Cert) ->
      rpc:call(Worker, identity, verify, [Cert]).
  
negative.code:     %% then
      ?assertMatch({error, key_does_not_match}, Res1),
      ?assertMatch({error, key_does_not_match}, Res2),
      ?assertMatch({error, key_does_not_match}, Res3),
      ?assertMatch({error, key_does_not_match}, Res4),
      ?assertMatch({error, key_does_not_match}, Res5),
      ?assertMatch({error, key_does_not_match}, Res6).
  
  verify_succeeds_on_republished_cert(Config) ->
      %% given
      [WorkerP1, WorkerP2] = ?config(op_worker_nodes, Config),
      register_provider([WorkerP1]),
      register_provider([WorkerP2]),
      UpdatedCert1 = new_self_signed_cert(get_id(WorkerP1)),
      UpdatedCert2 = new_self_signed_cert(get_id(WorkerP2)),
  
      %% when
      update(WorkerP1, UpdatedCert1),
      update(WorkerP2, UpdatedCert2),
  
      %% then
      ?assertMatch(ok, verify(WorkerP1, UpdatedCert1)),
      ?assertMatch(ok, verify(WorkerP2, UpdatedCert1)),
      ?assertMatch(ok, verify(WorkerP1, UpdatedCert2)),
      ?assertMatch(ok, verify(WorkerP2, UpdatedCert2)).
  
  certs_should_be_cached_after_successful_publishing(Config) ->
      %% given
      [WorkerP1, WorkerP2] = ?config(op_worker_nodes, Config),
      ID1 = get_id(WorkerP1),
      ID2 = get_id(WorkerP2),
      invalidate_cache(WorkerP1, ID1),
      invalidate_cache(WorkerP1, ID2),
      invalidate_cache(WorkerP2, ID1),
      invalidate_cache(WorkerP2, ID2),
  
      register_provider([WorkerP1]),
      register_provider([WorkerP2]),
      UpdatedCert1 = new_self_signed_cert(ID1),
      UpdatedCert2 = new_self_signed_cert(ID2),
  
      %% when
      update(WorkerP1, UpdatedCert1),
      update(WorkerP2, UpdatedCert2),
  
      %% then
      Res1 = rpc:call(WorkerP1, plugins, apply, [identity_cache, get, [ID1]]),
      Res2 = rpc:call(WorkerP1, plugins, apply, [identity_cache, get, [ID2]]),
      Res3 = rpc:call(WorkerP2, plugins, apply, [identity_cache, get, [ID1]]),
      Res4 = rpc:call(WorkerP2, plugins, apply, [identity_cache, get, [ID2]]),
  
      EncodedPK1 = identity_utils:encode(identity_utils:get_public_key(UpdatedCert1)),
      EncodedPK2 = identity_utils:encode(identity_utils:get_public_key(UpdatedCert2)),
  
      ?assertMatch({ok, EncodedPK1}, Res1),
      ?assertMatch({error, _}, Res2),
      ?assertMatch({error, _}, Res3),
      ?assertMatch({ok, EncodedPK2}, Res4).
  
  
  %%%===================================================================
  