[xmlsec] xmlSecCryptoAppKeyLoadMemory

Yeshwanth C cyeshwanth at gmail.com
Sun Dec 17 21:38:59 PST 2006


I am still getting the same error invalid format.
Shoud the binary data be converted to base64 before being used?
The actual code reads as follows:-

 ifstream::pos_type size;
  char * memblock;
 ifstream file ("c:\\fread.txt", ios::in|ios::binary|ios::ate);

if (file.is_open())
 {
  size = file.tellg();
  memblock = new  char [size];
  file.seekg (0, ios::beg);
  file.read (memblock, size);
  file.close();

  cout << "the complete file content is in memory";

 }
 else cout << "Unable to open file";

    /* load public key */

 xmlSecCryptoAppKeyLoadMemory((const unsigned char*)memblock,size,
xmlSecKeyDataFormatBinary, NULL,NULL,NULL);
Regards

Yesh


On 12/18/06, Yeshwanth C <cyeshwanth at gmail.com> wrote:
>
> Sorry. I have put in some commented out code as well
> The actual code reads as follows:-
>
>  ifstream::pos_type size;
>   char * memblock;
>  ifstream file ("c:\\fread.txt", ios::in|ios::binary|ios::ate);
>
> if (file.is_open())
>  {
>   size = file.tellg();
>   memblock = new  char [size];
>   file.seekg (0, ios::beg);
>   file.read (memblock, size);
>   file.close();
>
>   cout << "the complete file content is in memory";
>
>  }
>  else cout << "Unable to open file";
>
>     /* load public key */
>
>  xmlSecCryptoAppKeyLoadMemory((const unsigned char*)memblock,size,
> xmlSecKeyDataFormatBinary, NULL,NULL,NULL);
> Regards
>
> Yesh
>
>
>
>  On 12/18/06, Aleksey Sanin <aleksey at aleksey.com> wrote:
> >
> > >     //dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file,
> > > xmlSecKeyDataFormatPem, NULL, NULL, NULL);
> > >  xmlSecCryptoAppKeyLoadMemory((const unsigned char*)memblock,size,
> > > xmlSecKeyDataFormatBinary, NULL,NULL,NULL);
> > >
> >
> >
> > PEM format != Binary format
> >
> > Aleksey
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.aleksey.com/pipermail/xmlsec/attachments/20061218/55b7c1c8/attachment-0002.htm


More information about the xmlsec mailing list