<div>I am trying the following code that gives me the error invalid format:-</div>
<p>ifstream::pos_type size;<br> char * memblock;</p>
<p><br> ifstream file ("c:\\fread.txt", ios::in|ios::binary|ios::ate);</p>
<p> if (file.is_open())<br> {<br> size = file.tellg();<br> memblock = new char [size];<br> file.seekg (0, ios::beg);<br> file.read (memblock, size);<br> file.close();</p>
<p> cout << "the complete file content is in memory";</p>
<p> }<br> else cout << "Unable to open file";</p>
<p> /* load public key */<br> //dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);<br> xmlSecCryptoAppKeyLoadMemory((const unsigned char*)memblock,size, xmlSecKeyDataFormatBinary, NULL,NULL,NULL);
<br></p>
<div>....<br> </div>
<div>Please Advise</div>
<div>regards<br>yesh<br> </div>
<div><span class="gmail_quote">On 12/15/06, <b class="gmail_sendername">Aleksey Sanin</b> <<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Again, you must have in the right format as specified by the "format"<br>parameter.<br><br>Aleksey
<br><br>Yeshwanth C wrote:<br>> I am reading a public key stored in binary format which I got from a key<br>> blob with the function<br>> xmlSecCryptoAppKeyLoadMemory(). But I am getting the error "Invalid format"
<br>> Kindly advise<br>> Thanks in advance<br>> yesh<br>><br>> On 12/15/06, *Aleksey Sanin* <<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a><br>> <mailto:<a href="mailto:aleksey@aleksey.com">
aleksey@aleksey.com</a>>> wrote:<br>><br>> If you can get key in the required binary format, then "yes".<br>> xmlSecCryptoAppKeyLoadMemory() reads key in given format from<br>> a memory block. Very similar to file based version.
<br>><br>> Aleksey<br>><br>> Yeshwanth C wrote:<br>> > Can I send the key that is returned as an argument to<br>> > xmlSecCryptoAppKeyLoadMemory() ?<br>> ><br>><br>>
<br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________<br>> xmlsec mailing list<br>> <a href="mailto:xmlsec@aleksey.com">
xmlsec@aleksey.com</a><br>> <a href="http://www.aleksey.com/mailman/listinfo/xmlsec">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br></blockquote></div><br>