Get required size of signature before signing.

Stef Bon stefbon at gmail.com
Wed May 13 21:30:13 CEST 2026


Op ma 11 mei 2026 om 09:47 schreef Werner Koch <wk at gnupg.org>:
>
> Hi!
>
> On Sun, 10 May 2026 07:51, Stef Bon said:
>
> > I'm using gcry_pk_sign, and I want the code to get the size of the
> > signature before using the sign function. Is there a way to do this?
>
> The size of the signature depends on the algorithm and its parameters.
> In general the size of a signature is fixed.  It is best to do trial
> signing to find out which signature size is yielded for your algorithm.

In my opinion it's the task of the crypt library to provide this
information. For me to implement a test function to find out the size
is a workaround. I thought the function
gcry_pk_algo_info can do this (using GCRY_GET_ALGO_SIGNSIZE for
example) because in general this size is fixed as you mention, but it
doesn't. Is this an idea?

Stef



More information about the Gcrypt-devel mailing list