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