<?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 — RSA encryption]]></title>
		<link>https://www.wolfssl.com/forums/topic2077-rsa-encryption.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic2077.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in RSA encryption.]]></description>
		<lastBuildDate>Fri, 26 Jan 2024 10:58:25 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7464.html#p7464</link>
			<description><![CDATA[<p>Good news.<br />I find the iussue.<br />Missing wc_InitRsaKey_ex() before to call wc_RsaPublicKeyDecodeRaw().<br />Sorry for your time spent.<br />Thanks<br />Alex</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 26 Jan 2024 10:58:25 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7464.html#p7464</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7463.html#p7463</link>
			<description><![CDATA[<p>Add info<br />The function cryerror_t sama_rsa_lld_exponentiation(CRYDriver *cryp, rsacontext *rsactxp,uint8_t u1Mode, uint8_t * pu1Message)<br />fails the following step <br />&nbsp; &nbsp; &nbsp; &nbsp; // Testing if Modulus is present<br />&nbsp; &nbsp; &nbsp; &nbsp; if (!(rsactxp-&gt;u2FieldIsPresent &amp; MODULUS_IS_PRESENT))<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rsactxp-&gt;lastResult = ERR_MODULUS;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return CRY_ERR_INV_ALGO;<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 26 Jan 2024 10:19:13 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7463.html#p7463</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7462.html#p7462</link>
			<description><![CDATA[<p>Hi David,<br />see the following setup options used to buld wolfSSl.</p><p>/****************************************** settings.h **********************************************/</p><p>/* Configuration */</p><p>#if HAL_USE_CRY<br />#define CRY_DRV&nbsp; &nbsp;CRYD1<br />#define CRYD_KEY&nbsp; 0<br />#define HAL_CRY_WOLF_SHABUFF_SIZE 2*128<br />#endif</p><p>#define WOLFSSL_GENERAL_ALIGNMENT 4<br />#define HAVE_TM_TYPE<br />#define WORD64_AVAILABLE</p><p>/* ChibiOS */<br />#define WOLFSSL_CHIBIOS<br />#define WOLFSSL_CHIBIOS_HASH<br />#define WOLFSSL_CHIBIOS_AES<br />#define WOLFSSL_CHIBIOS_DES3<br />#define WOLFSSL_CHIBIOS_RSA<br />#define WOLFSSL_CHIBIOS_ECC<br />#define WOLFSSL_NO_HASH_RAW<br />/*<br /> * alex_b 19/01/2024 to use API wc_RsaDirect() with no padding<br /> */<br />#define WC_RSA_DIRECT<br />#define WC_RSA_NO_PADDING<br />/* */</p><p>/* Lwip */<br />#define WOLFSSL_LWIP<br />#define WOLFSSL_USER_IO</p><p>/* Lwip API used with wolfssl */<br />#define WOLFSSL_USE_SOCKET<br />//#define WOLFSSL_USE_NETCONN</p><p>/* Timers */<br />#define USER_TICKS <br />#define WOLFSSL_USER_CURRTIME <br />#define XMALLOC_OVERRIDE <br />//#define USE_WOLF_TIME_T<br />#define XTIME(tl)&nbsp; &nbsp; &nbsp; &nbsp;(epochTime())</p><p>//#define WOLFCRYPT_ONLY<br />#define HAVE_SNI</p><p>/* CMAC&nbsp; */<br />#define WOLFSSL_CMAC</p><p>/* DEBUG&nbsp; */<br />#define DEBUG_WOLFSSL<br />#define WOLFSSL_DEBUG_TLS</p><p>/* ARM&nbsp; */<br />#define RSA_LOW_MEM<br />#define NO_OLD_RNGNAME<br />#define NO_OLD_WC_NAMES<br />#define SMALL_SESSION_CACHE<br />#define WOLFSSL_SMALL_STACK</p><p>#define TFM_ARM<br />#define SINGLE_THREADED<br />#define NO_SIG_WRAPPER</p><p>/* Cipher features */<br />//#define USE_FAST_MATH<br />//#define ALT_ECC_SIZE</p><p>//#define HAVE_FFDHE_2048<br />//#define HAVE_CHACHA<br />#define HAVE_POLY1305<br />#define HAVE_ECC<br />#define HAVE_CURVE25519<br />#define CURVED25519_SMALL<br />#define HAVE_ONE_TIME_AUTH<br />#define WOLFSSL_DH_CONST<br />#define HAVE_SUPPORTED_CURVES<br />#define HAVE_TLS_EXTENSIONS</p><p>#define HAVE_ECC_KEY_EXPORT<br />#define HAVE_ECC_KEY_IMPORT<br />#define HAVE_ECC_VERIFY<br />#define HAVE_ECC_SIGN<br />#define HAVE_ECC_DHE</p><p>#define WOLFSSL_DER_TO_PEM<br />#define WOLFSSL_PEM_TO_DER<br />#define WOLFSSL_HAVE_PRF<br />#define WOLFSSL_ENCRYPTED_KEYS</p><p>#define WOLFSSL_STATIC_RSA</p><p>/* Cipher features */<br />//#define HAVE_ED25519<br />#define HAVE_SHA384<br />#define HAVE_SHA512<br />#define WOLFSSL_AES_DIRECT<br />#define WOLFSSL_SHA384<br />#define WOLFSSL_SHA512<br />#define WOLFSSL_AES_COUNTER<br />#define HAVE_AES_CBC<br />#define HAVE_AESGCM</p><p>/* Size/speed config */<br />//#define USE_SLOW_SHA2</p><p>/* Robustness */<br />#define TFM_TIMING_RESISTANT<br />#define ECC_TIMING_RESISTANT<br />#define WC_RSA_BLINDING<br />#define WOLFSSL_KEY_GEN<br />#define WOLFSSL_CERT_GEN<br />#define WOLFSSL_CERT_REQ<br />#define WOLFSSL_CERT_EXT</p><p>/* File system */<br />#define NO_STDIO_FILESYSTEM<br />#define WOLFSSL_USER_FILESYSTEM</p><p>/* Remove Features */<br />#define NO_WOLFSSL_SERVER<br />#define NO_WRITEV<br />#define NO_DEV_RANDOM<br />#define WOLFSSL_NO_SOCK<br />#define NO_WOLFSSL_DIR<br />#define NO_MAIN_DRIVER<br />#define NO_MD4<br />#define NO_RABBIT<br />#define NO_HC128<br />#define NO_DSA<br />#define NO_PWDBASED<br />#define NO_PSK</p><p>/* MA_18112021 added for Retail Protocol */<br />#define NO_DES3</p><p>#define NO_RC4</p><p>#define WOLFSSL_AES_128<br />#define WOLFSSL_AES_192<br />#define WOLFSSL_AES_256</p><p>/* MA_08022022 added for Retail Protocol */<br />#define OPENSSL_EXTRA<br />#define OPENSSL_EXTRA_X509_SMALL<br />#ifndef WC_ASYNC_DEV_SIZE<br />&nbsp; &nbsp; #define WC_ASYNC_DEV_SIZE 512<br />#endif</p><p>#if defined GBC_PCI_CERTIFICATION<br />&nbsp; #define IGNORE_KEY_EXTENSIONS<br />#endif</p><p>/* Realloc (to use without USE_FAST_MATH) */<br />void *chHeapRealloc (void *addr, uint32_t size);<br />void *chibios_alloc(void *heap, int size);<br />void chibios_free(void *ptr);</p><p>#define XREALLOC(p,n,h,t)&nbsp; &nbsp;chHeapRealloc( (p) , (n) )<br />#define XMALLOC(s,h,t)&nbsp; &nbsp; &nbsp; chibios_alloc(h,s)<br />#define XFREE(p,h,t)&nbsp; &nbsp; &nbsp; &nbsp; chibios_free(p)</p><p>/* Re-mapping file system functions */<br />#if defined WOLFSSL_USER_FILESYSTEM<br />&nbsp; #define XFILE&nbsp; &nbsp; &nbsp;int32_t *<br />&nbsp; #define XFOPEN&nbsp; &nbsp; chibios_fopen<br />&nbsp; #define XFSEEK&nbsp; &nbsp; chibios_fseek<br />&nbsp; #define XFTELL&nbsp; &nbsp; chibios_ftell<br />&nbsp; #define XREWIND&nbsp; &nbsp;chibios_rewind<br />&nbsp; #define XFREAD&nbsp; &nbsp; chibios_fread<br />&nbsp; #define XFWRITE&nbsp; &nbsp;chibios_fwrite<br />&nbsp; #define XFCLOSE&nbsp; &nbsp;chibios_fclose<br />&nbsp; #define XSEEK_END SEEK_END<br />&nbsp; #define XBADFILE&nbsp; NULL<br />&nbsp; #define XFGETS(A,B,C)&nbsp; &nbsp;NULL<br />&nbsp; #define XGETENV(A)&nbsp; &nbsp;NULL</p><p>&nbsp; XFILE&nbsp; chibios_fopen(const char *filename, const char *mode);<br />&nbsp; int&nbsp; &nbsp; chibios_fseek(XFILE file, long offset, int whence);<br />&nbsp; long&nbsp; &nbsp;chibios_ftell(XFILE file);<br />&nbsp; void&nbsp; &nbsp;chibios_rewind(XFILE file);<br />&nbsp; size_t chibios_fread(void *ptr, size_t size, size_t nmemb, XFILE file);<br />&nbsp; size_t chibios_fwrite(void *ptr, size_t size, size_t nmemb, XFILE file);<br />&nbsp; int&nbsp; &nbsp; chibios_fclose(XFILE file);<br />#endif</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 26 Jan 2024 08:27:39 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7462.html#p7462</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7460.html#p7460</link>
			<description><![CDATA[<p>Hi Alessandro,</p><p>That error typically means you have not allocated enough stack space to the task.</p><p>Can you share how you are building wolfSSL? We have a few different math library options with different memory use.</p><p>If you want to reduce stack use try with WOLFSSL_SMALL_STACK set.</p><p>Thanks,<br />David Garske, wolfSSL</p>]]></description>
			<author><![CDATA[null@example.com (dgarske)]]></author>
			<pubDate>Thu, 25 Jan 2024 18:35:23 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7460.html#p7460</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7459.html#p7459</link>
			<description><![CDATA[<p>Hi,<br />using the API wc_RsaPublicKeyDecodeRaw the wc_RsaDirect() return the error -112.<br />Please see the following test code<br />Thanks</p><p>/********************** TEST START **************************************/<br />#ifdef WOLFSSL_STATIC_MEMORY<br />&nbsp; &nbsp; static WOLFSSL_HEAP_HINT* HEAP_HINT;<br />#else<br />&nbsp; &nbsp; #define HEAP_HINT NULL<br />#endif /* WOLFSSL_STATIC_MEMORY */</p><p>/* for async devices */<br />static int devId = INVALID_DEVID;</p><p>#define RSA_TEST_BYTES 256</p><p>#define MY_RSA_KEY_BITS 2048<br />#define MY_RSA_KEY_BYTES MY_RSA_KEY_BITS/8</p><p>static const char PKmodulus[MY_RSA_KEY_BYTES] = {<br />0xBD,0xCE,0x7F,0xC1,0x0D,0xC7,0x97,0xA7,0xD4,0x75,0xBB,0xAC,0x49,0x4C,0x0F,0xEC,0x20,0x16,0x29,0x99,0xC8,0xBD,0x63,0xA5,0xDB,0x7D,0xCC,0xF1,0xA6,0x6C,0x45,0xA3,<br />0x9D,0x65,0x6A,0xEC,0xF2,0x2D,0xA8,0xD4,0xAC,0x36,0xF5,0x2D,0x83,0xE5,0x4F,0xC6,0x78,0x0A,0x1D,0x7B,0x8F,0xAC,0x10,0xB9,0x52,0xA4,0x81,0x1C,0x73,0x64,0xF3,0xCD,<br />0x66,0x73,0x30,0x13,0x81,0xE3,0x91,0x46,0x3C,0x6F,0x9D,0x14,0x24,0x4B,0xDC,0xCA,0x0A,0xDC,0x9D,0xCD,0x96,0xB5,0x53,0x4B,0xD6,0xC5,0x31,0x35,0x88,0xBB,0xE3,0x2B,<br />0x58,0x6C,0x93,0x7B,0x9E,0xE0,0x39,0x26,0x05,0xDC,0xB5,0x8B,0x5D,0xAB,0xB5,0x8C,0x61,0x94,0x09,0x6D,0x89,0x6C,0x87,0xF6,0xB2,0xDA,0xDC,0x6B,0xED,0xB3,0xFA,0xE6,<br />0x42,0xBF,0x9C,0xD8,0x24,0x51,0x9C,0x21,0xCC,0x23,0x61,0xBA,0x58,0x8C,0x25,0x28,0xD5,0x10,0x28,0x96,0x3E,0x87,0x90,0xF9,0x7D,0x37,0x5C,0x00,0xEE,0x2F,0xFD,0x88,<br />0x9C,0x9B,0xE1,0xC4,0x79,0xD7,0x71,0xCF,0x62,0xD6,0xD4,0x21,0xE6,0x0E,0xF6,0x09,0x14,0xDB,0xCE,0xF6,0x0A,0x54,0xE6,0x41,0x4D,0x78,0x98,0x3B,0x74,0x0C,0xC9,0x70,<br />0xCA,0x8F,0xEA,0x26,0xF1,0x37,0x48,0xE8,0xEC,0xFF,0xDC,0xB0,0x4C,0x55,0x1B,0x86,0xCE,0x62,0xB7,0x5F,0x61,0x6D,0x8E,0x26,0x90,0x9D,0x0B,0xA3,0xB6,0xD3,0xEF,0xC3,<br />0x6A,0xEC,0xB9,0x39,0xAC,0x8F,0xC6,0x16,0xB8,0xBB,0x06,0xEC,0x4A,0x8C,0x9E,0xCB,0x66,0x45,0x8F,0x96,0x2C,0x91,0x70,0x2F,0xBF,0x09,0xE4,0xDE,0xBE,0x89,0xB,0x035,<br />};<br />static const char PKexponent[4] = { 0x00,0x00,0x00,0x03 };</p><p>static const char encryptedData[MY_RSA_KEY_BYTES] = {<br />0x20,0xB6,0x62,0x00,0x61,0x56,0x40,0xBD,0xD9,0x8E,0x23,0xAF,0x7C,0xEB,0xF4,0xE9,0x88,0x21,0x42,0x28,0x0A,0xEE,0xC3,0x23,0x39,0xF1,0x73,0x07,0xD4,0xD3,0xC3,0xDB,<br />0x6E,0x77,0x31,0x90,0x4B,0xBA,0x89,0x3A,0x0D,0x31,0xE2,0xEC,0x7A,0xC4,0x25,0x52,0xF8,0x48,0x98,0x6C,0xC5,0x45,0xDD,0x0A,0xD8,0x34,0x94,0x14,0xDF,0x70,0xD9,0x5F,<br />0xEF,0x3F,0xE5,0x58,0x67,0x45,0xC6,0x3F,0xCD,0xA6,0x58,0x31,0x3B,0x6A,0xE7,0x91,0x41,0xE5,0x93,0x40,0x05,0x69,0xA9,0x77,0xDE,0x5C,0x4D,0xDD,0xA3,0x12,0x57,0x01,<br />0x4A,0xFA,0x60,0x97,0xF8,0xEC,0x0F,0x97,0xF2,0xE7,0x56,0x2E,0xEB,0x0F,0xE3,0xAB,0x3A,0xC5,0x55,0xDE,0x3A,0xC6,0x47,0xF7,0xEF,0x1E,0xC5,0xB7,0x74,0x0B,0x9B,0x35,<br />0xAF,0x36,0xF8,0x60,0x39,0x0A,0x87,0xE7,0x6A,0xAD,0x86,0x45,0x81,0x88,0xB1,0x25,0x3A,0xF2,0xCB,0x1A,0x5E,0xF9,0x72,0x2C,0x64,0x7C,0x07,0xDA,0x54,0x5F,0xEE,0x34,<br />0x49,0x5F,0x2B,0xD2,0xEE,0x87,0x1C,0x80,0x19,0xC3,0xD0,0x66,0xBF,0xC5,0x79,0x51,0x18,0x57,0x0D,0x18,0x73,0x18,0x23,0x67,0x14,0x50,0x55,0x1F,0xFC,0x79,0xEE,0x88,<br />0xF5,0x79,0x64,0xB5,0x66,0x9D,0x43,0xA1,0xBC,0x06,0xE0,0xC2,0x6B,0x21,0x9C,0xD5,0x09,0x4B,0xD6,0xBC,0x99,0x5D,0xE4,0x22,0x45,0x02,0x9B,0x94,0xCB,0xBD,0x15,0xB8,<br />0x99,0xA7,0x3A,0x3B,0x67,0x6E,0x93,0xC2,0x6E,0x51,0x52,0xB1,0x23,0xD5,0x75,0x6E,0x56,0x81,0x3F,0x8A,0x42,0x8F,0xEE,0x3E,0x4E,0x39,0xDD,0x7F,0xD0,0xE2,0xA6,0xB8,<br />};</p><p>static char decryptedData[MY_RSA_KEY_BYTES];</p><p>int testRSA_PK_Decrypt(void)<br />{<br />&nbsp; int32_t&nbsp; ret = -1;<br />&nbsp; byte&nbsp; &nbsp; &nbsp;e[sizeof(word32)];<br />&nbsp; byte&nbsp; &nbsp; &nbsp;n[MY_RSA_KEY_BYTES];<br />&nbsp; RsaKey&nbsp; &nbsp;wolfKey;<br />&nbsp; WC_RNG&nbsp; &nbsp;rng;<br />&nbsp; word32 outSz = MY_RSA_KEY_BYTES;</p><p>&nbsp; memset(&amp;wolfKey, 0, sizeof(RsaKey));<br />&nbsp; memset(&amp;rng, 0, sizeof(WC_RNG));<br />&nbsp; memset(n, 0, sizeof(n));<br />&nbsp; memset(e, 0, sizeof(e));</p><p>&nbsp; /* load modulus */<br />&nbsp; memcpy(n, PKmodulus, sizeof(PKmodulus));<br />&nbsp; /* load exponent */<br />&nbsp; memcpy(e, PKexponent, sizeof(PKexponent));<br />&nbsp; outSz = sizeof(PKmodulus);</p><p>&nbsp; do<br />&nbsp; {<br />&nbsp; &nbsp; /* load public key portion into wolf RsaKey */<br />&nbsp; &nbsp; ret = wc_RsaPublicKeyDecodeRaw(n, sizeof(PKmodulus), e, sizeof(PKexponent), &amp;wolfKey);<br />&nbsp; &nbsp; if ( ret != 0 )<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; logPrintf(LOG_DEBUG, &quot;wc_RsaPublicKeyDecodeRaw ERROR %d&quot;, ret);<br />&nbsp; &nbsp; &nbsp; ret = -2;<br />&nbsp; &nbsp; &nbsp; break; //stop on error<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; /* init Random */<br />&nbsp; &nbsp; ret = wc_InitRng_ex(&amp;rng, HEAP_HINT, devId);<br />&nbsp; &nbsp; if ( ret != 0 )<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; logPrintf(LOG_DEBUG, &quot;wc_InitRng_ex ERROR %d&quot;, ret);<br />&nbsp; &nbsp; &nbsp; ret = -3;<br />&nbsp; &nbsp; &nbsp; break; //stop on error<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; /* decrypt CA Public Key self-signed data with the CA Public Key */<br />&nbsp; &nbsp; memset(decryptedData, 0, sizeof(decryptedData));<br />&nbsp; &nbsp; do {<br />&nbsp; &nbsp; &nbsp; &nbsp; ret = wc_RsaDirect((byte *)encryptedData, sizeof(encryptedData), (byte *)decryptedData, &amp;outSz, &amp;wolfKey, RSA_PUBLIC_DECRYPT, &amp;rng);<br />&nbsp; &nbsp; } while (ret == WC_PENDING_E);<br />&nbsp; &nbsp; if ( ret &lt;= 0 )<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; logPrintf(LOG_DEBUG, &quot;wc_RsaDirect ERROR %d&quot;, ret);<br />&nbsp; &nbsp; &nbsp; ret = -4;<br />&nbsp; &nbsp; &nbsp; break; //stop on error<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ret = 0; //OK</p><p>&nbsp; } while ( 0 );</p><p>&nbsp; return ret;<br />}<br />/********************** TEST END **************************************/</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Thu, 25 Jan 2024 17:25:44 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7459.html#p7459</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7455.html#p7455</link>
			<description><![CDATA[<p>Hi Alessandro,</p><p>The RsaKey can be either a public only or private key. Depending on that you can do either a public only operation or public and private. The public modulus and exponent must be known. You would use the wc_RsaPublicKeyDecodeRaw API to import those. Example: <a href="https://github.com/wolfSSL/wolfTPM/blob/master/src/tpm2_wrap.c#L3092C10-L3092C34">https://github.com/wolfSSL/wolfTPM/blob … 0-L3092C34</a></p><p>Thanks,<br />David Garske, wolfSSL</p>]]></description>
			<author><![CDATA[null@example.com (dgarske)]]></author>
			<pubDate>Tue, 23 Jan 2024 16:14:21 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7455.html#p7455</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7454.html#p7454</link>
			<description><![CDATA[<p>API<br />int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz, RsaKey* key, int type, WC_RNG* rng);<br />can be used also if only the public modulus and exponent are known or I must use a new API?<br />Thanks</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Tue, 23 Jan 2024 10:19:24 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7454.html#p7454</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7447.html#p7447</link>
			<description><![CDATA[<p>Sorry my previous note is wrong.<br />I have resolved the issue</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 19 Jan 2024 16:48:46 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7447.html#p7447</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7446.html#p7446</link>
			<description><![CDATA[<p>Hi Alessandro,</p><p>Your input is 30 byes, which is not padded. Direct requires the input to match the key size (256 bytes).</p><p>If your input really is 30 bytes you need to apply a padding. There are a few standards like PKCSv15, PSS and OAEP.</p><p>Can you describe more about your use-case? This will help me recommend the right solution.</p><p>Thanks,<br />David Garske, wolfSSL</p>]]></description>
			<author><![CDATA[null@example.com (dgarske)]]></author>
			<pubDate>Fri, 19 Jan 2024 16:03:57 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7446.html#p7446</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7445.html#p7445</link>
			<description><![CDATA[<p>thanks for the reply.<br />Now</p><p>ret = wc_RsaDirect(in, 30, out, 256, &amp;key, RSA_PUBLIC_ENCRYPT, &amp;rng);</p><p>ret is BAD_FUNC_ARG (-173)</p><p>Take in mind that using</p><p>ret = wc_RsaPublicEncrypt(in, 30, out, 256, &amp;key)</p><p>the API works well.</p><p>I enabled the define WC_RSA_DIRECT &amp; WC_RSA_NO_PADDING. It is enough</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 19 Jan 2024 16:00:02 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7445.html#p7445</guid>
		</item>
		<item>
			<title><![CDATA[Re: RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7443.html#p7443</link>
			<description><![CDATA[<p>Hi Alessandro,</p><p>I assume your key size is 2048-bit. The RsaPublicEncrypt uses PKCSV15, so the max input is not the key size. To public encrypt an already padded 256-byte you would want to use `wc_RsaDirect`.</p><div class="codebox"><pre><code>/* Function that does the RSA operation directly with no padding.
 *
 * in       buffer to do operation on
 * inLen    length of input buffer
 * out      buffer to hold results
 * outSz    gets set to size of result buffer. Should be passed in as length
 *          of out buffer. If the pointer &quot;out&quot; is null then outSz gets set to
 *          the expected buffer size needed and LENGTH_ONLY_E gets returned.
 * key      RSA key to use for encrypt/decrypt
 * type     if using private or public key {RSA_PUBLIC_ENCRYPT,
 *          RSA_PUBLIC_DECRYPT, RSA_PRIVATE_ENCRYPT, RSA_PRIVATE_DECRYPT}
 * rng      wolfSSL RNG to use if needed
 *
 * returns size of result on success
 */
int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz,
        RsaKey* key, int type, WC_RNG* rng);</code></pre></div><p>Thanks,<br />David Garske, wolfSSL</p>]]></description>
			<author><![CDATA[null@example.com (dgarske)]]></author>
			<pubDate>Fri, 19 Jan 2024 14:27:26 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7443.html#p7443</guid>
		</item>
		<item>
			<title><![CDATA[RSA encryption]]></title>
			<link>https://www.wolfssl.com/forums/post7442.html#p7442</link>
			<description><![CDATA[<p>The API int wc_RsaPublicEncrypt(<br />&nbsp; &nbsp; const byte * in,<br />&nbsp; &nbsp; word32 inLen,<br />&nbsp; &nbsp; byte * out,<br />&nbsp; &nbsp; word32 outLen,<br />&nbsp; &nbsp; RsaKey * key,<br />&nbsp; &nbsp; WC_RNG * rng<br />)<br />works if the [in] buffer length is less than 245 bytes, but I have to encrypt a buffer of 256 bytes.<br />In this case the API ret is RSA_BUFFER_E (-131).<br />How I can use the API without any padding?</p>]]></description>
			<author><![CDATA[null@example.com (alessandroborga)]]></author>
			<pubDate>Fri, 19 Jan 2024 13:44:56 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post7442.html#p7442</guid>
		</item>
	</channel>
</rss>
