<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi, unfortunately that is not that simple :( These methods are not being exposed by the dotnet. Porting them would take to much time because of the method struct. Recompiling the whole dotnet sdk is also not an option. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="pl" data-phrase-index="0"><span>You know, i've been reading your mail and keep thinking and for now i see that the fastest way is
 to simply modify libp11 proxy engine in EVP_load_private_key method. First i can verify there the EVP_test_flag on the key and second modify the engine flags. This way i will be 100% sure that the problem is on dotnet side.</span></span></span><span style="font-size: 12pt;"> Because
 when i was testing this key on the token i was generating 1024 bit length key and written it's length to the console. Than i have erased it completly and generated a new key pair with modified key length to 2048. The output result was changed:
<span style="background-color:rgb(255, 255, 255);display:inline !important">1024 -> 2048</span>. So the conclusion was that the key i taken correclty.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 12pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 12pt;">I will check this on monday and keep you inform. Have a nice weekend.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="pl" data-phrase-index="0"><span><br>
</span></span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="pl" data-phrase-index="0"><span>BR</span></span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span class="VIiyi" lang="en"><span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="pl" data-phrase-index="0"><span>Piotr</span></span></span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Od:</b> Selva Nair <selva.nair@gmail.com><br>
<b>Wysłane:</b> sobota, 29 maja 2021 03:34<br>
<b>Do:</b> Piotr Lobacz <piotr.lobacz@softgent.com><br>
<b>Temat:</b> Re: CSR creation using pkcs11 dynamic engine</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi,</div>
<div dir="ltr"><br>
</div>
<div class="x_gmail_quote"></div>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div><font color="#000000" face="Calibri, Arial, Helvetica, sans-serif">I will also check these flags of my RSA object using RSA_test_flags and give you the answer. In the meantime as you have already told, the experts in here can share their knowledge, but
 i rather suspect that all you said is correct :] and the bug is in the dotnet implementation...</font></div>
</div>
</blockquote>
<div><br>
</div>
<div>You could probably work around it by getting the method from the key using meth = <span id="x_m_-2982317755189550455:4mxf.1">RSA</span>_get_method(<span id="x_m_-2982317755189550455:4mxf.2">rsa</span>) and then setting the flag on the method using
<span id="x_m_-2982317755189550455:4mxf.3">RSA</span>_<span id="x_m_-2982317755189550455:4mxf.4">meth</span>_set_flags(meth, flags). May not be a nice thing to do to a method owned by the engine, but should work if those API are exposed via
<span id="x_m_-2982317755189550455:4mxf.5">dotnet</span>.</div>
<div><br>
</div>
<div>If this is indeed the problem, you could try lobbying two places: <span id="x_m_-2982317755189550455:4mxf.6">
dotnet</span> devs to add a check for flags in the key, and libp11/pkcs11 engine devs to also set the flags on the method. One of them may oblige, depending on their thoughts on what is "right". </div>
<div><br>
</div>
<div><span id="x_m_-2982317755189550455:4mxf.7">Selva</span><br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr"></div>
</blockquote>
</div>
</div>
<a href="https://www.softgent.com" target="_blank"><img width="150" height="50" src="https://softgent.com/wp-content/uploads/2020/01/Zasob-14.png"></a>
<p style="color: gray; display: block; font-size: 9px; text-transform: uppercase; margin: 0; margin-top: 10px;">
<b>Softgent Sp. z o.o.</b>, Budowlanych 31d, 80-298 Gdansk, POLAND</p>
<p style="color: gray; display: block; font-size: 9px; text-transform: uppercase; margin: 0;">
KRS: 0000674406, NIP: 9581679801, REGON: 367090912</p>
<p style="color: gray; display: block; font-size: 9px; text-transform: uppercase; margin: 0;">
www.softgent.com</p>
<p style="color: gray; display: block; font-size: 9px; text-transform: uppercase; margin: 0; margin-top: 10px;">
Sąd Rejonowy Gdańsk-Północ w Gdańsku, VII Wydział Gospodarczy Krajowego Rejestru Sądowego</p>
<p style="color: gray; display: block; font-size: 9px; text-transform: uppercase; margin: 0;">
KRS 0000674406, Kapitał zakładowy: 25 000,00 zł wpłacony w całości.</p>
</body>
</html>