Dear Dave,

Thank you for your response!

On 2013-06-27 6:21, Dave Thompson wrote:
>> From: owner-openssl-us...@openssl.org On Behalf Of Lukas Haase
>> Sent: Tuesday, 25 June, 2013 19:13
> 
>> I have the public and the private key for ECDSA on secp128r1 in a file
>> stored in PKCS8 format (saved with Crypto++; it is PKCS8 according to
>> the Docu).
>>
>> I can create a signature without an error but unfortunately it is not
>> validated successfully with my Crypto++ app:
>>
>> $ cat testakt.txt | openssl dgst -ecdsa-with-SHA1 -sign test.key
>> -keyform DER >act.bin

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 [1].

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 looked at -sigopt but this does not provide an option for that.

>> On the other hand, if I want to check a signature, I cannot even open
>> the (public) key file:
>>
>> $ cat testakt.txt | openssl dgst -sha1 -verify activation.pub 
>> -signature act.bin
>> unable to load key file
>>
> What exactly is in activation.pub? If it's a public-key-only 
> (aka public half, suitable for distribution), it can't be PKCS8; 
> the most common format for public is X.509 SubjectPublicKeyInfo,
> which openssl calls PUBKEY.

You are right, it is X509 [2].

> If that file is PUBKEY in PEM that command should work; if it is 
> PUBKEY in DER you need -keyform der;
> [...]

Yes, -keyform der was missing. Thank you!

Regards,
Luke

[1] http://www.cryptopp.com/wiki/SignerFilter
[2] http://www.cryptopp.com/wiki/Keys_and_Formats


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to