extracting mpi from a S-exp crypted with RSA

flebool flebool at libero.it
Tue Apr 19 21:00:14 CEST 2005


I haven't understood correctly the model for crypted keys:
in the documentation, i've found that,if i crypt with the rsa algorythm a 
S-exp TEXT in the form:

          (data
            (flags raw)
            (value MPI))

 the crypted S-exp CRYPTED is represented as:

          (enc-val
            (rsa
              (a A-MPI)))


Calling the function:
int legth=gcrypt_sexp_length(CRYPTED);
I get length=2.

i want to get the mpi (a A-MPI),(that i've understood to be the crypted text 
in MPI format) but the function

gcry_mpi_t internal_mpi = gcry_sexp_nth_mpi(CRYPTED,1,GCRYMPI_FMT_USG);

fails.

for completeness,i post the output of a 
writt= gcry_sexp_sprint ( CRYPTED , GCRYSEXP_FMT_DEFAULT , buf_test2 ,(size_t) 
500);

(i do it only to show that it seems (at least to me) to be a good S-exp in the 
format described in the documentation)

the results are: writt=166,buf_test2[500]="\000à\004\b@Ü\004\b(7:enc-val\n 
(3:rsa\n  (1:a128:
\003t«ö\215û\020+9DÎ\016\002\032\226¸\025OÃ4]²RU\025\003\001*\000Ô-o\210\211~\217i\020\f¯ÿ\225Üdæ\207ã\222)ðÕ¤Íd_Â/\036}ÒÎ\203ùu\r¿\fo\bC©Y\227lñP\026î\020\206¡\224àÄJ\"8æ¼\005NYUCNÇ\211Î.m\215.WðR¼Ð.
\212zýJ¦\222\f\037\2269\eÉϼ×d\025ª\234$)\n"

i'm not a good coder, neither a good english writer, so sorry if i haven't 
been clear, or if i haven't understood well the documentation.

thanks in advance for any help.

Flebool

PS if you prefer i can post a source of an example program.
PPS:it may take some time before i can answer your replys




More information about the Gcrypt-devel mailing list