I`m currently implementing an ECDSA library based on curves like secp256k1. I would like to test it using some test vectors, like http://csrc.nist.gov/groups/STM/cavp/documents/dss/ecdsatestvectors.zip . Is there any place where I can get some vectors for testing encryption with that curve?

Example vector has this structure:

var testVectors = []struct {
msg    string
Qx, Qy string
r, s   string
ok     bool

and looks like this (for P224 curve):

  • $\begingroup$ DSA (and ECDSA) is not an encryption algorithm, but a signature algorithm. And this signature is not deterministic ... the best we could do is to give some example signatures which you could verify, or some sample random $k$ together with the signature created from this. $\endgroup$ Commented Oct 1, 2011 at 15:12
  • $\begingroup$ I already have a testing architecture in place from a library implementing curves like P224, but I can't find any external data to test my implementation against. It should work, I can successfully generate, sign and verify anything with it, but comparing it with someone else's implementation would be desirable. $\endgroup$
    – ThePiachu
    Commented Oct 1, 2011 at 19:07
  • $\begingroup$ You could try and find as many corner cases as possible, regarding the input and internal random number generation. Then you could test against e.g. bouncy castle, which contains a ECDSA implementation as well as all the Secp curves (in the ASN.1 part of the source). $\endgroup$
    – Maarten Bodewes
    Commented Jan 2, 2012 at 17:03

1 Answer 1


I don't unfortunately know a good set of preexisting test vectors for this curve. Instead I decided to advice you how you can generate them yourself. Hope this helps.

Some (fairly recent) OpenSSL versions are familiar with secp256k1 curve. You may use e.g. OpenSSL's command line tool openssl's commands ecparam, ec, dgst to generate key pairs, parameter files, and ECDSA signatures using the curve.

If you do some scripting, you can even create files that appear similar than the the ECDSA test vectors from NIST/CAVP.

On the other hand, if you do not wish to force specific value for $k$ for testing or use deterministic variant of ECDSA signing (see RFC 6979), then you may be better of trying this:

  • Validate your verification function with some pregenerated test vectors (containing both correct and incorrect signatures). Note: Remember to generate the vectors using some independent implementation (possibly e.g. OpenSSL).
  • Validate your signature function for compatibility with your verification function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.