anchor.diff:  	 decrypt_public/2, decrypt_public/3,
   	 dh_gex_group/4,
   	 dh_gex_group_sizes/0,
  -	 sign/3, verify/4,
  +	 sign/3, sign/4, verify/4, verify/5,
   	 generate_key/1,
   	 compute_key/2, compute_key/3,
   	 pkix_sign/2, pkix_verify/2,	 
  
positive.code:     {sha512, ecdsa}.
  
  %%--------------------------------------------------------------------
  -spec sign(binary() | {digest, binary()},  rsa_digest_type() | dss_digest_type() | ecdsa_digest_type(),
  	   rsa_private_key() |
  	   dsa_private_key() | ec_private_key()) -> Signature :: binary().
  %% Description: Create digital signature.
  %%--------------------------------------------------------------------
  sign(DigestOrPlainText, DigestType, Key = #'RSAPrivateKey'{}) ->
      crypto:sign(rsa, DigestType, DigestOrPlainText, format_rsa_private_key(Key));
  
  sign(DigestOrPlainText, sha, #'DSAPrivateKey'{p = P, q = Q, g = G, x = X}) ->
      crypto:sign(dss, sha, DigestOrPlainText, [P, Q, G, X]);
  
  sign(DigestOrPlainText, DigestType, #'ECPrivateKey'{privateKey = PrivKey,
  						    parameters = Param}) ->
      ECCurve = ec_curve_spec(Param),
      crypto:sign(ecdsa, DigestType, DigestOrPlainText, [PrivKey, ECCurve]);
  
  %% Backwards compatible
  sign(Digest, none, #'DSAPrivateKey'{} = Key) ->
      sign({digest,Digest}, sha, Key).
  
  %%--------------------------------------------------------------------
  -spec verify(binary() | {digest, binary()}, rsa_digest_type() | dss_digest_type() | ecdsa_digest_type(),
  	     Signature :: binary(), rsa_public_key()
  	     | dsa_public_key() | ec_public_key()) -> boolean().
  %% Description: Verifies a digital signature.
  %%--------------------------------------------------------------------
  verify(DigestOrPlainText, DigestType, Signature, Key) when is_binary(Signature) ->
      do_verify(DigestOrPlainText, DigestType, Signature, Key);
  verify(_,_,_,_) -> 
      %% If Signature is a bitstring and not a binary we know already at this
      %% point that the signature is invalid.
      false.
  
negative.code: %%--------------------------------------------------------------------
  %%% Internal functions
  %%--------------------------------------------------------------------
  format_sign_key(Key = #'RSAPrivateKey'{}) ->
      {rsa, format_rsa_private_key(Key)};
  format_sign_key(#'DSAPrivateKey'{p = P, q = Q, g = G, x = X}) ->
      {dss, [P, Q, G, X]};
  format_sign_key(#'ECPrivateKey'{privateKey = PrivKey, parameters = Param}) ->
      {ecdsa, [PrivKey, ec_curve_spec(Param)]};
  format_sign_key(_) ->
      badarg.
  
  format_verify_key(#'RSAPublicKey'{modulus = Mod, publicExponent = Exp}) ->
      {rsa, [Exp, Mod]};
  format_verify_key({#'ECPoint'{point = Point}, Param}) ->
      {ecdsa, [Point, ec_curve_spec(Param)]};
  format_verify_key({Key,  #'Dss-Parms'{p = P, q = Q, g = G}}) ->
      {dss, [P, Q, G, Key]};
  %% Convert private keys to public keys
  format_verify_key(#'RSAPrivateKey'{modulus = Mod, publicExponent = Exp}) ->
      format_verify_key(#'RSAPublicKey'{modulus = Mod, publicExponent = Exp});
  format_verify_key(#'ECPrivateKey'{parameters = Param, publicKey = {_, Point}}) ->
      format_verify_key({#'ECPoint'{point = Point}, Param});
  format_verify_key(#'ECPrivateKey'{parameters = Param, publicKey = Point}) ->
      format_verify_key({#'ECPoint'{point = Point}, Param});
  format_verify_key(#'DSAPrivateKey'{y=Y, p=P, q=Q, g=G}) ->
      format_verify_key({Y, #'Dss-Parms'{p=P, q=Q, g=G}});
  format_verify_key(_) ->
      badarg.
  
  do_pem_entry_encode(Asn1Type, Entity, CipherInfo, Password) ->
      Der = der_encode(Asn1Type, Entity),
  