[xmlsec] xmlSecCryptoAppKeyLoadMemory

Yeshwanth C cyeshwanth at gmail.com
Sun Dec 17 21:09:30 PST 2006


I am trying the following  code that gives me the error invalid format:-

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 */
    //dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file,
xmlSecKeyDataFormatPem, NULL, NULL, NULL);
 xmlSecCryptoAppKeyLoadMemory((const unsigned char*)memblock,size,
xmlSecKeyDataFormatBinary, NULL,NULL,NULL);
....

Please Advise
regards
yesh

On 12/15/06, Aleksey Sanin <aleksey at aleksey.com> wrote:
>
> Again, you must have in the right format as specified by the "format"
> parameter.
>
> Aleksey
>
> Yeshwanth C wrote:
> > I am reading a public key stored in binary format which I got from a key
> > blob with the function
> > xmlSecCryptoAppKeyLoadMemory().  But I am getting the error "Invalid
> format"
> > Kindly advise
> > Thanks in advance
> > yesh
> >
> > On 12/15/06, *Aleksey Sanin* <aleksey at aleksey.com
> > <mailto:aleksey at aleksey.com>> wrote:
> >
> >     If you can get key in the required binary format, then "yes".
> >     xmlSecCryptoAppKeyLoadMemory() reads key in given format from
> >     a memory block. Very similar to file based version.
> >
> >     Aleksey
> >
> >     Yeshwanth C wrote:
> >      > Can I send the key that is returned as an argument to
> >      > xmlSecCryptoAppKeyLoadMemory() ?
> >      >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > xmlsec mailing list
> > xmlsec at aleksey.com
> > http://www.aleksey.com/mailman/listinfo/xmlsec
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.aleksey.com/pipermail/xmlsec/attachments/20061218/dd393879/attachment-0002.htm


More information about the xmlsec mailing list