Re: Get required size of signature before signing.
Stef Bon via Gcrypt-devel <[email protected]> Wed, 13 May 2026 21:30:13 +0200
| Newsgroups | gmane.comp.encryption.gpg.libgcrypt.devel |
|---|---|
| Message-ID | <CANXojcxuECv+1wScKKwVm=_GS7aCo5RXB7yfFJtHB8ZtxkDotQ@mail.gmail.com> |
Op ma 11 mei 2026 om 09:47 schreef Werner Koch <[email protected]>: > > 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