# ECDSA public key generated with constant prefix?

I have some javascript, which generates new ECDSA public-private keypair. However all the resulting public keys which I generate seem to have fixed prefix.

This seems strange to me, since the beginning is always the same. Is this correct? Or should I expect all pub keys to be more random?

Here is example of generated public keys (base58 encoded):

aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTG9WCdoLJo5PbBdaXeKUGoXBiZWLoFszaWcRnyUmgo3jdUkAtnoJijjUooeKUvRcqp5y3w4cXN85dPhTFrGpYmXMG
aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTHWqMbneiD8TN5wntMvV8MgbZviYT3aiBCVUqmdxhNj7tFqRtJ6kdHB9qZsFv7py6Gn1cYQKSJouZKA2hayDrenrQ
aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTHMgQX5y6PNueefoCSiMP45C9nocEKsqHqoeXDkJYvdHUCS7zwSCjpw8E4ggBEp7z1jMTtLmy2PJRqgGGAuzskX7U
aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTJuVVHkx37iQeM9FYXymYkeuFEDGkytjQrkTkdCxkQtWzMt1qYPki77jcPbsQdYehDtirMMR8V1CSzLgynr8B4vaz
aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTGWhozoV5vzA5UbNKriS4uyV43S3oxGB1B5rHJKHN4LvtX1aSsQX7jL7dio5BdmDR68N2YZFLomnLyn82gETxFdUf

• My guess would be that the prefix is some ASN.1 structuring that also indicates the used curve and byte lengths. – SEJPM Aug 26 '17 at 12:39
• You will need to specify what library you're talking about. Otherwise, who knows what metadata it adds to its public key format? – Squeamish Ossifrage Aug 26 '17 at 12:57
• I thought that a binary representation of the public key is given, platform-independant, library-independant. It is not? – Tomas M Aug 26 '17 at 13:29
• There is one fairly commonly used standard, X.509's SubjectPublicKeyInfo more conveniently described in rfc 3279 et rel, and that is what you have, but there are quite a few other formats used by some program(s) or library(ies). – dave_thompson_085 Aug 27 '17 at 1:12
• I'm sure this is just a encoding problem and is not "cryptographically" on-topic here. How can I flag it as such? – DannyNiu Aug 28 '17 at 4:31

Your keys are ASN.1 structures. I decoded first one to hex:

3059301306072A8648CE3D020106082A8648CE3D03010703420004405134B8399A666F12ADA32F19F646F85FB7D1FC3D9AA0688BF8984A35B86AD49FBB96CFAD78B994013D06D7B98C09B0104323DD0A2473CDCA79342277027D3F


When I gave this to ASN.1 parser, it shows me the next structure:

SEQUENCE
----SEQUENCE
--------ObjectIdentifier 1.2.840.10045.2.1 [ecPublicKey]
--------ObjectIdentifier 1.2.840.10045.3.1.7 [prime256v1]