Ok. Perhaps I discribed it wrong. But not to see if it is a valid public key. More if it is a public key. Thing like that it is >= 25 && <= 34, begins with 1 or 3(?). And things like that.
But perhaps it's enough to see if it is a valid base58check as you said. Didn't know of that. So Perhaps it's what Im searching for. Thanks
You can convert back to Hex. Then verify the checksum and the version byte. The later is what differentiates a bitcoin main address from a testnet address or a altcoin address.
Perhaps you are mixed up, a Bitcoin address and a public key are two different things.
A bitcoin address looks like this:
1HZwkjkeaoZfTSaJxDw6aKkxp45agDiEzN
A public key looks like this:
04a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0f a8722476c7709c02559e3aa73aa03918ba2d492eea75abea235
If you want to check if a public key is valid, you can also check the length and check that it is hex. There is no checksum on ecdsa pubkeys.
There are some checks you can do on a public key.
There are two types of pub keys in bitcoin: compressed or uncompressed. They are 33 and 65 byte long respectively.
If it begins with 04, it's uncompressed. If it's 02 or 03, it is compressed.
So you can check the first byte.
If it's uncompressed, the next 32 + 32 bytes is the X and Y coordinates of a point on the Y^2 = X^3 + 7 curve. You can check that too
Note that it must be done modulo N = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141
If it's compressed, only the X coordinate is given. It must be lower than N
This can be done by your EC crypto library when you decode the pubkey.