> From: [email protected] On Behalf Of Lukas Haase
> Sent: Thursday, 27 June, 2013 04:46

<snip previous>
> I think I found the problem but I am unsure how to deal with it :-(
> 
> There are two ways to create a signature: The original message can be
> part of the signature (put=true) or not (put=false). In the first case,
> the signature gets larger (this is what I observe, the signature is not
> exactly 32 Bytes) and only the signature needs to be presented to the
> verifier. In the latter case, the concatenation message|signature needs
> to be presented [cite to cryptopp].
> 
That doesn't make sense. The ECDSA signature format in openssl (also DSA) 
is an ASN.1 encoding; it is almost never 32 bytes for a p-128 curve.
It contains two values normally the size of the curve order (for DSA 
the subgroup) but maybe smaller with low probability, plus overhead 
from 6-11 bytes seemingly at random. It does not include the data 
and does not get longer for long data, as you can easily test.

Simply concatenating data+signature (or || commonly is concatenation 
but | is not) can't work for variable length signatures as above 
and variable data as is almost always required. Possibly cryptopp 
is using a nonstandard fixed-size encoding for (these?) signatures, 
in which case the signature does remain the same length which could 
be 32 bytes here and it is only the data that varies in size;
or the page you reference says at one point the signature is 
*prepended* to the message, which is different and could work.

> I use put=false in my application because I aim for a signature as short
> as possible (used for product activation in my software).
> 
> openssl dgst -sign unfortunately uses the put=true
> 
> When I rewrite my software to accept put=true it works so I 
> am sure that this is the issue.
> 
> Is there an easy way to convert the openssl output to the second method
> by "stripping off" the data somehow, leaving *only* the signature?
> 
I don't know what you're looking at, but as above openssl dgst (and 
EVP_Sign*) doesn't do what you say. openssl elsewhere does support 
the standard PKCS7/CMS/SMIME format(s) for data plus signature(s!), 
but those are quite a bit more complicated (and even in minimal case, 
noticeably bigger) than just concatentation. It also supports several 
things that use the X.509 SIGNED "macro" i.e. SEQUENCE of data, algid 
with possible parameters, and signature, which is simpler and smaller 
but still more than concatenation. openssl does not directly support 
XML-DSIG, a newer and even more complicated format.

<snip rest>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to