anchor.diff:      end.
   
   
  -find_issuer(OtpCert, BinCert, CertDbHandle, CertsDbRef, ListDb) ->
  +find_issuer(#cert{der=DerCert, otp=OtpCert}, CertDbHandle, CertsDbRef, ListDb) ->
       IsIssuerFun =
   	fun({_Key, {_Der, #'OTPCertificate'{} = ErlCertCandidate}}, Acc) ->
   		case public_key:pkix_is_issuer(OtpCert, ErlCertCandidate) of
   		    true ->
  -			case verify_cert_signer(BinCert, ErlCertCandidate#'OTPCertificate'.tbsCertificate) of
  +			case verify_cert_signer(DerCert, ErlCertCandidate#'OTPCertificate'.tbsCertificate) of
   			    true ->
   				throw(public_key:pkix_issuer_id(ErlCertCandidate, self));
   			    false ->
  
positive.code: 	{_, true = SelfSigned} ->
  	    do_certificate_chain(CertDbHandle, CertsDbRef, Chain, ignore, ignore, SelfSigned, ListDb);
  	{{error, issuer_not_found}, SelfSigned} ->
  	    case find_issuer(OtpCert, BinCert, CertDbHandle, CertsDbRef, ListDb) of
  		{ok, {SerialNr, Issuer}} ->
  		    do_certificate_chain(CertDbHandle, CertsDbRef, Chain,
  					 SerialNr, Issuer, SelfSigned, ListDb);
  
negative.code: certificate_chain(DerCert, CertDbHandle, CertsDbRef) when is_binary(DerCert) ->
      ErlCert = public_key:pkix_decode_cert(DerCert, otp),
      Cert = #cert{der=DerCert, otp=ErlCert},
      Res = certificate_chain(Cert, CertDbHandle, CertsDbRef, [Cert], []),
      to_der(certificate_chain, Res);
  certificate_chain(OtpCert, CertDbHandle, CertsDbRef) ->
      DerCert = public_key:pkix_encode('OTPCertificate', OtpCert, otp),
      Cert = #cert{der=DerCert, otp=OtpCert},
      Res = certificate_chain(Cert, CertDbHandle, CertsDbRef, [Cert], []),
      to_der(certificate_chain, Res).
  
  %%--------------------------------------------------------------------
  