Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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):

share|improve this question
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. –  Paŭlo Ebermann Oct 1 '11 at 15:12
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. –  ThePiachu Oct 1 '11 at 19:07
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). –  Maarten Bodewes - owlstead Jan 2 '12 at 17:03

1 Answer 1

up vote 2 down vote accepted

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.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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