How can i check if a public key match with a private key Is there a way to check, (with openssl command for example), if a given public key match with a private key ?

Thanks
One method works with any signature scheme and any program including OpenSSL: make a signature of a file with the private key, and check signature and file against the public key.

If the check is OK, then private and public key match (or the signature scheme is broken).

If there is some failure, then private and public key do not match (or the program is misused, incomptible with the key formats, or broken).

Example with openssl, showing Verified OK for matched private/public keys tstpri.pem/tstpub.pem; Verification Failure for unmatched keys altpri.pem/tstpub.pem.

# generate an secp256k1 private key
openssl ecparam -genkey -noout -name secp256k1 -out tstpri.pem
# extract the public key
openssl ec -in tstpri.pem -pubout -out tstpub.pem &gt;/dev/null
# generate an alternate secp256k1 private key
openssl ecparam -genkey -noout -name secp256k1 -out altpri.pem


# create a file fil (any content will do)
echo foo &gt;fil

# sign fil with private key
openssl dgst -sha256 -sign tstpri.pem -out tst.sig fil
# verify the signature with matching public key
openssl dgst -sha256 -verify tstpub.pem -signature tst.sig fil
Verified OK

# sign fil with alternate private key
openssl dgst -sha256 -sign altpri.pem -out tst.sig fil
# verify the signature with non-matching public key
openssl dgst -sha256 -verify tstpub.pem -signature tst.sig fil
Verification Failure