<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — wc_DerToPem not found]]></title>
		<link>https://www.wolfssl.com/forums/topic2231-wcdertopem-not-found.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic2231.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in wc_DerToPem not found.]]></description>
		<lastBuildDate>Mon, 18 Nov 2024 13:32:39 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8066.html#p8066</link>
			<description><![CDATA[<p>So if you are not using the autotools configure command, then you should be configuring with a file called user_settings.h and passing WOLFSSL_USER_SETTINGS to the project building wolfSSL. In this case there will not be an options.h file used.</p>]]></description>
			<author><![CDATA[null@example.com (embhorn)]]></author>
			<pubDate>Mon, 18 Nov 2024 13:32:39 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8066.html#p8066</guid>
		</item>
		<item>
			<title><![CDATA[Re: wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8061.html#p8061</link>
			<description><![CDATA[<p>I&#039;ve been searching it up for a bit, and I&#039;ve tried various methods:</p><p>None of the four versions avaible from the Arduino IDE had the configure file (I even searched it in the subfolders).<br />I&#039;ve also tried installing with git clone (btw I&#039;m from Windows) and it had a configure.ac file in the root, but with ./configure .ac CFLAGS=&quot;-DWOLFSSL_DER_TO_PEM&quot; it prompted me with an error that seemed to be because it wasn&#039;t meant to be executed with ./ .<br />I also included settings.h.</p><p>Finally, if I try to include wolfssl/options.h before any other wolfssl header (even before wolfssl.h) I get a &quot;No such file or directory&quot; error on wolfssl/options.h.</p>]]></description>
			<author><![CDATA[null@example.com (vainn48)]]></author>
			<pubDate>Sat, 16 Nov 2024 11:43:04 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8061.html#p8061</guid>
		</item>
		<item>
			<title><![CDATA[Re: wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8059.html#p8059</link>
			<description><![CDATA[<p>Hi, thank you for the include tip embhorn! Kind of, it&#039;s for a university project.</p><p>Also, regarding your second reply, what do you mean with configuring wolfSSL?<br />I&#039;m sure this is a newbie and dumb question to ask, but I genuinely thought you just needed to include the library for the algorithms and you had everything going, but apparently I&#039;m missing something.<br />What do you need to configure?</p><p>Thanks a lot again.</p>]]></description>
			<author><![CDATA[null@example.com (vainn48)]]></author>
			<pubDate>Fri, 15 Nov 2024 23:35:12 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8059.html#p8059</guid>
		</item>
		<item>
			<title><![CDATA[Re: wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8058.html#p8058</link>
			<description><![CDATA[<p>Also, be sure that `WOLFSSL_DER_TO_PEM` is defined using a CFLAG when configuring wolfSSL:</p><div class="codebox"><pre><code>./configure CFLAGS=&quot;-DWOLFSSL_DER_TO_PEM&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (embhorn)]]></author>
			<pubDate>Fri, 15 Nov 2024 22:00:21 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8058.html#p8058</guid>
		</item>
		<item>
			<title><![CDATA[Re: wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8057.html#p8057</link>
			<description><![CDATA[<p>Hi vainn48</p><p>Welcome to the wolfSSL forums. Try switching the includes so that the options.h comes before any other wolfSSL headers.</p><div class="codebox"><pre><code>#include &lt;wolfssl.h&gt;
#include &lt;wolfssl/options.h&gt;</code></pre></div><p>Is this for a personal project?</p><p>Thanks,<br />Eric - wolfSSL Support</p>]]></description>
			<author><![CDATA[null@example.com (embhorn)]]></author>
			<pubDate>Fri, 15 Nov 2024 21:56:48 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8057.html#p8057</guid>
		</item>
		<item>
			<title><![CDATA[wc_DerToPem not found]]></title>
			<link>https://www.wolfssl.com/forums/post8056.html#p8056</link>
			<description><![CDATA[<p>Hi, I&#039;m working on a project with an ESP32 programmed using Arduino IDE; I am currently writing the code to decrypt an encrypted MQTT message that has been encrypted in a C# enviroment (NET MAUI) using my private RSA key, but I&#039;m having trouble fixing these errors.</p><p>I am having an Issue with the wc_DerToPem method, which I need to make a POST request to upload my public key to the database. The error I get is:</p><p>error: &#039;wc_DerToPem&#039; was not declared in this scope</p><p>But I looked it up and it is declared in wolfssl / wolfcrypt / asn_public, which of course I&#039;m including.<br />Everything works fine without decryption; due to privacy reasons I&#039;ll avoid to use the true addresses, usernames and passwords.</p><p>P.S.: if you notice something wrong with my code other than the reason I&#039;m writing, feel free to suggest improvement, tips or other ways to asjust it.</p><p>Thanks in advance!</p><p>Header:<br /></p><div class="codebox"><pre><code>#ifndef CRYPTOGRAPHYTOOLS_H
#define CRYPTOGRAPHYTOOLS_H

#include &lt;mbedtls/base64.h&gt;
#include &lt;wolfssl.h&gt;
#include &lt;wolfssl/options.h&gt;
#include &lt;wolfssl/wolfcrypt/aes.h&gt;
#include &lt;wolfssl/wolfcrypt/rsa.h&gt;
#include &lt;wolfssl/wolfcrypt/sha256.h&gt;
#include &lt;wolfssl/wolfcrypt/asn_public.h&gt;
#include &lt;ArduinoJson.h&gt;
#include &lt;HTTPClient.h&gt;
#include &lt;cstring&gt;
#include &lt;vector&gt;
#include &lt;string&gt;

#define KEY_DIMENSION 2048
#define KEY_SIZE KEY_DIMENSION/8
#define EXPONENT 65537

class CryptographyTools {

  public:
    byte privDer[KEY_SIZE];
    byte pubDer[KEY_SIZE];
    word32 privSz, pubSz;

    int generateRsaKeypair(const char* DEVICE_ID, String API_ADDRESS);
    int rsaDecrypt(const byte* encrypted, int encryptedLen, byte* decrypted, int decryptedLen, RsaKey* rsaKey);
    //int aesDecrypt(const byte* encrypted, int encryptedLen, byte* decrypted, const byte* key, const byte* iv);
    int totalDecrypt(String json_message, std::string &amp;decrypted_message, String API_ADDRESS);

};

#endif //CRYPTOGRAPHYTOOLS_H</code></pre></div><p>Source:<br /></p><div class="codebox"><pre><code>#include &lt;CryptographyTools.h&gt;


int CryptographyTools::generateRsaKeypair(const char* DEVICE_ID, String API_ADDRESS) {
  
  ...
  byte pem[2048];
  int pemSz = wc_DerToPem(pubDer, pubSz, pem, sizeof(pem), PUBLICKEY_TYPE);
  if (pemSz &lt; 0) {
    Serial.println(&quot;Error while converting from DER to PEM pubKey&quot;);
  }
  ...

  Serial.println(&quot;generate_rsa_keypair OK&quot;);
  return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (vainn48)]]></author>
			<pubDate>Fri, 15 Nov 2024 19:21:10 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post8056.html#p8056</guid>
		</item>
	</channel>
</rss>
