extracting mpi from a S-exp crypted with RSA

flebool flebool at libero.it
Tue Apr 26 00:29:47 CEST 2005

thank you, you've been very clear:
using the function gcry_sexp_find_token() suggested, i've managed to extract 
the MPI from the S-exp.

then i've tried to extract the crypted data from the MPI:

gcry_mpi_print(GCRYMPI_FMT_USG, buf_test, 4000, &written, mpi_extracted)

the function works well: 

i've used as text to be crypted & decrypted: "clear text", with a pair of 1024 
bit RSA keys(I've tested them with the function gcry_pk_testkey(),so they 
should be right).there are two things i don't understand:

1)the value returned in written doesn't depend upon the legth of the 
crypt/decrypt string:
i've increased the length of the crypt/decrypt string(up to 940 bytes), but 
the value returned in written is always 128.

2)why the value returned in the variable written by the function is 128: i was 
expecting it to be a multiple of the size of the keys(something like 

i've thougth that this could depend on the fact that the MPI data type can 
accept string up to 128 bytes length long: if so, I have to divide my strings 
in blocks of 128bytes,but i haven't found anything like this in the manual.

thanks in advance for any help.

More information about the Gcrypt-devel mailing list