Obtain Information about hash algorithm from ECDSA public key I have an ECDSA Public Key in DER Format. 
I viewed the file in an ASN1 Editor and there's the OID 1.2.840.10045.1.1 whose superior (1.2.840.10045.1) is ecdsa-with-SHA1. So I thought that SHA1 is used here. But it turns out that a signature generated with the corresponding private key could only be verified with openssl when I used EVP_sha256().

How do I get this information about which hash algorithm is used from the whole key?
This is the whole key:

308201333081EC06072A8648CE3D0201
3081E0020101302C06072A8648CE3D01
01022100A9FB57DBA1EEA9BC3E660A90
9D838D726E3BF623D52620282013481D
1F6E5377304404207D5A0975FC2C3057
EEF67530417AFFE7FB8055C126DC5C6C
E94A4B44F330B5D9042026DC5C6CE94A
4B44F330B5D9BBD77CBF958416295CF7
E1CE6BCCDC18FF8C07B60441048BD2AE
B9CB7E57CB2C4B482FFC81B7AFB9DE27
E1E3BD23C23A4453BD9ACE3262547EF8
35C3DAC4FD97F8461A14611DC9C27745
132DED8E545C1D54C72F046997022100
A9FB57DBA1EEA9BC3E660A909D838D71
8C397AA3B561A6F7901E0E82974856A7
0201010342000448E231AF19DF341C82
63521A9436ACBCA5ACB7E3C56A63187B
F22539BE8242FF82F5521F619977FEE1
3457490123F04915671C7AF755E98465
FD20AECAAF7F58


EDIT:
This is a signature in plain format, verifiable with the public key posted above:

93 ea c4 0a 7e 26 04 dc b9 a1 05 34 b1 52 57 2a
0e 1a c8 d2 d5 fc 96 e5 95 c2 45 3d 71 c7 82 8a
0c ac 72 96 01 8c ef 87 b6 9c e2 55 74 e6 de 2d
c6 a3 5c f0 c6 5e 72 27 3a 30 e0 50 33 16 ed 2d
For the public key there is no hash defined. The hash is a configuration option for the signature generation algorithm but it would work for any EC key.

And your information about the key is, for that reason, also incorrect. SHA-1 is maybe mentioned by a tool, but the OID you gave can be written out in long-form (ASN.1 notation) as:

{iso(1) member-body(2) us(840) ansi-x962(10045) fieldType(1) prime-field(1)}


... there is no SHA-1 in there.

So basically the signature generation is dependent on the application you used to produce the signature.

If it is configurable then the hash algorithm should be included with the signature - not with the key. It would of course be advisable to validate that the signature and hash algorithm are within a pre-configured range if they are configurable: you do not want to verify MD-5 / SHA-1 based signatures anymore.

Note that ECDSA directly use the hash without padding (possibly even using fewer bits than is in the hash). No hash algorithm indication is (or can be) used within the signature format itself. The padding of RSA signatures generally contain a hash identifier that can be viewed modular exponentiation with the RSA public key.