Does libgcrypt provide pkcs1 unpadding functionality?

Daiki Ueno ueno at
Tue May 17 10:53:54 CEST 2011

Daiki Ueno <ueno at> writes:

>> In the libgcrypt doco, it specifies that you can define an
>> s-expression that allows for the data to be padded in PKCS#1 before
>> being encrypted. Is there a another function or another expression I
>> could build to unpad the data after it has been decrypted or is there
>> some other work around to do this?
> The current git master supports "unpad" flag (it was introduced along
> with OAEP padding support yesterday).  The document should be updated I
> guess...will try to do.

Oh, sorry, with the current code the "unpad" flag only works with OAEP.
I'm attaching a patch to support it with PKCS#1.  You could take a look
at check_pubkey_crypt in tests/basic.c for the usage.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-PKCS-1-block-type-2-unpadding.patch
Type: text/x-patch
Size: 3577 bytes
Desc: not available
URL: </pipermail/attachments/20110517/55578a59/attachment.bin>
-------------- next part --------------

BTW, perhaps it might be good to factor out PKCS#1 encode logic to a
separate function as well.

Daiki Ueno

More information about the Gcrypt-devel mailing list