Problem: Buffer to MPI via scan and back with print

Berg, Ralph ralph.berg at rheinmetall.com
Wed May 22 17:45:14 CEST 2013


Being a newbie I found the following problem:

 

MPI scan and back with print has different results (first three zero
bytes omitted!):

 

gcry_mpi_scan( &plain_mpi, GCRYMPI_FMT_USG, inbuf, inlen, NULL )

 

gcry_mpi_print(GCRYMPI_FMT_USG,(unsigned
char*)outbuf,BUFSIZE,&size,plain_mpi)

 

Where is the problem? I would like to encrypt data directly using
libgcrypt.

 

 

unsigned char inbuf[]={

0x00, 0x00, 0x00, 0x08, 0x00, 0x7a, 0x7b, 0xe5, 0x40, 0x5d, 0xab, 0xb9,
0x8f, 0x6d, 0xf3, 0x02, 

0x00, 0x00, 0x4c, 0x0b, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x57, 0x75, 0x70,
0x69, 0x51, 0x75, 0x69, 

0x7a, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x57, 0x75, 0x70, 0x69,
0x51, 0x75, 0x69, 0x7a, 

0x2e, 0x70, 0x64, 0x62, 0xec, 0xdb, 0x09, 0x58, 0x13, 0xc7, 0x02, 0x07,
0xf0, 0x89, 0x80, 0x20, 

0x97, 0x09, 0x22, 0x0a, 0x2a, 0x46, 0x8b, 0xa8, 0xd5, 0x70, 0x2a, 0x22,
0x58, 0x01, 0x09, 0x20, 

0xca, 0x1d, 0x2e, 0x31, 0x8a, 0x21, 0x09, 0x10, 0x0d, 0x49, 0xcc, 0x21,
0xe2, 0x55, 0x6d, 0xad, 

0xda, 0x7a, 0xd4, 0x7a, 0x17, 0x15, 0x0f, 0xb4, 0x55, 0xab, 0xad, 0x47,
0x5f, 0x5b, 0xeb, 0x59, 

0xeb, 0x59, 0xe5, 0xd5, 0xb3, 0x1e, 0xad, 0xf5, 0xb5, 0xd5, 0xd6, 0x6a,
0xad, 0xb7, 0xb5, 0x5a, 

0xe5, 0xfd, 0x67, 0x77, 0xa3, 0x09, 0x72, 0xb4, 0xa2, 0xed, 0x7b, 0xdf,
0xc7, 0x7e, 0xdf, 0x8f, 

0x64, 0x27, 0xb3, 0xb3, 0xb3, 0x33, 0xbb, 0x33, 0xb3, 0xb3, 0x4b, 0xa2,
0x4a, 0xae, 0xd7, 0x1a, 

0xb4, 0xf9, 0x46, 0x61, 0xb4, 0x7f, 0x74, 0x97, 0x2e, 0xc2, 0x44, 0x49,
0xac, 0xb0, 0x87, 0x5f, 

0x40, 0x80, 0x8b, 0xa3, 0x97, 0x58, 0x42, 0xb0, 0xd8, 0x12, 0xd2, 0x08,
0x1f, 0xc7, 0xf0, 0x67, 

0xa6, 0x23, 0x61, 0x96, 0x83, 0x8d, 0x48, 0xc3, 0xd2, 0xb0, 0x34, 0x2c,
0x0d, 0x4b, 0x95, 0x65, 

0x5b, 0x65, 0xc3, 0xd2, 0xb0, 0x34, 0x2c, 0xff, 0x3f, 0x4b, 0xa8, 0x5d,
0x35, 0x97, 0xf1, 0xc3, 

0xca, 0xfb, 0x95, 0xe6, 0xef, 0xe3, 0xd9, 0x78, 0xf6, 0x7f, 0xe6, 0xf2,
0x1f, 0xdf, 0xe7, 0xf1, 

0xf7, 0x6b, 0xff, 0xec, 0x71, 0x35, 0x2c, 0x0d, 0x4b, 0xc3, 0x52, 0xf7,
0x32, 0xc7, 0x2f, 0x90

};

 

outbuf[]={

0x08, 0x00, 0x7a, 0x7b, 0xe5, 0x40, 0x5d, 0xab, 0xb9, 0x8f, 0x6d, 0xf3,
0x02, 0x00, 0x00, 0x4c, 

0x0b, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x57, 0x75, 0x70, 0x69, 0x51, 0x75,
0x69, 0x7a, 0x2f, 0x64, 

0x65, 0x62, 0x75, 0x67, 0x2f, 0x57, 0x75, 0x70, 0x69, 0x51, 0x75, 0x69,
0x7a, 0x2e, 0x70, 0x64, 

0x62, 0xec, 0xdb, 0x09, 0x58, 0x13, 0xc7, 0x02, 0x07, 0xf0, 0x89, 0x80,
0x20, 0x97, 0x09, 0x22, 

0x0a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 0xc3, 0x52, 0xf7, 0x32, 0xc7, 0x2f,
0x90,

};

 

 

Kind regards

Ralph Berg

 

 

 

 



---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

Rheinmetall Defence Electronics GmbH
Brüggeweg 54 - D-28309 Bremen - Tel +49 421 457-01 - Fax +49 421 457-2900 - Sitz der Gesellschaft: Bremen - Register: Amtsgericht Bremen, HRB 9659
Commerzbank AG, Bremen (BLZ 290 400 90) 102213600 - www.rheinmetall-defence.com
Aufsichtsratsvorsitzender: Bodo Garbe - Geschäftsführung: Luitjen Ennenga, Ulrich Sasse, Thorsten Quade


-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20130522/5f9dba73/attachment.html>


More information about the Gcrypt-devel mailing list