Re: DSA signature verification trouble...
Dan Berger <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
Doh!
Never mind - the arguments were reversed.
Don't I feel silly.
On Wed, 2004-08-04 at 11:19 -0700, Dan Berger wrote:
> I thought this was a problem between my Python and C code, but it looks
> like either there's a problem in M2Crypto (possibly OpenSSL), or I'm
> missing something. Consider the following code:
>
> import M2Crypto
> import M2Crypto.DSA
> import M2Crypto.EVP
> ksk = M2Crypto.DSA.load_key("/home/dberger/Projects/IKaRoS/server/db/ksk_1.pem")
> signature = ksk.sign_asn1("foobar")
> ksk.verify_asn1(signature, "foobar")
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.2/site-packages/M2Crypto/DSA.py", line 132, in verify_asn1
> M2Crypto.DSA.DSAError: too long
>
> Feeding a signature produced by sign_asn1 directly into verify_asn1
> fails. Anyone have any suggestions?
>
> By the way - doing this:
>
> import M2Crypto
> import M2Crypto.DSA
> import M2Crypto.EVP
> ksk = M2Crypto.DSA.load_key("/home/dberger/Projects/IKaRoS/server/db/ksk_1.pem")
> signature = ksk.sign("foobar")
> ksk.verify("foobar", signature[0], signature[1])
>
> returns success, which suggests it's a problem with the asn1 encode/decode "stuff."
>
> --
>
> ...Dan Berger [[email protected]]
> Department of Computer Science
> Surge Building, Room 357
> University of California, Riverside
> http://www.cs.ucr.edu/~dberger
>
> "I like naked women. I'm a bloke. I'm supposed to like them. We're
> born like that. We like naked women as soon as we're pulled out of
> one. Halfway down the birth canal we're already enjoying the view!"
>
> - Steve, Coupling: "Inferno"
--
...Dan Berger [[email protected]]
Department of Computer Science
Surge Building, Room 357
University of California, Riverside
http://www.cs.ucr.edu/~dberger
"No boom?"
"No boom."
"No boom *today*. Boom tomorrow. There's *always* a boom tomorrow."
"What?"
"Look, somebody's got to have some damn perspective around here.
Boom, sooner or later. *BOOM*!"
- Garibaldi, Sinclair, and Ivanova, Babylon 5: "Grail"
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQBBETX4hHyVxVGhKFYRApFEAJ0XISfUUYLUGhvmDj/MpUlxFH62XgCeMU96 bToBzjQpXrHdtb/Uku0ef1U= =7RQR -----END PGP SIGNATURE-----